Код за потвърждение: Избери целия код
#include <amxmodx>
#define MSG_COLOR 150, 30, 30
#define MSG_POSITION -1.0, -1.0
#define MSG_DURATION 1.0
#define MSG_TEXT "H.E.A.D.S.H.O.T"
new g_iObject
public plugin_init()
{
register_plugin("H.E.A.D.S.H.O.T", "1.0", "OciXCrom")
register_event("DeathMsg", "OnPlayerKilled", "a", "3=1")
g_iObject = CreateHudSyncObj()
}
public OnPlayerKilled()
{
new iAttacker = read_data(1), iVictim = read_data(2)
if(!is_user_connected(iAttacker) || iAttacker == iVictim)
return
set_hudmessage(MSG_COLOR, MSG_POSITION, .holdtime = MSG_DURATION)
ShowSyncHudMsg(iAttacker, g_iObject, MSG_TEXT)
}
Код за потвърждение: Избери целия код
#include <amxmodx>
#define MAX_TXT_LEN 300
#define MAX_TXT_LEN_1 299
new killr = 0 /* describes current killer ( his id ) */
new nbHS[33] /* to store HS of players connected */
new nbFrags[33] /* to store frags of players connected */
new ranking[33] /* Rankingtab : 32 players from 1 to 32 ( 0 not used ) */
new titleMotd[30] = " HEADSHOT : Rankings"
new textFrags[25] = "Frags"
new noHeadshot[50]= "No Headshot, try later"
public init_stats() {
for ( new z = 0 ; z < 33 ; ++z ) {
nbHS[z] = 0
nbFrags[z] = 0
ranking[z] = 0
}
new hsflgs[10]
get_cvar_string("amx_hs_event",hsflgs,9)
return PLUGIN_CONTINUE
}
public get_rank(id) {
for ( new z = 1 ; z < 33 ; ++z )
if ( ranking[z] == id )
return z
return 0
}
public get_maxP() {
new value = 0
for ( new z = 1 ; z < 33 ; ++z )
if ( ranking[z] != 0 )
++value
return value
}
public remove_player(id) {
for ( new z = 0 ; z < 33 ; ++z ) {
if ( ranking[z] == id ) {
for ( new t = z ; t < 32 ; ++t )
ranking[t] = ranking[t+1]
ranking[32] = 0
return PLUGIN_CONTINUE
}
}
nbHS[id]=0
nbFrags[id]=0
return PLUGIN_CONTINUE
}
public update_rankings() {
for ( new z = 1 ; z < 33 ; ++z ) {
if ( ranking[z] == 0 ) {
ranking[z] = killr
return PLUGIN_CONTINUE
}
else if ( ranking[z] != killr ) {
if ( nbHS[killr] > nbHS[ranking[z]] ) {
for ( new w = 32 ; w > z ; --w ) {
ranking[w] = ranking[w-1]
}
ranking[z] = killr
new dec = 0
for ( new x = z+1 ; x < 33 ; ++x ) {
if ( ranking[x] == killr ) {
++dec
ranking [33-dec] = 0
}
if ( x+dec < 33 )
ranking[x]=ranking[x+dec]
}
return PLUGIN_CONTINUE
}
else if ( nbHS[killr] == nbHS[ranking[z]] ) {
new Float:prct1 = ( float(nbHS[killr]) / float( nbFrags[killr] ) ) * 100
new Float:prct2 = ( float(nbHS[ranking[z]]) / float( nbFrags[ranking[z]] ) ) * 100
if ( prct1 > prct2 ) {
for ( new w = 32 ; w > z ; --w ) {
ranking[w] = ranking[w-1]
}
ranking[z] = killr
new dec = 0
for ( new x = z+1 ; x < 33 ; ++x ) {
if ( ranking[x] == killr ) {
++dec
ranking [33-dec] = 0
}
if ( x+dec < 33 )
ranking[x]=ranking[x+dec]
}
return PLUGIN_CONTINUE
}
}
}
else if ( ranking[z] == killr ) {
return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}
public display_HS_TOP ( id ) {
new title[80]
new topText[2000]
new NameP[40]
format ( title , 79 ,titleMotd )
new NB = 0
new hsflags[10]
get_cvar_string("amx_hs_event",hsflags,9)
if ( read_flags(hsflags)&32) {
new textC1[200]; /* Rank column */
new textC2[700]; /* Name column */
new textC3[200]; /* HS column */
new textC4[200]; /* % of frags column 1 */
new textC5[200]; /* % of frags column 2 */
for ( new d = 1 ; d < 16 ; ++d ) {
new userId = ranking[d]
if ( userId == 0 ) {
/* No more rankings */
d = 50
}
else if ( is_user_connected(userId) ) {
if ( nbHS[userId] > 0 ) {
get_user_name ( userId , NameP , 39 )
new Float:percent = ( float(nbHS[userId]) / float(nbFrags[userId]) ) * 100
new temp1[10]
format ( temp1 , 9 , "%d<br>" , d )
add( textC1,199,temp1)
new temp6[256]
format ( temp6 , 255 , "%s<br />" , NameP )
add( textC2,699,temp6)
new temp3[30]
format ( temp3 , 29 , "%d<br>" , nbHS[userId] )
add( textC3,199,temp3)
new temp4[10]
format ( temp4 , 9 , "%.1f<br>" , percent )
add( textC4, 199, temp4 )
add( textC5, 199, "%<br>" )
++NB
}
}
}
if ( NB == 0 ) {
add (topText,1999,"<html><head></head><body bgcolor=^"#000^" text=^"#228B22^">")
add (topText,1999,"<div align=^"center^">")
add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22>")
add (topText,1999,"<br><br><br><b>")
new temp6[100]
format ( temp6 ,99, "%s ...",noHeadshot )
add (topText,1999,temp6)
add (topText,1999,"</b></font></div></body></html>")
}
else {
add (topText,1999,"<html><head></head><body bgcolor=^"#000^" text=^"#228B22^">")
add (topText,1999,"<table align=^"center^" width=^"80%^">")
add (topText,1999,"<td bgcolor=^"#000^" width=^"12%^">")
add (topText,1999,"<div align=^"center^">")
add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=orange><br><br><b>")
add (topText,1999,textC1)
add (topText,1999,"</b></td><td bgcolor=^"#000^"><div align=^"left^" width=^"48%^">")
add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22><br><br><b>")
add (topText,1999,textC2)
add (topText,1999,"</b></font></div></td><td bgcolor=^"#000^" width=^"20%^"><div align=^"center^">")
add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22><b>HS</b><br><br><b>")
add (topText,1999,textC3)
add (topText,1999,"</b></font></div></td><td bgcolor=^"#000^" width=^"15%^"><div align=^"right^">")
add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22><b>Frags</b><br><br><b>")
add (topText,1999,textC4)
add (topText,1999,"</b></font></div></td><td bgcolor=^"#000^" width=^"5%^"><div align=^"left^">")
add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22><br><br><b>")
add (topText,1999,textC5)
add (topText,1999,"</b></font></div></td></table></body></html>")
}
}
else {
for ( new d = 1 ; d < 33 ; ++d ) {
new userId = ranking[d]
if ( userId == 0 ) {
/* No more rankings */
d = 50
}
else if ( is_user_connected(userId) ) {
if ( nbHS[userId] > 0 ) {
get_user_name ( userId , NameP , 39 )
new Float:percent = ( float(nbHS[userId]) / float(nbFrags[userId]) ) * 100
new temp[MAX_TXT_LEN]
format ( temp , MAX_TXT_LEN_1 , "^n%d - %s^n %4d Headshot(s) - %s %.1f %% " ,d,NameP,nbHS[userId],textFrags,percent)
add( topText,2999,temp)
++NB
}
}
}
if ( NB == 0 )
format ( topText ,2047, "^n^n^n %s ...",noHeadshot )
}
show_motd(id,topText,title)
return PLUGIN_CONTINUE
}
public made_hs(){
killr = read_data(1)
if ( killr > 0 )
{
nbHS[killr]=nbHS[killr]+1
update_rankings()
}
return PLUGIN_CONTINUE
}
public made_frag(id){
killr = read_data(1)
if ( killr > 0 )
{
nbFrags[killr]=nbFrags[killr]+1
if ( ( read_data(3) == 1 ) && ( read_data(5) == 0 ) )
{
made_hs()
}
}
return PLUGIN_CONTINUE
}
public client_disconnected(id) {
remove_player(id)
return PLUGIN_CONTINUE
}
public plugin_init(){
register_plugin("Headshot DeluXe","X.16.1.0","DanRaZor/dedi")
init_stats()
register_cvar("hsd_version","X.16.1.0",FCVAR_SERVER)
register_event ("DeathMsg","made_frag","a" )
register_cvar ("amx_hs_event" ,"abf")
register_clcmd ("say /hsall" , "display_HS_TOP")
register_clcmd ("say_team /hsall" , "display_HS_TOP")
return PLUGIN_CONTINUE
}