cleaned revision for cstrike plugins

This commit is contained in:
Borja Ferrer 2005-09-18 03:19:34 +00:00
parent a816767abb
commit 324f4c58a8
5 changed files with 2611 additions and 2125 deletions

View File

@ -50,5 +50,5 @@
* Returning cellmin as value in get_score function * Returning cellmin as value in get_score function
* makes that rank won't be saved. */ * makes that rank won't be saved. */
public get_score( stats[8] , body[8] ) public get_score(stats[8], body[8])
return stats[0] - stats[1] - stats[3] // kills - deaths - teamkills return stats[0] - stats[1] - stats[3] // kills - deaths - teamkills

View File

@ -78,16 +78,19 @@ new g_doubleKillId
new g_friend[33] new g_friend[33]
new g_firstBlood new g_firstBlood
new g_MultiKillMsg[7][] = { new g_MultiKillMsg[7][] =
{
"Multi-Kill! %s^n%L %d %L (%d %L)", "Multi-Kill! %s^n%L %d %L (%d %L)",
"Ultra-Kill!!! %s^n%L %d %L (%d %L)", "Ultra-Kill!!! %s^n%L %d %L (%d %L)",
"%s IS ON A KILLING SPREE!!!^n%L %d %L (%d %L)", "%s IS ON A KILLING SPREE!!!^n%L %d %L (%d %L)",
"RAMPAGE!!! %s^n%L %d %L (%d hs)" , "RAMPAGE!!! %s^n%L %d %L (%d hs)",
"%s IS UNSTOPPABLE!!!^n%L %d %L (%d %L)", "%s IS UNSTOPPABLE!!!^n%L %d %L (%d %L)",
"%s IS A MONSTER!^n%L %d %L (%d %L)", "%s IS A MONSTER!^n%L %d %L (%d %L)",
"%s IS GODLIKE!!!!^n%L %d %L (%d %L)" "%s IS GODLIKE!!!!^n%L %d %L (%d %L)"
} }
new g_Sounds[7][] = {
new g_Sounds[7][] =
{
"multikill", "multikill",
"ultrakill", "ultrakill",
"killingspree", "killingspree",
@ -96,7 +99,8 @@ new g_Sounds[7][] = {
"monsterkill", "monsterkill",
"godlike" "godlike"
} }
new g_KillingMsg[7][] = { new g_KillingMsg[7][] =
{
"%s: Multi-Kill!", "%s: Multi-Kill!",
"%s: Ultra-Kill!!!", "%s: Ultra-Kill!!!",
"%s IS ON A KILLING SPREE!!!", "%s IS ON A KILLING SPREE!!!",
@ -105,31 +109,41 @@ new g_KillingMsg[7][] = {
"%s IS A MONSTER!", "%s IS A MONSTER!",
"%s IS GODLIKE!!!" "%s IS GODLIKE!!!"
} }
new g_KinfeMsg[4][] = {
new g_KinfeMsg[4][] =
{
"KNIFE_MSG_1", "KNIFE_MSG_1",
"KNIFE_MSG_2", "KNIFE_MSG_2",
"KNIFE_MSG_3", "KNIFE_MSG_3",
"KNIFE_MSG_4" "KNIFE_MSG_4"
} }
new g_LastMessages[4][] = {
new g_LastMessages[4][] =
{
"LAST_MSG_1", "LAST_MSG_1",
"LAST_MSG_2", "LAST_MSG_2",
"LAST_MSG_3", "LAST_MSG_3",
"LAST_MSG_4" "LAST_MSG_4"
} }
new g_HeMessages[4][] = {
new g_HeMessages[4][] =
{
"HE_MSG_1", "HE_MSG_1",
"HE_MSG_2", "HE_MSG_2",
"HE_MSG_3", "HE_MSG_3",
"HE_MSG_4" "HE_MSG_4"
} }
new g_SHeMessages[4][] = {
new g_SHeMessages[4][] =
{
"SHE_MSG_1", "SHE_MSG_1",
"SHE_MSG_2", "SHE_MSG_2",
"SHE_MSG_3", "SHE_MSG_3",
"SHE_MSG_4" "SHE_MSG_4"
} }
new g_HeadShots[7][] = {
new g_HeadShots[7][] =
{
"HS_MSG_1", "HS_MSG_1",
"HS_MSG_2", "HS_MSG_2",
"HS_MSG_3", "HS_MSG_3",
@ -139,417 +153,563 @@ new g_HeadShots[7][] = {
"HS_MSG_7" "HS_MSG_7"
} }
new g_teamsNames[4][] = { new g_teamsNames[4][] =
{
"TERRORIST", "TERRORIST",
"CT", "CT",
"TERRORISTS", "TERRORISTS",
"CTS" "CTS"
} }
public plugin_init() { public plugin_init()
register_plugin("CS Misc. Stats",AMXX_VERSION_STR,"AMXX Dev Team") {
register_plugin("CS Misc. Stats", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("miscstats.txt") register_dictionary("miscstats.txt")
register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w") register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w")
register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw") register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
register_event("RoundTime", "eNewRound", "bc") register_event("RoundTime", "eNewRound", "bc")
register_event("StatusValue","setTeam","be","1=1") register_event("StatusValue", "setTeam", "be", "1=1")
register_event("StatusValue","showStatus","be","1=2","2!0") register_event("StatusValue", "showStatus", "be", "1=2", "2!0")
register_event("StatusValue","hideStatus","be","1=1","2=0") register_event("StatusValue", "hideStatus", "be", "1=1", "2=0")
new mapname[32] new mapname[32]
get_mapname(mapname,31) get_mapname(mapname, 31)
if (equali(mapname,"de_",3)||equali(mapname,"csde_",5)) {
if (equali(mapname, "de_", 3) || equali(mapname, "csde_", 5))
{
register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4") register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4")
register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb")
register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d")
} }
else if ( equali( mapname , "cs_italy" ) ) { else if (equali(mapname, "cs_italy"))
register_event( "23" , "chickenKill", "a" , "1=108" , /*"12=106",*/ "15=4" ) {
register_event( "23" , "radioKill", "a" , "1=108" , /*"12=294",*/ "15=2" ) register_event("23", "chickenKill", "a", "1=108", /*"12=106", */ "15=4")
register_event("23", "radioKill", "a", "1=108", /*"12=294", */ "15=2")
} }
} }
public plugin_cfg() { public plugin_cfg()
{
new g_addStast[] = "amx_statscfg add ^"%s^" %s" new g_addStast[] = "amx_statscfg add ^"%s^" %s"
server_cmd(g_addStast,"MultiKill","MultiKill")
server_cmd(g_addStast,"MultiKillSound","MultiKillSound") server_cmd(g_addStast, "MultiKill", "MultiKill")
server_cmd(g_addStast,"Bomb Planting","BombPlanting") server_cmd(g_addStast, "MultiKillSound", "MultiKillSound")
server_cmd(g_addStast,"Bomb Defusing","BombDefusing") server_cmd(g_addStast, "Bomb Planting", "BombPlanting")
server_cmd(g_addStast,"Bomb Planted","BombPlanted") server_cmd(g_addStast, "Bomb Defusing", "BombDefusing")
server_cmd(g_addStast,"Bomb Defuse Succ.","BombDefused") server_cmd(g_addStast, "Bomb Planted", "BombPlanted")
server_cmd(g_addStast,"Bomb Def. Failure","BombFailed") server_cmd(g_addStast, "Bomb Defuse Succ.", "BombDefused")
server_cmd(g_addStast,"Bomb PickUp","BombPickUp") server_cmd(g_addStast, "Bomb Def. Failure", "BombFailed")
server_cmd(g_addStast,"Bomb Drop","BombDrop") server_cmd(g_addStast, "Bomb PickUp", "BombPickUp")
server_cmd(g_addStast,"Bomb Count Down","BombCountVoice") server_cmd(g_addStast, "Bomb Drop", "BombDrop")
server_cmd(g_addStast,"Bomb Count Down (def)","BombCountDef") server_cmd(g_addStast, "Bomb Count Down", "BombCountVoice")
server_cmd(g_addStast,"Bomb Site Reached","BombReached") server_cmd(g_addStast, "Bomb Count Down (def)", "BombCountDef")
server_cmd(g_addStast,"Italy Bonus Kill","ItalyBonusKill") server_cmd(g_addStast, "Bomb Site Reached", "BombReached")
server_cmd(g_addStast,"Last Man","LastMan") server_cmd(g_addStast, "Italy Bonus Kill", "ItalyBonusKill")
server_cmd(g_addStast,"Knife Kill","KnifeKill") server_cmd(g_addStast, "Last Man", "LastMan")
server_cmd(g_addStast,"Knife Kill Sound","KnifeKillSound") server_cmd(g_addStast, "Knife Kill", "KnifeKill")
server_cmd(g_addStast,"Grenade Kill","GrenadeKill") server_cmd(g_addStast, "Knife Kill Sound", "KnifeKillSound")
server_cmd(g_addStast,"Grenade Suicide","GrenadeSuicide") server_cmd(g_addStast, "Grenade Kill", "GrenadeKill")
server_cmd(g_addStast,"HeadShot Kill","HeadShotKill") server_cmd(g_addStast, "Grenade Suicide", "GrenadeSuicide")
server_cmd(g_addStast,"HeadShot Kill Sound","HeadShotKillSound") server_cmd(g_addStast, "HeadShot Kill", "HeadShotKill")
server_cmd(g_addStast,"Round Counter","RoundCounter") server_cmd(g_addStast, "HeadShot Kill Sound", "HeadShotKillSound")
server_cmd(g_addStast,"Round Counter Sound","RoundCounterSound") server_cmd(g_addStast, "Round Counter", "RoundCounter")
server_cmd(g_addStast,"Killing Streak","KillingStreak") server_cmd(g_addStast, "Round Counter Sound", "RoundCounterSound")
server_cmd(g_addStast,"Killing Streak Sound","KillingStreakSound") server_cmd(g_addStast, "Killing Streak", "KillingStreak")
server_cmd(g_addStast,"Enemy Remaining","EnemyRemaining") server_cmd(g_addStast, "Killing Streak Sound", "KillingStreakSound")
server_cmd(g_addStast,"Double Kill","DoubleKill") server_cmd(g_addStast, "Enemy Remaining", "EnemyRemaining")
server_cmd(g_addStast,"Double Kill Sound","DoubleKillSound") server_cmd(g_addStast, "Double Kill", "DoubleKill")
server_cmd(g_addStast,"Player Name","PlayerName") server_cmd(g_addStast, "Double Kill Sound", "DoubleKillSound")
server_cmd(g_addStast,"First Blood Sound","FirstBloodSound") server_cmd(g_addStast, "Player Name", "PlayerName")
server_cmd(g_addStast, "First Blood Sound", "FirstBloodSound")
} }
public client_putinserver(id) public client_putinserver(id)
{ {
g_multiKills[id] = { 0 , 0 } g_multiKills[id] = {0, 0}
g_streakKills[ id ] = { 0 , 0 } g_streakKills[id] = {0, 0}
} }
public client_death(killer,victim,wpnindex,hitplace,TK) { public client_death(killer, victim, wpnindex, hitplace, TK)
{
if ( wpnindex == CSW_C4 ) if (wpnindex == CSW_C4)
return return
new headshot = (hitplace == HIT_HEAD) ? 1 : 0
new selfkill = (killer == victim) ? 1 : 0
new headshot = ( hitplace == HIT_HEAD ) ? 1:0 if (g_firstBlood)
new selfkill = ( killer == victim ) ? 1:0 {
if ( g_firstBlood ) {
g_firstBlood = 0 g_firstBlood = 0
if ( FirstBloodSound ) play_sound("misc/firstblood") if (FirstBloodSound)
play_sound("misc/firstblood")
} }
if ( (KillingStreak || KillingStreakSound) && !TK ) {
g_streakKills[ victim ][ 1 ]++ if ((KillingStreak || KillingStreakSound) && !TK)
g_streakKills[ victim ][ 0 ] = 0 {
if (!selfkill){ g_streakKills[victim][1]++
g_streakKills[ killer ][ 0 ]++ g_streakKills[victim][0] = 0
g_streakKills[ killer ][ 1 ] = 0
new a = g_streakKills[ killer ][ 0 ] - 3 if (!selfkill)
if ( (a > -1) && !( a % 2 ) ) { {
g_streakKills[killer][0]++
g_streakKills[killer][1] = 0
new a = g_streakKills[killer][0] - 3
if ((a > -1) && !(a % 2))
{
new name[32] new name[32]
get_user_name( killer , name , 31 ) get_user_name(killer, name, 31)
if ( (a >>= 1) > 6 ) a = 6
if ( KillingStreak ){ if ((a >>= 1) > 6)
a = 6
if (KillingStreak)
{
set_hudmessage(0, 100, 255, 0.05, 0.55, 2, 0.02, 6.0, 0.01, 0.1, 3) set_hudmessage(0, 100, 255, 0.05, 0.55, 2, 0.02, 6.0, 0.01, 0.1, 3)
show_hudmessage(0,g_KillingMsg[ a ], name ) show_hudmessage(0, g_KillingMsg[a], name)
} }
if ( KillingStreakSound ) {
if (KillingStreakSound)
{
new file[32] new file[32]
format(file, 32, "misc/%s", g_Sounds[a]) format(file, 32, "misc/%s", g_Sounds[a])
play_sound(file) play_sound(file)
} }
} }
} }
} }
if ( MultiKill || MultiKillSound ) {
if (!selfkill && !TK ) { if (MultiKill || MultiKillSound)
{
if (!selfkill && !TK)
{
g_multiKills[killer][0]++ g_multiKills[killer][0]++
g_multiKills[killer][1] += headshot g_multiKills[killer][1] += headshot
new param[2] new param[2]
param[0] = killer param[0] = killer
param[1] = g_multiKills[killer][0] param[1] = g_multiKills[killer][0]
set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,2) set_task(4.0 + float(param[1]), "checkKills", 0, param, 2)
} }
} }
if ( EnemyRemaining )
if (EnemyRemaining)
{ {
new ppl[32], pplnum = 0 new ppl[32], pplnum = 0
new team = get_user_team( victim ) - 1 new team = get_user_team(victim) - 1
if ( team >= 0 && team < 4 )
get_players(ppl,pplnum,"e", g_teamsNames[1 - team] ) if (team >= 0 && team < 4)
get_players(ppl, pplnum, "e", g_teamsNames[1 - team])
if (pplnum) if (pplnum)
{ {
new eppl[32], epplnum new eppl[32], epplnum
if (team >= 0 && team < 4) if (team >= 0 && team < 4)
{ {
get_players(eppl,epplnum,"ae",g_teamsNames[team]) get_players(eppl, epplnum, "ae", g_teamsNames[team])
if (epplnum) if (epplnum)
{ {
new message[128],team_name[32] new message[128], team_name[32]
set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.02, 3.0, 3)
for(new a=0; a<pplnum; ++a) set_hudmessage(255, 255, 255, 0.02, 0.85, 2, 0.05, 0.1, 0.02, 3.0, 3)
for (new a = 0; a < pplnum; ++a)
{ {
format(team_name,31,"%L",ppl[a],(epplnum==1)?g_teamsNames[team]:g_teamsNames[team+2]) format(team_name, 31, "%L", ppl[a], (epplnum == 1) ? g_teamsNames[team] : g_teamsNames[team + 2])
format(message,127,"%L",ppl[a],"REMAINING",epplnum,team_name) format(message, 127, "%L", ppl[a], "REMAINING", epplnum, team_name)
show_hudmessage(ppl[a],message)
show_hudmessage(ppl[a], message)
} }
} }
} }
} }
} }
if ( LastMan ) {
if (LastMan)
{
new cts[32], ts[32], ctsnum, tsnum new cts[32], ts[32], ctsnum, tsnum
get_players(cts,ctsnum,"ae", g_teamsNames[1] )
get_players(ts,tsnum,"ae", g_teamsNames[0] ) get_players(cts, ctsnum, "ae", g_teamsNames[1])
if ( ctsnum == 1 && tsnum == 1 ) { get_players(ts, tsnum, "ae", g_teamsNames[0])
if (ctsnum == 1 && tsnum == 1)
{
new ctname[32], tname[32] new ctname[32], tname[32]
get_user_name(cts[0],ctname,31)
get_user_name(ts[0],tname,31) get_user_name(cts[0], ctname, 31)
get_user_name(ts[0], tname, 31)
set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
show_hudmessage(0,"%s vs. %s",ctname,tname) show_hudmessage(0, "%s vs. %s", ctname, tname)
play_sound("misc/maytheforce") play_sound("misc/maytheforce")
} }
else if ( !g_LastAnnounce ) { else if (!g_LastAnnounce)
{
new oposite = 0, team = 0 new oposite = 0, team = 0
if ( ctsnum == 1 && tsnum > 1 ) {
if (ctsnum == 1 && tsnum > 1)
{
g_LastAnnounce = cts[0] g_LastAnnounce = cts[0]
oposite = tsnum oposite = tsnum
team = 0 team = 0
} }
else if ( tsnum == 1 && ctsnum > 1 ) { else if (tsnum == 1 && ctsnum > 1)
{
g_LastAnnounce = ts[0] g_LastAnnounce = ts[0]
oposite = ctsnum oposite = ctsnum
team = 1 team = 1
} }
if (g_LastAnnounce) {
if (g_LastAnnounce)
{
new name[32] new name[32]
get_user_name(g_LastAnnounce,name,31)
get_user_name(g_LastAnnounce, name, 31)
set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
show_hudmessage(0,"%s (%d HP) vs. %d %s%s: %L",name, show_hudmessage(0, "%s (%d HP) vs. %d %s%s: %L", name, get_user_health(g_LastAnnounce), oposite, g_teamsNames[team], (oposite == 1) ? "" : "S", LANG_PLAYER, g_LastMessages[random_num(0, 3)])
get_user_health(g_LastAnnounce),oposite,
g_teamsNames[team],(oposite==1)?"":"S",LANG_PLAYER,g_LastMessages[ random_num(0,3) ] )
if (!is_user_connecting(g_LastAnnounce)) if (!is_user_connecting(g_LastAnnounce))
client_cmd(g_LastAnnounce,"spk misc/oneandonly") client_cmd(g_LastAnnounce, "spk misc/oneandonly")
} }
} }
} }
if ( wpnindex == CSW_KNIFE && ( KnifeKill || KnifeKillSound ) ) { if (wpnindex == CSW_KNIFE && (KnifeKill || KnifeKillSound))
if ( KnifeKill ) { {
new killer_name[32],victim_name[32] if (KnifeKill)
get_user_name(killer,killer_name,31) {
get_user_name(victim,victim_name,31) new killer_name[32], victim_name[32]
get_user_name(killer, killer_name, 31)
get_user_name(victim, victim_name, 31)
set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
show_hudmessage(0,"%L",LANG_PLAYER,g_KinfeMsg[ random_num(0,3) ],killer_name,victim_name) show_hudmessage(0, "%L", LANG_PLAYER, g_KinfeMsg[random_num(0, 3)], killer_name, victim_name)
}
if ( KnifeKillSound ) play_sound("misc/humiliation")
} }
if ( wpnindex == CSW_HEGRENADE && (GrenadeKill || GrenadeSuicide) ) { if (KnifeKillSound)
new killer_name[32],victim_name[32] play_sound("misc/humiliation")
get_user_name(killer,killer_name,32) }
get_user_name(victim,victim_name,32)
if (wpnindex == CSW_HEGRENADE && (GrenadeKill || GrenadeSuicide))
{
new killer_name[32], victim_name[32]
get_user_name(killer, killer_name, 32)
get_user_name(victim, victim_name, 32)
set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
if ( !selfkill ) {
if ( GrenadeKill ) show_hudmessage(0,"%L",LANG_PLAYER,g_HeMessages[ random_num(0,3)],killer_name,victim_name) if (!selfkill)
{
if (GrenadeKill)
show_hudmessage(0, "%L", LANG_PLAYER, g_HeMessages[random_num(0, 3)], killer_name, victim_name)
} }
else if ( GrenadeSuicide ) show_hudmessage(0,"%L",LANG_PLAYER,g_SHeMessages[ random_num(0,3) ],victim_name) else if (GrenadeSuicide)
show_hudmessage(0, "%L", LANG_PLAYER, g_SHeMessages[random_num(0, 3)], victim_name)
} }
if ( headshot && (HeadShotKill || HeadShotKillSound) ) {
if ( HeadShotKill && wpnindex ) { if (headshot && (HeadShotKill || HeadShotKillSound))
{
if (HeadShotKill && wpnindex)
{
new killer_name[32], victim_name[32], weapon_name[32], message[128], players[32], pnum new killer_name[32], victim_name[32], weapon_name[32], message[128], players[32], pnum
xmod_get_wpnname(wpnindex,weapon_name,31)
get_user_name(killer,killer_name,31)
get_user_name(victim,victim_name,31)
get_players(players,pnum,"c") xmod_get_wpnname(wpnindex, weapon_name, 31)
for (new i=0;i<pnum;i++) { get_user_name(killer, killer_name, 31)
format( message, 127, "%L",players[i],g_HeadShots[ random_num(0,6) ] ) get_user_name(victim, victim_name, 31)
replace( message, 127 , "$vn", victim_name ) get_players(players, pnum, "c")
replace( message, 127 , "$wn", weapon_name )
replace( message, 127 , "$kn", killer_name ) for (new i = 0; i < pnum; i++)
{
format(message, 127, "%L", players[i], g_HeadShots[random_num(0, 6)])
replace(message, 127, "$vn", victim_name)
replace(message, 127, "$wn", weapon_name)
replace(message, 127, "$kn", killer_name)
set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1) set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1)
show_hudmessage(players[i],message ) show_hudmessage(players[i], message)
} }
} }
if ( HeadShotKillSound ) {
client_cmd(killer,"spk misc/headshot") if (HeadShotKillSound)
client_cmd(victim,"spk misc/headshot") {
client_cmd(killer, "spk misc/headshot")
client_cmd(victim, "spk misc/headshot")
} }
} }
if ( (DoubleKill || DoubleKillSound) && !selfkill ) {
if ((DoubleKill || DoubleKillSound) && !selfkill)
{
new Float:nowtime = get_gametime() new Float:nowtime = get_gametime()
if ( g_doubleKill == nowtime && g_doubleKillId == killer ) {
if ( DoubleKill ) { if (g_doubleKill == nowtime && g_doubleKillId == killer)
{
if (DoubleKill)
{
new name[32] new name[32]
get_user_name( killer , name , 31 )
get_user_name(killer, name, 31)
set_hudmessage(255, 0, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) set_hudmessage(255, 0, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
show_hudmessage(0,"%L",LANG_PLAYER,"DOUBLE_KILL",name ) show_hudmessage(0, "%L", LANG_PLAYER, "DOUBLE_KILL", name)
} }
if ( DoubleKillSound ) play_sound("misc/doublekill")
if (DoubleKillSound)
play_sound("misc/doublekill")
} }
g_doubleKill = nowtime g_doubleKill = nowtime
g_doubleKillId = killer g_doubleKillId = killer
} }
} }
public hideStatus(id) { public hideStatus(id)
if ( PlayerName ) { {
set_hudmessage(0,0,0,0.0,0.0,0, 0.0, 0.01, 0.0, 0.0, 4) if (PlayerName)
show_hudmessage(id,"") {
set_hudmessage(0, 0, 0, 0.0, 0.0, 0, 0.0, 0.01, 0.0, 0.0, 4)
show_hudmessage(id, "")
} }
} }
public setTeam(id) public setTeam(id)
g_friend[id] = read_data(2) g_friend[id] = read_data(2)
public showStatus(id) { public showStatus(id)
if ( PlayerName ) { {
new name[32],pid = read_data(2) if (PlayerName)
get_user_name(pid,name,31) {
new color1 = 0,color2 = 0 new name[32], pid = read_data(2)
if ( get_user_team(pid)==1 )
get_user_name(pid, name, 31)
new color1 = 0, color2 = 0
if (get_user_team(pid) == 1)
color1 = 255 color1 = 255
else else
color2 = 255 color2 = 255
if (g_friend[id]==1) { // friend
new clip, ammo, wpnid = get_user_weapon(pid,clip,ammo) if (g_friend[id] == 1) // friend
{
new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo)
new wpnname[32] new wpnname[32]
if ( wpnid )
xmod_get_wpnname(wpnid,wpnname,31) if (wpnid)
set_hudmessage(color1,50,color2,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4) xmod_get_wpnname(wpnid, wpnname, 31)
show_hudmessage(id,"%s -- %d HP / %d AP / %s",name,
get_user_health(pid),get_user_armor(pid),wpnname) set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4)
} show_hudmessage(id, "%s -- %d HP / %d AP / %s", name, get_user_health(pid), get_user_armor(pid), wpnname)
else { } else {
set_hudmessage(color1,50,color2,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4) set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4)
show_hudmessage(id,name) show_hudmessage(id, name)
} }
} }
} }
public eNewRound() public eNewRound()
if ( read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0) ) { {
if (read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0))
{
g_firstBlood = 1 g_firstBlood = 1
g_C4Timer = 0 g_C4Timer = 0
++g_roundCount ++g_roundCount
if ( RoundCounter ) {
if (RoundCounter)
{
set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
show_hudmessage(0, "%L", LANG_PLAYER, "PREPARE_FIGHT", g_roundCount ) show_hudmessage(0, "%L", LANG_PLAYER, "PREPARE_FIGHT", g_roundCount)
}
if ( RoundCounterSound ) play_sound("misc/prepare")
if ( KillingStreak ) {
new appl[32],ppl, i
get_players(appl,ppl, "ac" )
for (new a = 0; a < ppl; ++a) {
i = appl[ a ]
if ( g_streakKills[ i ][ 0 ] >= 2 )
client_print( i , print_chat , "* %L", i, "KILLED_ROW", g_streakKills[ i ][ 0 ] )
else if ( g_streakKills[ i ][ 1 ] >= 2 )
client_print( i , print_chat , "* %L", i, "DIED_ROUNDS", g_streakKills[ i ][ 1 ] )
}
}
} }
public eRestart() { if (RoundCounterSound)
play_sound("misc/prepare")
if (KillingStreak)
{
new appl[32], ppl, i
get_players(appl, ppl, "ac")
for (new a = 0; a < ppl; ++a)
{
i = appl[a]
if (g_streakKills[i][0] >= 2)
client_print(i, print_chat, "* %L", i, "KILLED_ROW", g_streakKills[i][0])
else if (g_streakKills[i][1] >= 2)
client_print(i, print_chat, "* %L", i, "DIED_ROUNDS", g_streakKills[i][1])
}
}
}
}
public eRestart()
{
eEndRound() eEndRound()
g_roundCount = 0 g_roundCount = 0
g_firstBlood = 1 g_firstBlood = 1
} }
public eEndRound() { public eEndRound()
{
g_C4Timer = -2 g_C4Timer = -2
g_LastOmg = 0.0 g_LastOmg = 0.0
remove_task(8038) remove_task(8038)
g_LastAnnounce = 0 g_LastAnnounce = 0
} }
public checkKills(param[]) { public checkKills(param[])
{
new id = param[0] new id = param[0]
new a = param[1] new a = param[1]
if (a == g_multiKills[id][0]) {
if (a == g_multiKills[id][0])
{
a -= 3 a -= 3
if ( a > -1 ) {
if ( MultiKill ) { if (a > -1)
{
if (MultiKill)
{
new name[32] new name[32]
get_user_name(id,name,31)
get_user_name(id, name, 31)
set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2) set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
if ( a > 6 ) a = 6
show_hudmessage(0,g_MultiKillMsg[a],name,LANG_PLAYER,"WITH",g_multiKills[id][0],LANG_PLAYER,"KILLS",g_multiKills[id][1],LANG_PLAYER,"HS") if (a > 6)
a = 6
show_hudmessage(0, g_MultiKillMsg[a], name, LANG_PLAYER, "WITH", g_multiKills[id][0], LANG_PLAYER, "KILLS", g_multiKills[id][1], LANG_PLAYER, "HS")
} }
if ( MultiKillSound )
if (MultiKillSound)
{ {
new sound[24] new sound[24]
format(sound, 23, "misc/%s", g_Sounds[a]) format(sound, 23, "misc/%s", g_Sounds[a])
play_sound(sound) play_sound(sound)
} }
} }
g_multiKills[id] = { 0,0 } g_multiKills[id] = {0, 0}
} }
} }
public chickenKill() public chickenKill()
if ( ItalyBonusKill ) announceEvent( 0 , "KILLED_CHICKEN" ) if (ItalyBonusKill)
announceEvent(0, "KILLED_CHICKEN")
public radioKill() { public radioKill()
if ( ItalyBonusKill ) announceEvent( 0 , "BLEW_RADIO" ) {
if (ItalyBonusKill)
announceEvent(0, "BLEW_RADIO")
} }
announceEvent( id, message[] ) { announceEvent(id, message[])
{
new name[32] new name[32]
get_user_name(id, name , 31)
get_user_name(id, name, 31)
set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
show_hudmessage(0,"%L",LANG_PLAYER,message,name) show_hudmessage(0, "%L", LANG_PLAYER, message, name)
} }
public eBombPickUp(id) public eBombPickUp(id)
if (BombPickUp) announceEvent(id , "PICKED_BOMB") if (BombPickUp)
announceEvent(id, "PICKED_BOMB")
public eBombDrop() public eBombDrop()
if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB") if (BombDrop)
announceEvent(g_Planter, "DROPPED_BOMB")
public eGotBomb(id) { public eGotBomb(id)
{
g_Planter = id g_Planter = id
if ( BombReached && read_data(1)==2 && g_LastOmg<get_gametime()) {
if (BombReached && read_data(1) == 2 && g_LastOmg < get_gametime())
{
g_LastOmg = get_gametime() + 15.0 g_LastOmg = get_gametime() + 15.0
announceEvent(g_Planter, "REACHED_TARGET" ) announceEvent(g_Planter, "REACHED_TARGET")
} }
} }
public bombTimer() { public bombTimer()
if (--g_C4Timer > 0) { {
if (BombCountVoice) { if (--g_C4Timer > 0)
if (g_C4Timer == 30 || g_C4Timer == 20) { {
if (BombCountVoice)
{
if (g_C4Timer == 30 || g_C4Timer == 20)
{
new temp[64] new temp[64]
num_to_word(g_C4Timer,temp,63)
num_to_word(g_C4Timer, temp, 63)
format(temp, 63, "^"vox/%s seconds until explosion^"", temp) format(temp, 63, "^"vox/%s seconds until explosion^"", temp)
play_sound(temp) play_sound(temp)
} }
else if (g_C4Timer < 11) { else if (g_C4Timer < 11)
{
new temp[64] new temp[64]
num_to_word(g_C4Timer,temp,63)
num_to_word(g_C4Timer, temp, 63)
format(temp, 63, "^"vox/%s^"", temp) format(temp, 63, "^"vox/%s^"", temp)
play_sound(temp) play_sound(temp)
} }
} }
if (BombCountDef && g_Defusing) client_print(g_Defusing,print_center,"%d",g_C4Timer) if (BombCountDef && g_Defusing)
client_print(g_Defusing, print_center, "%d", g_C4Timer)
} }
else remove_task(8038) else
remove_task(8038)
} }
public bomb_planted(planter){ public bomb_planted(planter)
{
g_Defusing = 0 g_Defusing = 0
if (BombPlanted) announceEvent(planter, "SET_UP_BOMB" )
g_C4Timer = get_cvar_num("mp_c4timer")
set_task(1.0,"bombTimer",8038,"",0,"b")
if (BombPlanted)
announceEvent(planter, "SET_UP_BOMB")
g_C4Timer = get_cvar_num("mp_c4timer")
set_task(1.0, "bombTimer", 8038, "", 0, "b")
} }
public bomb_planting(planter) public bomb_planting(planter)
if (BombPlanting) announceEvent(planter, "PLANT_BOMB" ) if (BombPlanting)
announceEvent(planter, "PLANT_BOMB")
public bomb_defusing(defuser)
{
if (BombDefusing)
announceEvent(defuser, "DEFUSING_BOMB")
public bomb_defusing(defuser){
if (BombDefusing) announceEvent(defuser, "DEFUSING_BOMB" )
g_Defusing = defuser g_Defusing = defuser
} }
public bomb_defused(defuser) public bomb_defused(defuser)
if (BombDefused) announceEvent(defuser, "DEFUSED_BOMB" ) if (BombDefused)
announceEvent(defuser, "DEFUSED_BOMB")
public bomb_explode(planter,defuser) public bomb_explode(planter, defuser)
if (BombFailed && defuser) announceEvent(defuser , "FAILED_DEFU" ) if (BombFailed && defuser)
announceEvent(defuser, "FAILED_DEFU")
public play_sound(sound[]) public play_sound(sound[])
{ {
new players[32], pnum new players[32], pnum
get_players(players, pnum, "c") get_players(players, pnum, "c")
new i new i
for (i=0; i<pnum; i++)
for (i = 0; i < pnum; i++)
{ {
if (is_user_connecting(players[i])) if (is_user_connecting(players[i]))
continue continue
client_cmd(players[i], "spk %s", sound) client_cmd(players[i], "spk %s", sound)
} }
} }

View File

@ -45,7 +45,9 @@ new g_Modified
new g_blockPos[112] new g_blockPos[112]
new g_saveFile[64] new g_saveFile[64]
new g_Restricted[] = "* This item is restricted *" new g_Restricted[] = "* This item is restricted *"
new g_menusNames[7][] = {
new g_menusNames[7][] =
{
"pistol", "pistol",
"shotgun", "shotgun",
"sub", "sub",
@ -54,7 +56,9 @@ new g_menusNames[7][] = {
"equip", "equip",
"ammo" "ammo"
} }
new g_MenuTitle[7][] = {
new g_MenuTitle[7][] =
{
"Handguns", "Handguns",
"Shotguns", "Shotguns",
"Sub-Machine Guns", "Sub-Machine Guns",
@ -63,8 +67,10 @@ new g_MenuTitle[7][] = {
"Equipment", "Equipment",
"Ammunition" "Ammunition"
} }
new g_menusSets[7][2] = {
{0,6},{6,8},{8,13},{13,23},{23,24},{24,32},{32,34} new g_menusSets[7][2] =
{
{0, 6}, {6, 8}, {8, 13}, {13, 23}, {23, 24}, {24, 32}, {32, 34}
} }
new g_AliasBlockNum new g_AliasBlockNum
@ -74,44 +80,47 @@ new g_AliasBlock[MAXMENUPOS]
// Second is a key for TERRORIST (all is key are minus one, 1 is 0, 2 is 1 etc.) // Second is a key for TERRORIST (all is key are minus one, 1 is 0, 2 is 1 etc.)
// Third is a key for CT // Third is a key for CT
// Position with -1 doesn't exist // Position with -1 doesn't exist
new g_Keys[MAXMENUPOS][3] = {
{1,1,1}, // H&K USP .45 Tactical new g_Keys[MAXMENUPOS][3] =
{1,0,0}, // Glock18 Select Fire {
{1,3,3}, // Desert Eagle .50AE {1, 1, 1}, // H&K USP .45 Tactical
{1,2,2}, // SIG P228 {1, 0, 0}, // Glock18 Select Fire
{1,4,-1}, // Dual Beretta 96G Elite {1, 3, 3}, // Desert Eagle .50AE
{1,-1,4}, // FN Five-Seven {1, 2, 2}, // SIG P228
{2,0,0}, // Benelli M3 Super90 {1, 4, -1}, // Dual Beretta 96G Elite
{2,1,1}, // Benelli XM1014 {1, -1, 4}, // FN Five-Seven
{3,1,1}, // H&K MP5-Navy {2, 0, 0}, // Benelli M3 Super90
{3,-1,0}, // Steyr Tactical Machine Pistol {2, 1, 1}, // Benelli XM1014
{3,3,3}, // FN P90 {3, 1, 1}, // H&K MP5-Navy
{3,0,-1}, // Ingram MAC-10 {3, -1, 0}, // Steyr Tactical Machine Pistol
{3,2,2}, // H&K UMP45 {3, 3, 3}, // FN P90
{4,1,-1}, // AK-47 {3, 0, -1}, // Ingram MAC-10
{4,0,-1}, // Gali {3, 2, 2}, // H&K UMP45
{4,-1,0}, // Famas {4, 1, -1}, // AK-47
{4,3,-1}, // Sig SG-552 Commando {4, 0, -1}, // Gali
{4,-1,2}, // Colt M4A1 Carbine {4, -1, 0}, // Famas
{4,-1,3}, // Steyr Aug {4, 3, -1}, // Sig SG-552 Commando
{4,2,1}, // Steyr Scout {4, -1, 2}, // Colt M4A1 Carbine
{4,4,5}, // AI Arctic Warfare/Magnum {4, -1, 3}, // Steyr Aug
{4,5,-1}, // H&K G3/SG-1 Sniper Rifle {4, 2, 1}, // Steyr Scout
{4,-1,4}, // Sig SG-550 Sniper {4, 4, 5}, // AI Arctic Warfare/Magnum
{5,0,0}, // FN M249 Para {4, 5, -1}, // H&K G3/SG-1 Sniper Rifle
{6,0,0}, // Kevlar Vest {4, -1, 4}, // Sig SG-550 Sniper
{6,1,1}, // Kevlar Vest & Helmet {5, 0, 0}, // FN M249 Para
{6,2,2}, // Flashbang {6, 0, 0}, // Kevlar Vest
{6,3,3}, // HE Grenade {6, 1, 1}, // Kevlar Vest & Helmet
{6,4,4}, // Smoke Grenade {6, 2, 2}, // Flashbang
{6,-1,6}, // Defuse Kit {6, 3, 3}, // HE Grenade
{6,5,5}, // NightVision Goggles {6, 4, 4}, // Smoke Grenade
{6,-1,7}, // Tactical Shield {6, -1, 6}, // Defuse Kit
{0,5,5}, // Primary weapon ammo {6, 5, 5}, // NightVision Goggles
{0,6,6} // Secondary weapon ammo {6, -1, 7}, // Tactical Shield
{0, 5, 5}, // Primary weapon ammo
{0, 6, 6} // Secondary weapon ammo
} }
new g_WeaponNames[MAXMENUPOS][] = { new g_WeaponNames[MAXMENUPOS][] =
{
"H&K USP .45 Tactical", "H&K USP .45 Tactical",
"Glock18 Select Fire", "Glock18 Select Fire",
"Desert Eagle .50AE", "Desert Eagle .50AE",
@ -148,7 +157,8 @@ new g_WeaponNames[MAXMENUPOS][] = {
"Secondary weapon ammo" "Secondary weapon ammo"
} }
new g_MenuItem[MAXMENUPOS][] = { new g_MenuItem[MAXMENUPOS][] =
{
"\yHandguns^n\w^n%d. %s\y\R%L^n\w", "\yHandguns^n\w^n%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w", "%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w", "%d. %s\y\R%L^n\w",
@ -192,7 +202,8 @@ new g_MenuItem[MAXMENUPOS][] = {
"%d. %s\y\R%L^n\w" "%d. %s\y\R%L^n\w"
} }
new g_Aliases[MAXMENUPOS][] = { new g_Aliases[MAXMENUPOS][] =
{
"usp", //Pistols "usp", //Pistols
"glock", "glock",
"deagle", "deagle",
@ -235,7 +246,8 @@ new g_Aliases[MAXMENUPOS][] = {
"secammo" "secammo"
} }
new g_Aliases2[MAXMENUPOS][] = { new g_Aliases2[MAXMENUPOS][] =
{
"km45", //Pistols "km45", //Pistols
"9x19mm", "9x19mm",
"nighthawk", "nighthawk",
@ -281,286 +293,394 @@ new g_Aliases2[MAXMENUPOS][] = {
new g_Autobuy[33][AUTOBUYLENGTH + 1] new g_Autobuy[33][AUTOBUYLENGTH + 1]
//new g_Rebuy[33][AUTOBUYLENGTH + 1] //new g_Rebuy[33][AUTOBUYLENGTH + 1]
setWeapon( a , action ) { setWeapon(a, action)
{
new b, m = g_Keys[a][0] * 8 new b, m = g_Keys[a][0] * 8
if (g_Keys[a][1] != -1) {
if (g_Keys[a][1] != -1)
{
b = m + g_Keys[a][1] b = m + g_Keys[a][1]
if ( action == 2 )
g_blockPos[ b ] = 1 - g_blockPos[ b ] if (action == 2)
g_blockPos[b] = 1 - g_blockPos[b]
else else
g_blockPos[ b ] = action g_blockPos[b] = action
} }
if (g_Keys[a][2] != -1) {
if (g_Keys[a][2] != -1)
{
b = m + g_Keys[a][2] + 56 b = m + g_Keys[a][2] + 56
if ( action == 2 )
g_blockPos[ b ] = 1 - g_blockPos[ b ] if (action == 2)
g_blockPos[b] = 1 - g_blockPos[b]
else else
g_blockPos[ b ] = action g_blockPos[b] = action
} }
for (new i = 0; i < g_AliasBlockNum; ++i) for (new i = 0; i < g_AliasBlockNum; ++i)
if ( g_AliasBlock[ i ] == a ){ if (g_AliasBlock[i] == a)
if ( !action || action == 2 ) { {
if (!action || action == 2)
{
--g_AliasBlockNum --g_AliasBlockNum
for(new j = i; j < g_AliasBlockNum; ++j )
g_AliasBlock[ j ] = g_AliasBlock[ j + 1 ] for (new j = i; j < g_AliasBlockNum; ++j)
g_AliasBlock[j] = g_AliasBlock[j + 1]
} }
return return
} }
if ( action && g_AliasBlockNum < MAXMENUPOS )
g_AliasBlock[ g_AliasBlockNum++ ] = a if (action && g_AliasBlockNum < MAXMENUPOS)
g_AliasBlock[g_AliasBlockNum++] = a
} }
findMenuId( name[] ) { findMenuId(name[])
for(new i = 0; i < 7 ; ++i) {
if( equali( name , g_menusNames[i] ) ) for (new i = 0; i < 7 ; ++i)
if (equali(name, g_menusNames[i]))
return i return i
return -1 return -1
} }
findAliasId( name[] ) { findAliasId(name[])
for(new i = 0; i < MAXMENUPOS ; ++i) {
if( equali( name , g_Aliases[i] ) ) for (new i = 0; i < MAXMENUPOS ; ++i)
if (equali(name, g_Aliases[i]))
return i return i
return -1 return -1
} }
switchCommand( id, action ) { switchCommand(id, action)
{
new c = read_argc() new c = read_argc()
if ( c < 3 ) {
setc( g_blockPos, 112, action ) if (c < 3)
console_print( id, "%L", id, action ? "EQ_WE_RES" : "EQ_WE_UNRES" ) {
setc(g_blockPos, 112, action)
console_print(id, "%L", id, action ? "EQ_WE_RES" : "EQ_WE_UNRES")
g_Modified = true g_Modified = true
} } else {
else {
new arg[32], a new arg[32], a
new bool:found = false new bool:found = false
for (new b = 2; b < c; ++b) {
read_argv(b,arg,31) for (new b = 2; b < c; ++b)
if ( (a = findMenuId( arg )) != -1 ) { {
read_argv(b, arg, 31)
if ((a = findMenuId(arg)) != -1)
{
c = g_menusSets[a][1] c = g_menusSets[a][1]
for (new i = g_menusSets[a][0]; i < c; ++i) for (new i = g_menusSets[a][0]; i < c; ++i)
setWeapon( i , action ) setWeapon(i, action)
console_print( id , "%s %L %L", g_MenuTitle[a], id, (a<5) ? "HAVE_BEEN" : "HAS_BEEN" , id, action ? "RESTRICTED" : "UNRESTRICTED" )
console_print(id, "%s %L %L", g_MenuTitle[a], id, (a < 5) ? "HAVE_BEEN" : "HAS_BEEN", id, action ? "RESTRICTED" : "UNRESTRICTED")
g_Modified = found = true g_Modified = found = true
} }
else if ( (a = findAliasId( arg )) != -1 ) { else if ((a = findAliasId(arg)) != -1)
{
g_Modified = found = true g_Modified = found = true
setWeapon( a , action ) setWeapon(a, action)
console_print( id , "%s %L %L", g_WeaponNames[a], id, "HAS_BEEN", id, action ? "RESTRICTED" : "UNRESTRICTED " ) console_print(id, "%s %L %L", g_WeaponNames[a], id, "HAS_BEEN", id, action ? "RESTRICTED" : "UNRESTRICTED ")
} }
} }
if ( !found )
console_print( id , "%L", id, "NO_EQ_WE" ) if (!found)
console_print(id, "%L", id, "NO_EQ_WE")
} }
} }
positionBlocked( a ) { positionBlocked(a)
{
new m = g_Keys[a][0] * 8 new m = g_Keys[a][0] * 8
new d = ( g_Keys[a][1]==-1) ? 0 : g_blockPos[ m + g_Keys[a][1] ] new d = (g_Keys[a][1] == -1) ? 0 : g_blockPos[m + g_Keys[a][1]]
d += ( g_Keys[a][2]==-1) ? 0 : g_blockPos[ m + g_Keys[a][2] + 56 ]
d += (g_Keys[a][2] == -1) ? 0 : g_blockPos[m + g_Keys[a][2] + 56]
return d return d
} }
public cmdRest(id,level,cid) { public cmdRest(id, level, cid)
if (!cmd_access(id,level,cid,1)) {
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED return PLUGIN_HANDLED
new cmd[8] new cmd[8]
read_argv(1,cmd,7)
if ( equali( "on" , cmd ) ) read_argv(1, cmd, 7)
switchCommand( id, 1 )
else if ( equali( "off" , cmd ) ) if (equali("on", cmd))
switchCommand( id, 0 ) switchCommand(id, 1)
else if ( equali( "list" , cmd ) ) { else if (equali("off", cmd))
switchCommand(id, 0)
else if (equali("list", cmd))
{
new arg1[8] new arg1[8]
new start = read_argv(2,arg1,7) ? str_to_num(arg1) : 1 new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1
if (--start < 0) start = 0
if (start >= MAXMENUPOS) start = MAXMENUPOS - 1 if (--start < 0)
start = 0
if (start >= MAXMENUPOS)
start = MAXMENUPOS - 1
new end = start + 10 new end = start + 10
if (end > MAXMENUPOS) end = MAXMENUPOS
new lName[16],lValue[16],lStatus[16],lOnOff[16] if (end > MAXMENUPOS)
format(lName,15,"%L",id,"NAME") end = MAXMENUPOS
format(lValue,15,"%L",id,"VALUE")
format(lStatus,15,"%L",id,"STATUS") new lName[16], lValue[16], lStatus[16], lOnOff[16]
format(lName, 15, "%L", id, "NAME")
format(lValue, 15, "%L", id, "VALUE")
format(lStatus, 15, "%L", id, "STATUS")
console_print(id, "^n----- %L: -----", id, "WEAP_RES") console_print(id, "^n----- %L: -----", id, "WEAP_RES")
console_print(id, " %-32.31s %-10.9s %-9.8s",lName,lValue,lStatus) console_print(id, " %-32.31s %-10.9s %-9.8s", lName, lValue, lStatus)
if ( start != -1 ) {
for (new a = start; a < end; ++a) { if (start != -1)
format(lOnOff,15,"%L",id,positionBlocked(a) ? "ON" : "OFF") {
console_print(id, "%3d: %-32.31s %-10.9s %-9.8s",a + 1, for (new a = start; a < end; ++a)
g_WeaponNames[a], g_Aliases[a], lOnOff) {
format(lOnOff, 15, "%L", id, positionBlocked(a) ? "ON" : "OFF")
console_print(id, "%3d: %-32.31s %-10.9s %-9.8s", a + 1, g_WeaponNames[a], g_Aliases[a], lOnOff)
} }
} }
console_print(id,"----- %L -----",id,"REST_ENTRIES_OF",start+1,end,MAXMENUPOS)
console_print(id, "----- %L -----", id, "REST_ENTRIES_OF", start + 1, end, MAXMENUPOS)
if (end < MAXMENUPOS) if (end < MAXMENUPOS)
console_print(id,"----- %L -----",id,"REST_USE_MORE",end+1) console_print(id, "----- %L -----", id, "REST_USE_MORE", end + 1)
else else
console_print(id,"----- %L -----",id,"REST_USE_BEGIN") console_print(id, "----- %L -----", id, "REST_USE_BEGIN")
} }
else if ( equali( "save" , cmd ) ) { else if (equali("save", cmd))
if ( saveSettings( g_saveFile ) ){ {
console_print( id , "%L", id, "REST_CONF_SAVED", g_saveFile ) if (saveSettings(g_saveFile))
{
console_print(id, "%L", id, "REST_CONF_SAVED", g_saveFile)
g_Modified = false g_Modified = false
} }
else console_print( id, "%L", id, "REST_COULDNT_SAVE", g_saveFile ) else
console_print(id, "%L", id, "REST_COULDNT_SAVE", g_saveFile)
} }
else if ( equali( "load" , cmd ) ) { else if (equali("load", cmd))
setc( g_blockPos, 112, 0 ) // Clear current settings {
setc(g_blockPos, 112, 0) // Clear current settings
new arg1[64] new arg1[64]
if ( read_argv(2, arg1 , 63 ) ) {
if (read_argv(2, arg1, 63))
{
new configsdir[32] new configsdir[32]
get_configsdir(configsdir,31) get_configsdir(configsdir, 31)
format(arg1,63,"%s/%s",configsdir,arg1)
format(arg1, 63, "%s/%s", configsdir, arg1)
} }
if ( loadSettings( arg1 ) ) {
console_print( id, "%L", id, "REST_CONF_LOADED", arg1 ) if (loadSettings(arg1))
{
console_print(id, "%L", id, "REST_CONF_LOADED", arg1)
g_Modified = true g_Modified = true
} }
else console_print( id, "%L", id, "REST_COULDNT_LOAD", arg1 ) else
} console_print(id, "%L", id, "REST_COULDNT_LOAD", arg1)
else { } else {
console_print(id,"%L",id,"COM_REST_USAGE") console_print(id, "%L", id, "COM_REST_USAGE")
console_print(id,"%L",id,"COM_REST_COMMANDS") console_print(id, "%L", id, "COM_REST_COMMANDS")
console_print(id,"%L",id,"COM_REST_ON") console_print(id, "%L", id, "COM_REST_ON")
console_print(id,"%L",id,"COM_REST_OFF") console_print(id, "%L", id, "COM_REST_OFF")
console_print(id,"%L",id,"COM_REST_ONV") console_print(id, "%L", id, "COM_REST_ONV")
console_print(id,"%L",id,"COM_REST_OFFV") console_print(id, "%L", id, "COM_REST_OFFV")
console_print(id,"%L",id,"COM_REST_LIST") console_print(id, "%L", id, "COM_REST_LIST")
console_print(id,"%L",id,"COM_REST_SAVE") console_print(id, "%L", id, "COM_REST_SAVE")
console_print(id,"%L",id,"COM_REST_LOAD") console_print(id, "%L", id, "COM_REST_LOAD")
console_print(id,"%L",id,"COM_REST_VALUES") console_print(id, "%L", id, "COM_REST_VALUES")
console_print(id,"%L",id,"COM_REST_TYPE") console_print(id, "%L", id, "COM_REST_TYPE")
} }
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displayMenu(id,pos) { displayMenu(id, pos)
if (pos < 0) return {
if (pos < 0)
return
new menubody[512], start = pos * 7 new menubody[512], start = pos * 7
if (start >= MAXMENUPOS) start = pos = g_Position[id] = 0
new len = format(menubody,511,"\y%L\R%d/5^n^n\w",id,"REST_WEAP",pos+1) if (start >= MAXMENUPOS)
start = pos = g_Position[id] = 0
new len = format(menubody, 511, "\y%L\R%d/5^n^n\w", id, "REST_WEAP", pos + 1)
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0 new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
if (end > MAXMENUPOS) end = MAXMENUPOS
for (new a = start; a < end; ++a) { if (end > MAXMENUPOS)
end = MAXMENUPOS
for (new a = start; a < end; ++a)
{
keys |= (1<<k) keys |= (1<<k)
len += format(menubody[len], 511 - len, g_MenuItem[a], ++k, g_WeaponNames[a], id, positionBlocked(a) ? "ON" : "OFF")
len += format(menubody[len],511-len,g_MenuItem[a],++k,g_WeaponNames[a], id, positionBlocked(a) ? "ON" : "OFF")
} }
len += format(menubody[len],511-len,"^n8. %L \y\R%s^n\w",id,"SAVE_SET",g_Modified?"*":"")
if (end != MAXMENUPOS) { len += format(menubody[len], 511 - len, "^n8. %L \y\R%s^n\w", id, "SAVE_SET", g_Modified ? "*" : "")
format(menubody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
if (end != MAXMENUPOS)
{
format(menubody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else format(menubody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT") else
show_menu(id,keys,menubody,-1,"Restrict Weapons") format(menubody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menubody, -1, "Restrict Weapons")
} }
public actionMenu(id,key) { public actionMenu(id, key)
switch (key) { {
case 7: { switch (key)
if (saveSettings(g_saveFile)) { {
case 7:
{
if (saveSettings(g_saveFile))
{
g_Modified = false g_Modified = false
client_print(id,print_chat,"* %L",id,"CONF_SAV_SUC") client_print(id, print_chat, "* %L", id, "CONF_SAV_SUC")
} }
else client_print(id,print_chat,"* %L",id,"CONF_SAV_FAIL") else
displayMenu(id,g_Position[id]) client_print(id, print_chat, "* %L", id, "CONF_SAV_FAIL")
displayMenu(id, g_Position[id])
} }
case 8: displayMenu(id,++g_Position[id]) case 8: displayMenu(id, ++g_Position[id])
case 9: displayMenu(id,--g_Position[id]) case 9: displayMenu(id, --g_Position[id])
default: { default:
setWeapon( g_Position[id] * 7 + key , 2 ) {
setWeapon(g_Position[id] * 7 + key, 2)
g_Modified = true g_Modified = true
displayMenu(id,g_Position[id]) displayMenu(id, g_Position[id])
} }
} }
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
public client_command( id ) { public client_command(id)
if ( g_AliasBlockNum ) { {
if (g_AliasBlockNum)
{
new arg[13] new arg[13]
if ( read_argv( 0, arg , 12 ) > 11 ) /* Longest buy command has 11 chars so if command is longer then don't care */ if (read_argv(0, arg, 12) > 11) /* Longest buy command has 11 chars so if command is longer then don't care */
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
new a = 0 new a = 0
do { do
if ( equali( g_Aliases[g_AliasBlock[ a ]] , arg ) ||
equali( g_Aliases2[g_AliasBlock[ a ]] , arg ) )
{ {
client_print(id,print_center,g_Restricted ) if (equali(g_Aliases[g_AliasBlock[a]], arg) || equali(g_Aliases2[g_AliasBlock[a]], arg))
{
client_print(id, print_center, g_Restricted)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
} while( ++a < g_AliasBlockNum ) } while (++a < g_AliasBlockNum)
} }
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
public blockcommand(id) { public blockcommand(id)
client_print(id,print_center, g_Restricted ) {
client_print(id, print_center, g_Restricted)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
public cmdMenu(id,level,cid){ public cmdMenu(id, level, cid)
if (cmd_access(id,level,cid,1)) {
displayMenu(id, g_Position[id] = 0 ) if (cmd_access(id, level, cid, 1))
displayMenu(id, g_Position[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
checkRest(id,menu,key){ checkRest(id, menu, key)
{
new team = get_user_team(id) new team = get_user_team(id)
if (team != 1 && team != 2) if (team != 1 && team != 2)
return PLUGIN_HANDLED return PLUGIN_HANDLED
if ( g_blockPos[ (menu * 8 + key) + (get_user_team(id) - 1) * 56 ] ){
engclient_cmd(id,"menuselect","10") if (g_blockPos[(menu * 8 + key) + (get_user_team(id) - 1) * 56])
client_print(id,print_center, g_Restricted ) {
engclient_cmd(id, "menuselect", "10")
client_print(id, print_center, g_Restricted)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
public ammoRest1(id) return checkRest(id,0,5) public ammoRest1(id) return checkRest(id, 0, 5)
public ammoRest2(id) return checkRest(id,0,6) public ammoRest2(id) return checkRest(id, 0, 6)
public menuBuy(id,key) return checkRest(id,0,key) public menuBuy(id, key) return checkRest(id, 0, key)
public menuPistol(id,key) return checkRest(id,1,key) public menuPistol(id, key) return checkRest(id, 1, key)
public menuShotgun(id,key) return checkRest(id,2,key) public menuShotgun(id, key) return checkRest(id, 2, key)
public menuSub(id,key) return checkRest(id,3,key) public menuSub(id, key) return checkRest(id, 3, key)
public menuRifle(id,key) return checkRest(id,4,key) public menuRifle(id, key) return checkRest(id, 4, key)
public menuMachine(id,key) return checkRest(id,5,key) public menuMachine(id, key) return checkRest(id, 5, key)
public menuItem(id,key) return checkRest(id,6,key) public menuItem(id, key) return checkRest(id, 6, key)
saveSettings(filename[]) { saveSettings(filename[])
{
if (file_exists(filename)) if (file_exists(filename))
delete_file(filename) delete_file(filename)
if (!write_file(filename,"; Generated by Restrict Weapons Plugin. Do not modify!^n; value name"))
if (!write_file(filename, "; Generated by Restrict Weapons Plugin. Do not modify!^n; value name"))
return 0 return 0
new text[64] new text[64]
for(new a = 0; a < MAXMENUPOS; ++a) {
if ( positionBlocked( a ) ) { for (new a = 0; a < MAXMENUPOS; ++a)
format(text,63,"%-16.15s ; %s", g_Aliases[a] , g_WeaponNames[a]) {
write_file(filename,text) if (positionBlocked(a))
{
format(text, 63, "%-16.15s ; %s", g_Aliases[a], g_WeaponNames[a])
write_file(filename, text)
} }
} }
return 1 return 1
} }
loadSettings(filename[]) { loadSettings(filename[])
if (!file_exists(filename)) return 0 {
if (!file_exists(filename))
return 0
new text[16] new text[16]
new a, pos = 0 new a, pos = 0
while (read_file(filename,pos++,text,15, a )) {
if ( text[0] == ';' || !a ) continue // line is a comment while (read_file(filename, pos++, text, 15, a))
parse( text, text , 15 ) {
if ( (a = findAliasId( text )) != -1 ) if (text[0] == ';' || !a)
setWeapon( a , 1 ) continue // line is a comment
parse(text, text, 15)
if ((a = findAliasId(text)) != -1)
setWeapon(a, 1)
} }
return 1 return 1
} }
// JGHG // JGHG
public fn_setautobuy(id) { public fn_setautobuy(id)
{
// Don't do anything if no items are blocked. // Don't do anything if no items are blocked.
if (!g_AliasBlockNum) if (!g_AliasBlockNum)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
@ -569,14 +689,15 @@ public fn_setautobuy(id) {
g_Autobuy[id][0] = '^0' g_Autobuy[id][0] = '^0'
new argCount = read_argc() new argCount = read_argc()
new arg[128] new arg[128]
new autobuyLen = 0 new autobuyLen = 0
for (new i = 1; i < argCount; i++) { // Start at parameter 1; parameter 0 is just "cl_setautobuy"
read_argv(i, arg, 127)
for (new i = 1; i < argCount; i++) // Start at parameter 1; parameter 0 is just "cl_setautobuy"
{
read_argv(i, arg, 127)
// Add this parameter to user's autobuy prefs // Add this parameter to user's autobuy prefs
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg) autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg)
// If we detect more parameters, add a space // If we detect more parameters, add a space
if (i + 1 < argCount) if (i + 1 < argCount)
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ") autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ")
@ -584,21 +705,25 @@ public fn_setautobuy(id) {
// Strip any blocked items // Strip any blocked items
new strippedItems[AUTOBUYLENGTH + 1] new strippedItems[AUTOBUYLENGTH + 1]
if (!StripBlockedItems(g_Autobuy[id], strippedItems)) if (!StripBlockedItems(g_Autobuy[id], strippedItems))
return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything...
//server_print("Stripped items: ^"%s^"", strippedItems) //server_print("Stripped items: ^"%s^"", strippedItems)
engclient_cmd(id, "cl_setautobuy", strippedItems) engclient_cmd(id, "cl_setautobuy", strippedItems)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
// Returns true if this strips any items, else false. // Returns true if this strips any items, else false.
StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1]) { StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1])
{
// First copy string // First copy string
format(outString, AUTOBUYLENGTH, inString) format(outString, AUTOBUYLENGTH, inString)
// Then strip those that are blocked. // Then strip those that are blocked.
for (new i = 0; i < g_AliasBlockNum; i++) { for (new i = 0; i < g_AliasBlockNum; i++)
{
while (contain(outString, g_Aliases[g_AliasBlock[i]]) != -1) while (contain(outString, g_Aliases[g_AliasBlock[i]]) != -1)
replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "") replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "")
while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1) while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1)
@ -606,61 +731,64 @@ StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1]) {
} }
// We COULD trim white space from outString here, but I don't think it really is necessary currently... // We COULD trim white space from outString here, but I don't think it really is necessary currently...
if (strlen(outString) < strlen(inString)) if (strlen(outString) < strlen(inString))
return true // outstring is shorter: we stripped items, return true return true // outstring is shorter: we stripped items, return true
return false // else end here, return false, no items were stripped return false // else end here, return false, no items were stripped
} }
public fn_autobuy(id) { public fn_autobuy(id)
{
// Don't do anything if no items are blocked. // Don't do anything if no items are blocked.
if (!g_AliasBlockNum) if (!g_AliasBlockNum)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
// Strip any blocked items // Strip any blocked items
new strippedItems[AUTOBUYLENGTH + 1] new strippedItems[AUTOBUYLENGTH + 1]
if (!StripBlockedItems(g_Autobuy[id], strippedItems)) if (!StripBlockedItems(g_Autobuy[id], strippedItems))
return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything...
engclient_cmd(id, "cl_setautobuy", strippedItems) engclient_cmd(id, "cl_setautobuy", strippedItems)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
public plugin_init() { public plugin_init()
register_plugin("Restrict Weapons",AMXX_VERSION_STR,"AMXX Dev Team") {
register_plugin("Restrict Weapons", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("restmenu.txt") register_dictionary("restmenu.txt")
register_dictionary("common.txt") register_dictionary("common.txt")
register_clcmd("buyammo1","ammoRest1") register_clcmd("buyammo1", "ammoRest1")
register_clcmd("buyammo2","ammoRest2") register_clcmd("buyammo2", "ammoRest2")
register_clcmd("cl_setautobuy", "fn_setautobuy") register_clcmd("cl_setautobuy", "fn_setautobuy")
register_clcmd("cl_autobuy", "fn_autobuy") register_clcmd("cl_autobuy", "fn_autobuy")
register_clcmd("amx_restmenu","cmdMenu",ADMIN_CFG,"- displays weapons restriction menu") register_clcmd("amx_restmenu", "cmdMenu", ADMIN_CFG, "- displays weapons restriction menu")
register_menucmd(register_menuid("#Buy", 1 ),511,"menuBuy") register_menucmd(register_menuid("#Buy", 1), 511, "menuBuy")
register_menucmd(register_menuid("Restrict Weapons"),1023,"actionMenu") register_menucmd(register_menuid("Restrict Weapons"), 1023, "actionMenu")
register_menucmd(register_menuid("BuyPistol", 1 ),511,"menuPistol") register_menucmd(register_menuid("BuyPistol", 1), 511, "menuPistol")
register_menucmd(register_menuid("BuyShotgun", 1 ),511,"menuShotgun") register_menucmd(register_menuid("BuyShotgun", 1), 511, "menuShotgun")
register_menucmd(register_menuid("BuySub", 1 ),511,"menuSub") register_menucmd(register_menuid("BuySub", 1), 511, "menuSub")
register_menucmd(register_menuid("BuyRifle", 1 ),511,"menuRifle") register_menucmd(register_menuid("BuyRifle", 1), 511, "menuRifle")
register_menucmd(register_menuid("BuyMachine", 1 ),511,"menuMachine") register_menucmd(register_menuid("BuyMachine", 1), 511, "menuMachine")
register_menucmd(register_menuid("BuyItem", 1 ),511,"menuItem") register_menucmd(register_menuid("BuyItem", 1), 511, "menuItem")
register_menucmd(-28,511,"menuBuy" ) register_menucmd(-28, 511, "menuBuy")
register_menucmd(-29,511,"menuPistol" ) register_menucmd(-29, 511, "menuPistol")
register_menucmd(-30,511,"menuShotgun") register_menucmd(-30, 511, "menuShotgun")
register_menucmd(-32,511,"menuSub") register_menucmd(-32, 511, "menuSub")
register_menucmd(-31,511,"menuRifle") register_menucmd(-31, 511, "menuRifle")
register_menucmd(-33,511,"menuMachine") register_menucmd(-33, 511, "menuMachine")
register_menucmd(-34,511,"menuItem") register_menucmd(-34, 511, "menuItem")
register_concmd("amx_restrict","cmdRest",ADMIN_CFG,"- displays help for weapons restriction") register_concmd("amx_restrict", "cmdRest", ADMIN_CFG, "- displays help for weapons restriction")
new configsDir[64]; new configsDir[64];
get_configsdir(configsDir, 63); get_configsdir(configsDir, 63);
#if defined MAPSETTINGS #if defined MAPSETTINGS
new mapname[32] new mapname[32]
get_mapname(mapname,31) get_mapname(mapname, 31)
format(g_saveFile,63,"%s/weaprest_%s.ini",configsDir,mapname) format(g_saveFile, 63, "%s/weaprest_%s.ini", configsDir, mapname)
#else #else
format(g_saveFile,63,"%s/weaprest.ini",configsDir) format(g_saveFile, 63, "%s/weaprest.ini", configsDir)
#endif #endif
loadSettings(g_saveFile) loadSettings(g_saveFile)
} }

View File

@ -38,46 +38,60 @@
new g_pingSum[33] new g_pingSum[33]
new g_pingCount[33] new g_pingCount[33]
public plugin_init() { public plugin_init()
register_plugin("CS Stats Logging",AMXX_VERSION_STR,"AMXX Dev Team") {
register_plugin("CS Stats Logging", AMXX_VERSION_STR, "AMXX Dev Team")
} }
public client_disconnect(id) { public client_disconnect(id)
if ( is_user_bot(id) ) { {
if (is_user_bot(id))
{
return return
} }
remove_task(id) remove_task(id)
new szTeam[16],szName[32],szAuthid[32], iStats[8], iHits[8], szWeapon[24]
new iUserid = get_user_userid( id ) new szTeam[16], szName[32], szAuthid[32], iStats[8], iHits[8], szWeapon[24]
get_user_team(id, szTeam, 15 ) new iUserid = get_user_userid(id)
get_user_name(id, szName ,31 )
get_user_authid(id, szAuthid , 31 ) get_user_team(id, szTeam, 15)
for (new i = 1 ; i < 31 ; ++i ) { get_user_name(id, szName, 31)
if ( get_user_wstats( id , i ,iStats , iHits ) ) { get_user_authid(id, szAuthid, 31)
xmod_get_wpnname( i , szWeapon , 23 )
for (new i = 1 ; i < 31 ; ++i)
{
if (get_user_wstats(id, i, iStats, iHits))
{
xmod_get_wpnname(i, szWeapon, 23)
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")", log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")",
szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1]) szName, iUserid, szAuthid, szTeam, szWeapon, iStats[4], iStats[5], iStats[0], iStats[2], iStats[3], iStats[6], iStats[1])
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")", log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")",
szName,iUserid,szAuthid,szTeam,szWeapon,iHits[1],iHits[2],iHits[3], iHits[4],iHits[5],iHits[6],iHits[7]) szName, iUserid, szAuthid, szTeam, szWeapon, iHits[1], iHits[2], iHits[3], iHits[4], iHits[5], iHits[6], iHits[7])
} }
} }
new iTime = get_user_time(id,1)
log_message("^"%s<%d><%s><%s>^" triggered ^"time^" (time ^"%d:%02d^")", new iTime = get_user_time(id, 1)
szName,iUserid,szAuthid,szTeam, (iTime / 60), (iTime % 60) )
log_message("^"%s<%d><%s><%s>^" triggered ^"latency^" (ping ^"%d^")", log_message("^"%s<%d><%s><%s>^" triggered ^"time^" (time ^"%d:%02d^")", szName, iUserid, szAuthid, szTeam, (iTime / 60), (iTime % 60))
szName,iUserid,szAuthid,szTeam, (g_pingSum[id] / ( g_pingCount[id] ? g_pingCount[id] : 1 ) ) ) log_message("^"%s<%d><%s><%s>^" triggered ^"latency^" (ping ^"%d^")", szName, iUserid, szAuthid, szTeam, (g_pingSum[id] / (g_pingCount[id] ? g_pingCount[id] : 1)))
} }
public client_putinserver(id) { public client_putinserver(id)
if ( !is_user_bot(id) ) { {
g_pingSum[ id ] = g_pingCount[ id ] = 0 if (!is_user_bot(id))
set_task( 19.5 , "getPing" , id , "" , 0 , "b" ) {
g_pingSum[id] = g_pingCount[id] = 0
set_task(19.5, "getPing", id, "", 0, "b")
} }
} }
public getPing(id) { public getPing(id)
{
new iPing, iLoss new iPing, iLoss
get_user_ping( id , iPing, iLoss)
g_pingSum[ id ] += iPing get_user_ping(id, iPing, iLoss)
++g_pingCount[ id ] g_pingSum[id] += iPing
++g_pingCount[id]
} }

File diff suppressed because it is too large Load Diff