mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
cleaned revision for cstrike plugins
This commit is contained in:
parent
a816767abb
commit
324f4c58a8
@ -78,7 +78,8 @@ new g_doubleKillId
|
||||
new g_friend[33]
|
||||
new g_firstBlood
|
||||
|
||||
new g_MultiKillMsg[7][] = {
|
||||
new g_MultiKillMsg[7][] =
|
||||
{
|
||||
"Multi-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)",
|
||||
@ -87,7 +88,9 @@ new g_MultiKillMsg[7][] = {
|
||||
"%s IS A MONSTER!^n%L %d %L (%d %L)",
|
||||
"%s IS GODLIKE!!!!^n%L %d %L (%d %L)"
|
||||
}
|
||||
new g_Sounds[7][] = {
|
||||
|
||||
new g_Sounds[7][] =
|
||||
{
|
||||
"multikill",
|
||||
"ultrakill",
|
||||
"killingspree",
|
||||
@ -96,7 +99,8 @@ new g_Sounds[7][] = {
|
||||
"monsterkill",
|
||||
"godlike"
|
||||
}
|
||||
new g_KillingMsg[7][] = {
|
||||
new g_KillingMsg[7][] =
|
||||
{
|
||||
"%s: Multi-Kill!",
|
||||
"%s: Ultra-Kill!!!",
|
||||
"%s IS ON A KILLING SPREE!!!",
|
||||
@ -105,31 +109,41 @@ new g_KillingMsg[7][] = {
|
||||
"%s IS A MONSTER!",
|
||||
"%s IS GODLIKE!!!"
|
||||
}
|
||||
new g_KinfeMsg[4][] = {
|
||||
|
||||
new g_KinfeMsg[4][] =
|
||||
{
|
||||
"KNIFE_MSG_1",
|
||||
"KNIFE_MSG_2",
|
||||
"KNIFE_MSG_3",
|
||||
"KNIFE_MSG_4"
|
||||
}
|
||||
new g_LastMessages[4][] = {
|
||||
|
||||
new g_LastMessages[4][] =
|
||||
{
|
||||
"LAST_MSG_1",
|
||||
"LAST_MSG_2",
|
||||
"LAST_MSG_3",
|
||||
"LAST_MSG_4"
|
||||
}
|
||||
new g_HeMessages[4][] = {
|
||||
|
||||
new g_HeMessages[4][] =
|
||||
{
|
||||
"HE_MSG_1",
|
||||
"HE_MSG_2",
|
||||
"HE_MSG_3",
|
||||
"HE_MSG_4"
|
||||
}
|
||||
new g_SHeMessages[4][] = {
|
||||
|
||||
new g_SHeMessages[4][] =
|
||||
{
|
||||
"SHE_MSG_1",
|
||||
"SHE_MSG_2",
|
||||
"SHE_MSG_3",
|
||||
"SHE_MSG_4"
|
||||
}
|
||||
new g_HeadShots[7][] = {
|
||||
|
||||
new g_HeadShots[7][] =
|
||||
{
|
||||
"HS_MSG_1",
|
||||
"HS_MSG_2",
|
||||
"HS_MSG_3",
|
||||
@ -139,14 +153,16 @@ new g_HeadShots[7][] = {
|
||||
"HS_MSG_7"
|
||||
}
|
||||
|
||||
new g_teamsNames[4][] = {
|
||||
new g_teamsNames[4][] =
|
||||
{
|
||||
"TERRORIST",
|
||||
"CT",
|
||||
"TERRORISTS",
|
||||
"CTS"
|
||||
}
|
||||
|
||||
public plugin_init() {
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("CS Misc. Stats", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("miscstats.txt")
|
||||
register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w")
|
||||
@ -155,21 +171,27 @@ public plugin_init() {
|
||||
register_event("StatusValue", "setTeam", "be", "1=1")
|
||||
register_event("StatusValue", "showStatus", "be", "1=2", "2!0")
|
||||
register_event("StatusValue", "hideStatus", "be", "1=1", "2=0")
|
||||
|
||||
new mapname[32]
|
||||
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("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb")
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
public plugin_cfg() {
|
||||
public plugin_cfg()
|
||||
{
|
||||
new g_addStast[] = "amx_statscfg add ^"%s^" %s"
|
||||
|
||||
server_cmd(g_addStast, "MultiKill", "MultiKill")
|
||||
server_cmd(g_addStast, "MultiKillSound", "MultiKillSound")
|
||||
server_cmd(g_addStast, "Bomb Planting", "BombPlanting")
|
||||
@ -207,176 +229,253 @@ public client_putinserver(id)
|
||||
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)
|
||||
return
|
||||
|
||||
|
||||
new headshot = (hitplace == HIT_HEAD) ? 1 : 0
|
||||
new selfkill = (killer == victim) ? 1 : 0
|
||||
|
||||
if ( g_firstBlood ) {
|
||||
if (g_firstBlood)
|
||||
{
|
||||
g_firstBlood = 0
|
||||
if ( FirstBloodSound ) play_sound("misc/firstblood")
|
||||
if (FirstBloodSound)
|
||||
play_sound("misc/firstblood")
|
||||
}
|
||||
if ( (KillingStreak || KillingStreakSound) && !TK ) {
|
||||
|
||||
if ((KillingStreak || KillingStreakSound) && !TK)
|
||||
{
|
||||
g_streakKills[victim][1]++
|
||||
g_streakKills[victim][0] = 0
|
||||
if (!selfkill){
|
||||
|
||||
if (!selfkill)
|
||||
{
|
||||
g_streakKills[killer][0]++
|
||||
g_streakKills[killer][1] = 0
|
||||
|
||||
new a = g_streakKills[killer][0] - 3
|
||||
if ( (a > -1) && !( a % 2 ) ) {
|
||||
|
||||
if ((a > -1) && !(a % 2))
|
||||
{
|
||||
new name[32]
|
||||
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)
|
||||
show_hudmessage(0, g_KillingMsg[a], name)
|
||||
}
|
||||
if ( KillingStreakSound ) {
|
||||
|
||||
if (KillingStreakSound)
|
||||
{
|
||||
new file[32]
|
||||
|
||||
format(file, 32, "misc/%s", g_Sounds[a])
|
||||
play_sound(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( MultiKill || MultiKillSound ) {
|
||||
if (!selfkill && !TK ) {
|
||||
|
||||
if (MultiKill || MultiKillSound)
|
||||
{
|
||||
if (!selfkill && !TK)
|
||||
{
|
||||
g_multiKills[killer][0]++
|
||||
g_multiKills[killer][1] += headshot
|
||||
|
||||
new param[2]
|
||||
|
||||
param[0] = killer
|
||||
param[1] = g_multiKills[killer][0]
|
||||
set_task(4.0 + float(param[1]), "checkKills", 0, param, 2)
|
||||
}
|
||||
}
|
||||
|
||||
if (EnemyRemaining)
|
||||
{
|
||||
new ppl[32], pplnum = 0
|
||||
new team = get_user_team(victim) - 1
|
||||
|
||||
if (team >= 0 && team < 4)
|
||||
get_players(ppl, pplnum, "e", g_teamsNames[1 - team])
|
||||
|
||||
if (pplnum)
|
||||
{
|
||||
new eppl[32], epplnum
|
||||
|
||||
if (team >= 0 && team < 4)
|
||||
{
|
||||
get_players(eppl, epplnum, "ae", g_teamsNames[team])
|
||||
|
||||
if (epplnum)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
||||
show_hudmessage(ppl[a], message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( LastMan ) {
|
||||
|
||||
if (LastMan)
|
||||
{
|
||||
new cts[32], ts[32], ctsnum, tsnum
|
||||
|
||||
get_players(cts, ctsnum, "ae", g_teamsNames[1])
|
||||
get_players(ts, tsnum, "ae", g_teamsNames[0])
|
||||
if ( ctsnum == 1 && tsnum == 1 ) {
|
||||
|
||||
if (ctsnum == 1 && tsnum == 1)
|
||||
{
|
||||
new ctname[32], tname[32]
|
||||
|
||||
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)
|
||||
show_hudmessage(0, "%s vs. %s", ctname, tname)
|
||||
|
||||
play_sound("misc/maytheforce")
|
||||
}
|
||||
else if ( !g_LastAnnounce ) {
|
||||
else if (!g_LastAnnounce)
|
||||
{
|
||||
new oposite = 0, team = 0
|
||||
if ( ctsnum == 1 && tsnum > 1 ) {
|
||||
|
||||
if (ctsnum == 1 && tsnum > 1)
|
||||
{
|
||||
g_LastAnnounce = cts[0]
|
||||
oposite = tsnum
|
||||
team = 0
|
||||
}
|
||||
else if ( tsnum == 1 && ctsnum > 1 ) {
|
||||
else if (tsnum == 1 && ctsnum > 1)
|
||||
{
|
||||
g_LastAnnounce = ts[0]
|
||||
oposite = ctsnum
|
||||
team = 1
|
||||
}
|
||||
if (g_LastAnnounce) {
|
||||
|
||||
if (g_LastAnnounce)
|
||||
{
|
||||
new name[32]
|
||||
|
||||
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)
|
||||
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) ] )
|
||||
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)])
|
||||
|
||||
if (!is_user_connecting(g_LastAnnounce))
|
||||
client_cmd(g_LastAnnounce, "spk misc/oneandonly")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( wpnindex == CSW_KNIFE && ( KnifeKill || KnifeKillSound ) ) {
|
||||
if ( KnifeKill ) {
|
||||
if (wpnindex == CSW_KNIFE && (KnifeKill || KnifeKillSound))
|
||||
{
|
||||
if (KnifeKill)
|
||||
{
|
||||
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)
|
||||
show_hudmessage(0, "%L", LANG_PLAYER, g_KinfeMsg[random_num(0, 3)], killer_name, victim_name)
|
||||
}
|
||||
if ( KnifeKillSound ) play_sound("misc/humiliation")
|
||||
|
||||
if (KnifeKillSound)
|
||||
play_sound("misc/humiliation")
|
||||
}
|
||||
|
||||
if ( wpnindex == CSW_HEGRENADE && (GrenadeKill || GrenadeSuicide) ) {
|
||||
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)
|
||||
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
|
||||
|
||||
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")
|
||||
for (new i=0;i<pnum;i++) {
|
||||
|
||||
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)
|
||||
show_hudmessage(players[i], message)
|
||||
}
|
||||
}
|
||||
if ( HeadShotKillSound ) {
|
||||
|
||||
if (HeadShotKillSound)
|
||||
{
|
||||
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()
|
||||
if ( g_doubleKill == nowtime && g_doubleKillId == killer ) {
|
||||
if ( DoubleKill ) {
|
||||
|
||||
if (g_doubleKill == nowtime && g_doubleKillId == killer)
|
||||
{
|
||||
if (DoubleKill)
|
||||
{
|
||||
new name[32]
|
||||
|
||||
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)
|
||||
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_doubleKillId = killer
|
||||
}
|
||||
}
|
||||
|
||||
public hideStatus(id) {
|
||||
if ( PlayerName ) {
|
||||
public hideStatus(id)
|
||||
{
|
||||
if (PlayerName)
|
||||
{
|
||||
set_hudmessage(0, 0, 0, 0.0, 0.0, 0, 0.0, 0.01, 0.0, 0.0, 4)
|
||||
show_hudmessage(id, "")
|
||||
}
|
||||
@ -385,25 +484,31 @@ public hideStatus(id) {
|
||||
public setTeam(id)
|
||||
g_friend[id] = read_data(2)
|
||||
|
||||
public showStatus(id) {
|
||||
if ( PlayerName ) {
|
||||
public showStatus(id)
|
||||
{
|
||||
if (PlayerName)
|
||||
{
|
||||
new name[32], pid = read_data(2)
|
||||
|
||||
get_user_name(pid, name, 31)
|
||||
new color1 = 0, color2 = 0
|
||||
|
||||
if (get_user_team(pid) == 1)
|
||||
color1 = 255
|
||||
else
|
||||
color2 = 255
|
||||
if (g_friend[id]==1) { // friend
|
||||
|
||||
if (g_friend[id] == 1) // friend
|
||||
{
|
||||
new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo)
|
||||
new wpnname[32]
|
||||
|
||||
if (wpnid)
|
||||
xmod_get_wpnname(wpnid, wpnname, 31)
|
||||
|
||||
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 {
|
||||
show_hudmessage(id, "%s -- %d HP / %d AP / %s", name, get_user_health(pid), get_user_armor(pid), wpnname)
|
||||
} else {
|
||||
set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4)
|
||||
show_hudmessage(id, name)
|
||||
}
|
||||
@ -411,20 +516,31 @@ public showStatus(id) {
|
||||
}
|
||||
|
||||
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_C4Timer = 0
|
||||
++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)
|
||||
show_hudmessage(0, "%L", LANG_PLAYER, "PREPARE_FIGHT", g_roundCount)
|
||||
}
|
||||
if ( RoundCounterSound ) play_sound("misc/prepare")
|
||||
if ( KillingStreak ) {
|
||||
|
||||
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) {
|
||||
|
||||
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)
|
||||
@ -432,33 +548,47 @@ public eNewRound()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public eRestart() {
|
||||
public eRestart()
|
||||
{
|
||||
eEndRound()
|
||||
g_roundCount = 0
|
||||
g_firstBlood = 1
|
||||
}
|
||||
|
||||
public eEndRound() {
|
||||
public eEndRound()
|
||||
{
|
||||
g_C4Timer = -2
|
||||
g_LastOmg = 0.0
|
||||
remove_task(8038)
|
||||
g_LastAnnounce = 0
|
||||
}
|
||||
|
||||
public checkKills(param[]) {
|
||||
public checkKills(param[])
|
||||
{
|
||||
new id = param[0]
|
||||
new a = param[1]
|
||||
if (a == g_multiKills[id][0]) {
|
||||
|
||||
if (a == g_multiKills[id][0])
|
||||
{
|
||||
a -= 3
|
||||
if ( a > -1 ) {
|
||||
if ( MultiKill ) {
|
||||
|
||||
if (a > -1)
|
||||
{
|
||||
if (MultiKill)
|
||||
{
|
||||
new name[32]
|
||||
|
||||
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)
|
||||
if ( a > 6 ) a = 6
|
||||
|
||||
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)
|
||||
{
|
||||
new sound[24]
|
||||
@ -471,85 +601,115 @@ public checkKills(param[]) {
|
||||
}
|
||||
|
||||
public chickenKill()
|
||||
if ( ItalyBonusKill ) announceEvent( 0 , "KILLED_CHICKEN" )
|
||||
if (ItalyBonusKill)
|
||||
announceEvent(0, "KILLED_CHICKEN")
|
||||
|
||||
public radioKill() {
|
||||
if ( ItalyBonusKill ) announceEvent( 0 , "BLEW_RADIO" )
|
||||
public radioKill()
|
||||
{
|
||||
if (ItalyBonusKill)
|
||||
announceEvent(0, "BLEW_RADIO")
|
||||
}
|
||||
|
||||
announceEvent( id, message[] ) {
|
||||
announceEvent(id, message[])
|
||||
{
|
||||
new name[32]
|
||||
|
||||
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)
|
||||
show_hudmessage(0, "%L", LANG_PLAYER, message, name)
|
||||
}
|
||||
|
||||
public eBombPickUp(id)
|
||||
if (BombPickUp) announceEvent(id , "PICKED_BOMB")
|
||||
if (BombPickUp)
|
||||
announceEvent(id, "PICKED_BOMB")
|
||||
|
||||
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
|
||||
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
|
||||
announceEvent(g_Planter, "REACHED_TARGET")
|
||||
}
|
||||
}
|
||||
|
||||
public bombTimer() {
|
||||
if (--g_C4Timer > 0) {
|
||||
if (BombCountVoice) {
|
||||
if (g_C4Timer == 30 || g_C4Timer == 20) {
|
||||
public bombTimer()
|
||||
{
|
||||
if (--g_C4Timer > 0)
|
||||
{
|
||||
if (BombCountVoice)
|
||||
{
|
||||
if (g_C4Timer == 30 || g_C4Timer == 20)
|
||||
{
|
||||
new temp[64]
|
||||
|
||||
num_to_word(g_C4Timer, temp, 63)
|
||||
format(temp, 63, "^"vox/%s seconds until explosion^"", temp)
|
||||
play_sound(temp)
|
||||
}
|
||||
else if (g_C4Timer < 11) {
|
||||
else if (g_C4Timer < 11)
|
||||
{
|
||||
new temp[64]
|
||||
|
||||
num_to_word(g_C4Timer, temp, 63)
|
||||
format(temp, 63, "^"vox/%s^"", 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
|
||||
if (BombPlanted) announceEvent(planter, "SET_UP_BOMB" )
|
||||
|
||||
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)
|
||||
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
|
||||
}
|
||||
|
||||
public bomb_defused(defuser)
|
||||
if (BombDefused) announceEvent(defuser, "DEFUSED_BOMB" )
|
||||
if (BombDefused)
|
||||
announceEvent(defuser, "DEFUSED_BOMB")
|
||||
|
||||
public bomb_explode(planter, defuser)
|
||||
if (BombFailed && defuser) announceEvent(defuser , "FAILED_DEFU" )
|
||||
if (BombFailed && defuser)
|
||||
announceEvent(defuser, "FAILED_DEFU")
|
||||
|
||||
public play_sound(sound[])
|
||||
{
|
||||
new players[32], pnum
|
||||
get_players(players, pnum, "c")
|
||||
new i
|
||||
|
||||
for (i = 0; i < pnum; i++)
|
||||
{
|
||||
if (is_user_connecting(players[i]))
|
||||
continue
|
||||
|
||||
client_cmd(players[i], "spk %s", sound)
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,9 @@ new g_Modified
|
||||
new g_blockPos[112]
|
||||
new g_saveFile[64]
|
||||
new g_Restricted[] = "* This item is restricted *"
|
||||
new g_menusNames[7][] = {
|
||||
|
||||
new g_menusNames[7][] =
|
||||
{
|
||||
"pistol",
|
||||
"shotgun",
|
||||
"sub",
|
||||
@ -54,7 +56,9 @@ new g_menusNames[7][] = {
|
||||
"equip",
|
||||
"ammo"
|
||||
}
|
||||
new g_MenuTitle[7][] = {
|
||||
|
||||
new g_MenuTitle[7][] =
|
||||
{
|
||||
"Handguns",
|
||||
"Shotguns",
|
||||
"Sub-Machine Guns",
|
||||
@ -63,7 +67,9 @@ new g_MenuTitle[7][] = {
|
||||
"Equipment",
|
||||
"Ammunition"
|
||||
}
|
||||
new g_menusSets[7][2] = {
|
||||
|
||||
new g_menusSets[7][2] =
|
||||
{
|
||||
{0, 6}, {6, 8}, {8, 13}, {13, 23}, {23, 24}, {24, 32}, {32, 34}
|
||||
}
|
||||
|
||||
@ -74,7 +80,9 @@ new g_AliasBlock[MAXMENUPOS]
|
||||
// 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
|
||||
// Position with -1 doesn't exist
|
||||
new g_Keys[MAXMENUPOS][3] = {
|
||||
|
||||
new g_Keys[MAXMENUPOS][3] =
|
||||
{
|
||||
{1, 1, 1}, // H&K USP .45 Tactical
|
||||
{1, 0, 0}, // Glock18 Select Fire
|
||||
{1, 3, 3}, // Desert Eagle .50AE
|
||||
@ -111,7 +119,8 @@ new g_Keys[MAXMENUPOS][3] = {
|
||||
{0, 6, 6} // Secondary weapon ammo
|
||||
}
|
||||
|
||||
new g_WeaponNames[MAXMENUPOS][] = {
|
||||
new g_WeaponNames[MAXMENUPOS][] =
|
||||
{
|
||||
"H&K USP .45 Tactical",
|
||||
"Glock18 Select Fire",
|
||||
"Desert Eagle .50AE",
|
||||
@ -148,7 +157,8 @@ new g_WeaponNames[MAXMENUPOS][] = {
|
||||
"Secondary weapon ammo"
|
||||
}
|
||||
|
||||
new g_MenuItem[MAXMENUPOS][] = {
|
||||
new g_MenuItem[MAXMENUPOS][] =
|
||||
{
|
||||
"\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",
|
||||
@ -192,7 +202,8 @@ new g_MenuItem[MAXMENUPOS][] = {
|
||||
"%d. %s\y\R%L^n\w"
|
||||
}
|
||||
|
||||
new g_Aliases[MAXMENUPOS][] = {
|
||||
new g_Aliases[MAXMENUPOS][] =
|
||||
{
|
||||
"usp", //Pistols
|
||||
"glock",
|
||||
"deagle",
|
||||
@ -235,7 +246,8 @@ new g_Aliases[MAXMENUPOS][] = {
|
||||
"secammo"
|
||||
}
|
||||
|
||||
new g_Aliases2[MAXMENUPOS][] = {
|
||||
new g_Aliases2[MAXMENUPOS][] =
|
||||
{
|
||||
"km45", //Pistols
|
||||
"9x19mm",
|
||||
"nighthawk",
|
||||
@ -281,17 +293,24 @@ new g_Aliases2[MAXMENUPOS][] = {
|
||||
new g_Autobuy[33][AUTOBUYLENGTH + 1]
|
||||
//new g_Rebuy[33][AUTOBUYLENGTH + 1]
|
||||
|
||||
setWeapon( a , action ) {
|
||||
setWeapon(a, action)
|
||||
{
|
||||
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]
|
||||
|
||||
if (action == 2)
|
||||
g_blockPos[b] = 1 - g_blockPos[b]
|
||||
else
|
||||
g_blockPos[b] = action
|
||||
}
|
||||
if (g_Keys[a][2] != -1) {
|
||||
|
||||
if (g_Keys[a][2] != -1)
|
||||
{
|
||||
b = m + g_Keys[a][2] + 56
|
||||
|
||||
if (action == 2)
|
||||
g_blockPos[b] = 1 - g_blockPos[b]
|
||||
else
|
||||
@ -299,126 +318,176 @@ setWeapon( a , action ) {
|
||||
}
|
||||
|
||||
for (new i = 0; i < g_AliasBlockNum; ++i)
|
||||
if ( g_AliasBlock[ i ] == a ){
|
||||
if ( !action || action == 2 ) {
|
||||
if (g_AliasBlock[i] == a)
|
||||
{
|
||||
if (!action || action == 2)
|
||||
{
|
||||
--g_AliasBlockNum
|
||||
|
||||
for (new j = i; j < g_AliasBlockNum; ++j)
|
||||
g_AliasBlock[j] = g_AliasBlock[j + 1]
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
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]))
|
||||
return i
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
findAliasId( name[] ) {
|
||||
findAliasId(name[])
|
||||
{
|
||||
for (new i = 0; i < MAXMENUPOS ; ++i)
|
||||
if (equali(name, g_Aliases[i]))
|
||||
return i
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
switchCommand( id, action ) {
|
||||
switchCommand(id, action)
|
||||
{
|
||||
new c = read_argc()
|
||||
if ( c < 3 ) {
|
||||
|
||||
if (c < 3)
|
||||
{
|
||||
setc(g_blockPos, 112, action)
|
||||
console_print(id, "%L", id, action ? "EQ_WE_RES" : "EQ_WE_UNRES")
|
||||
g_Modified = true
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
new arg[32], a
|
||||
new bool:found = false
|
||||
for (new b = 2; b < c; ++b) {
|
||||
|
||||
for (new b = 2; b < c; ++b)
|
||||
{
|
||||
read_argv(b, arg, 31)
|
||||
if ( (a = findMenuId( arg )) != -1 ) {
|
||||
|
||||
if ((a = findMenuId(arg)) != -1)
|
||||
{
|
||||
c = g_menusSets[a][1]
|
||||
|
||||
for (new i = g_menusSets[a][0]; i < c; ++i)
|
||||
setWeapon(i, action)
|
||||
|
||||
console_print(id, "%s %L %L", g_MenuTitle[a], id, (a < 5) ? "HAVE_BEEN" : "HAS_BEEN", id, action ? "RESTRICTED" : "UNRESTRICTED")
|
||||
g_Modified = found = true
|
||||
}
|
||||
else if ( (a = findAliasId( arg )) != -1 ) {
|
||||
else if ((a = findAliasId(arg)) != -1)
|
||||
{
|
||||
g_Modified = found = true
|
||||
setWeapon(a, action)
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
positionBlocked( a ) {
|
||||
positionBlocked(a)
|
||||
{
|
||||
new m = g_Keys[a][0] * 8
|
||||
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]
|
||||
|
||||
return d
|
||||
}
|
||||
|
||||
public cmdRest(id,level,cid) {
|
||||
public cmdRest(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 1))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new cmd[8]
|
||||
|
||||
read_argv(1, cmd, 7)
|
||||
|
||||
if (equali("on", cmd))
|
||||
switchCommand(id, 1)
|
||||
else if (equali("off", cmd))
|
||||
switchCommand(id, 0)
|
||||
else if ( equali( "list" , cmd ) ) {
|
||||
else if (equali("list", cmd))
|
||||
{
|
||||
new arg1[8]
|
||||
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
|
||||
if (end > MAXMENUPOS) end = MAXMENUPOS
|
||||
|
||||
if (end > MAXMENUPOS)
|
||||
end = MAXMENUPOS
|
||||
|
||||
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, " %-32.31s %-10.9s %-9.8s", lName, lValue, lStatus)
|
||||
if ( start != -1 ) {
|
||||
for (new a = start; a < end; ++a) {
|
||||
|
||||
if (start != -1)
|
||||
{
|
||||
for (new a = start; a < end; ++a)
|
||||
{
|
||||
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, "%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)
|
||||
|
||||
if (end < MAXMENUPOS)
|
||||
console_print(id, "----- %L -----", id, "REST_USE_MORE", end + 1)
|
||||
else
|
||||
console_print(id, "----- %L -----", id, "REST_USE_BEGIN")
|
||||
}
|
||||
else if ( equali( "save" , cmd ) ) {
|
||||
if ( saveSettings( g_saveFile ) ){
|
||||
else if (equali("save", cmd))
|
||||
{
|
||||
if (saveSettings(g_saveFile))
|
||||
{
|
||||
console_print(id, "%L", id, "REST_CONF_SAVED", g_saveFile)
|
||||
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
|
||||
new arg1[64]
|
||||
if ( read_argv(2, arg1 , 63 ) ) {
|
||||
|
||||
if (read_argv(2, arg1, 63))
|
||||
{
|
||||
new configsdir[32]
|
||||
get_configsdir(configsdir, 31)
|
||||
|
||||
format(arg1, 63, "%s/%s", configsdir, arg1)
|
||||
}
|
||||
if ( loadSettings( arg1 ) ) {
|
||||
|
||||
if (loadSettings(arg1))
|
||||
{
|
||||
console_print(id, "%L", id, "REST_CONF_LOADED", arg1)
|
||||
g_Modified = true
|
||||
}
|
||||
else console_print( id, "%L", id, "REST_COULDNT_LOAD", arg1 )
|
||||
}
|
||||
else {
|
||||
else
|
||||
console_print(id, "%L", id, "REST_COULDNT_LOAD", arg1)
|
||||
} else {
|
||||
console_print(id, "%L", id, "COM_REST_USAGE")
|
||||
console_print(id, "%L", id, "COM_REST_COMMANDS")
|
||||
console_print(id, "%L", id, "COM_REST_ON")
|
||||
@ -431,54 +500,78 @@ public cmdRest(id,level,cid) {
|
||||
console_print(id, "%L", id, "COM_REST_VALUES")
|
||||
console_print(id, "%L", id, "COM_REST_TYPE")
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
displayMenu(id,pos) {
|
||||
if (pos < 0) return
|
||||
displayMenu(id, pos)
|
||||
{
|
||||
if (pos < 0)
|
||||
return
|
||||
|
||||
new menubody[512], start = pos * 7
|
||||
if (start >= MAXMENUPOS) start = pos = g_Position[id] = 0
|
||||
|
||||
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
|
||||
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)
|
||||
|
||||
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) {
|
||||
|
||||
if (end != MAXMENUPOS)
|
||||
{
|
||||
format(menubody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||
keys |= MENU_KEY_9
|
||||
}
|
||||
else format(menubody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||
else
|
||||
format(menubody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||
|
||||
show_menu(id, keys, menubody, -1, "Restrict Weapons")
|
||||
}
|
||||
|
||||
public actionMenu(id,key) {
|
||||
switch (key) {
|
||||
case 7: {
|
||||
if (saveSettings(g_saveFile)) {
|
||||
public actionMenu(id, key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case 7:
|
||||
{
|
||||
if (saveSettings(g_saveFile))
|
||||
{
|
||||
g_Modified = false
|
||||
client_print(id, print_chat, "* %L", id, "CONF_SAV_SUC")
|
||||
}
|
||||
else client_print(id,print_chat,"* %L",id,"CONF_SAV_FAIL")
|
||||
else
|
||||
client_print(id, print_chat, "* %L", id, "CONF_SAV_FAIL")
|
||||
|
||||
displayMenu(id, g_Position[id])
|
||||
}
|
||||
case 8: displayMenu(id, ++g_Position[id])
|
||||
case 9: displayMenu(id, --g_Position[id])
|
||||
default: {
|
||||
default:
|
||||
{
|
||||
setWeapon(g_Position[id] * 7 + key, 2)
|
||||
g_Modified = true
|
||||
displayMenu(id, g_Position[id])
|
||||
}
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public client_command( id ) {
|
||||
if ( g_AliasBlockNum ) {
|
||||
public client_command(id)
|
||||
{
|
||||
if (g_AliasBlockNum)
|
||||
{
|
||||
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 */
|
||||
@ -486,38 +579,48 @@ public client_command( id ) {
|
||||
|
||||
new a = 0
|
||||
|
||||
do {
|
||||
if ( equali( g_Aliases[g_AliasBlock[ a ]] , arg ) ||
|
||||
equali( g_Aliases2[g_AliasBlock[ a ]] , arg ) )
|
||||
do
|
||||
{
|
||||
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
|
||||
}
|
||||
} while (++a < g_AliasBlockNum)
|
||||
}
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public blockcommand(id) {
|
||||
public blockcommand(id)
|
||||
{
|
||||
client_print(id, print_center, g_Restricted)
|
||||
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)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
checkRest(id,menu,key){
|
||||
checkRest(id, menu, key)
|
||||
{
|
||||
new team = get_user_team(id)
|
||||
|
||||
if (team != 1 && team != 2)
|
||||
return PLUGIN_HANDLED
|
||||
if ( g_blockPos[ (menu * 8 + key) + (get_user_team(id) - 1) * 56 ] ){
|
||||
|
||||
if (g_blockPos[(menu * 8 + key) + (get_user_team(id) - 1) * 56])
|
||||
{
|
||||
engclient_cmd(id, "menuselect", "10")
|
||||
client_print(id, print_center, g_Restricted)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
@ -531,36 +634,53 @@ public menuRifle(id,key) return checkRest(id,4,key)
|
||||
public menuMachine(id, key) return checkRest(id, 5, key)
|
||||
public menuItem(id, key) return checkRest(id, 6, key)
|
||||
|
||||
saveSettings(filename[]) {
|
||||
saveSettings(filename[])
|
||||
{
|
||||
if (file_exists(filename))
|
||||
delete_file(filename)
|
||||
|
||||
if (!write_file(filename, "; Generated by Restrict Weapons Plugin. Do not modify!^n; value name"))
|
||||
return 0
|
||||
|
||||
new text[64]
|
||||
for(new a = 0; a < MAXMENUPOS; ++a) {
|
||||
if ( positionBlocked( a ) ) {
|
||||
|
||||
for (new a = 0; a < MAXMENUPOS; ++a)
|
||||
{
|
||||
if (positionBlocked(a))
|
||||
{
|
||||
format(text, 63, "%-16.15s ; %s", g_Aliases[a], g_WeaponNames[a])
|
||||
write_file(filename, text)
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
loadSettings(filename[]) {
|
||||
if (!file_exists(filename)) return 0
|
||||
loadSettings(filename[])
|
||||
{
|
||||
if (!file_exists(filename))
|
||||
return 0
|
||||
|
||||
new text[16]
|
||||
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))
|
||||
{
|
||||
if (text[0] == ';' || !a)
|
||||
continue // line is a comment
|
||||
|
||||
parse(text, text, 15)
|
||||
|
||||
if ((a = findAliasId(text)) != -1)
|
||||
setWeapon(a, 1)
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
// JGHG
|
||||
public fn_setautobuy(id) {
|
||||
public fn_setautobuy(id)
|
||||
{
|
||||
// Don't do anything if no items are blocked.
|
||||
if (!g_AliasBlockNum)
|
||||
return PLUGIN_CONTINUE
|
||||
@ -569,14 +689,15 @@ public fn_setautobuy(id) {
|
||||
g_Autobuy[id][0] = '^0'
|
||||
|
||||
new argCount = read_argc()
|
||||
|
||||
new arg[128]
|
||||
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
|
||||
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg)
|
||||
|
||||
// If we detect more parameters, add a space
|
||||
if (i + 1 < argCount)
|
||||
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ")
|
||||
@ -584,21 +705,25 @@ public fn_setautobuy(id) {
|
||||
|
||||
// Strip any blocked items
|
||||
new strippedItems[AUTOBUYLENGTH + 1]
|
||||
|
||||
if (!StripBlockedItems(g_Autobuy[id], strippedItems))
|
||||
return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything...
|
||||
|
||||
//server_print("Stripped items: ^"%s^"", strippedItems)
|
||||
engclient_cmd(id, "cl_setautobuy", strippedItems)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
// 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
|
||||
format(outString, AUTOBUYLENGTH, inString)
|
||||
|
||||
// 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)
|
||||
replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "")
|
||||
while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1)
|
||||
@ -606,28 +731,31 @@ 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...
|
||||
|
||||
if (strlen(outString) < strlen(inString))
|
||||
return true // outstring is shorter: we stripped items, return true
|
||||
|
||||
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.
|
||||
if (!g_AliasBlockNum)
|
||||
return PLUGIN_CONTINUE
|
||||
|
||||
// Strip any blocked items
|
||||
new strippedItems[AUTOBUYLENGTH + 1]
|
||||
|
||||
if (!StripBlockedItems(g_Autobuy[id], strippedItems))
|
||||
return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything...
|
||||
|
||||
engclient_cmd(id, "cl_setautobuy", strippedItems)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public plugin_init() {
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Restrict Weapons", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("restmenu.txt")
|
||||
register_dictionary("common.txt")
|
||||
|
@ -38,45 +38,59 @@
|
||||
new g_pingSum[33]
|
||||
new g_pingCount[33]
|
||||
|
||||
public plugin_init() {
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("CS Stats Logging", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
}
|
||||
|
||||
public client_disconnect(id) {
|
||||
if ( is_user_bot(id) ) {
|
||||
public client_disconnect(id)
|
||||
{
|
||||
if (is_user_bot(id))
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
remove_task(id)
|
||||
|
||||
new szTeam[16], szName[32], szAuthid[32], iStats[8], iHits[8], szWeapon[24]
|
||||
new iUserid = get_user_userid(id)
|
||||
|
||||
get_user_team(id, szTeam, 15)
|
||||
get_user_name(id, szName, 31)
|
||||
get_user_authid(id, szAuthid, 31)
|
||||
for (new i = 1 ; i < 31 ; ++i ) {
|
||||
if ( get_user_wstats( id , i ,iStats , iHits ) ) {
|
||||
|
||||
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^")",
|
||||
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^")",
|
||||
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^")",
|
||||
szName,iUserid,szAuthid,szTeam, (iTime / 60), (iTime % 60) )
|
||||
log_message("^"%s<%d><%s><%s>^" triggered ^"latency^" (ping ^"%d^")",
|
||||
szName,iUserid,szAuthid,szTeam, (g_pingSum[id] / ( g_pingCount[id] ? g_pingCount[id] : 1 ) ) )
|
||||
|
||||
log_message("^"%s<%d><%s><%s>^" triggered ^"time^" (time ^"%d:%02d^")", szName, iUserid, szAuthid, szTeam, (iTime / 60), (iTime % 60))
|
||||
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) {
|
||||
if ( !is_user_bot(id) ) {
|
||||
public client_putinserver(id)
|
||||
{
|
||||
if (!is_user_bot(id))
|
||||
{
|
||||
g_pingSum[id] = g_pingCount[id] = 0
|
||||
set_task(19.5, "getPing", id, "", 0, "b")
|
||||
}
|
||||
}
|
||||
|
||||
public getPing(id) {
|
||||
public getPing(id)
|
||||
{
|
||||
new iPing, iLoss
|
||||
|
||||
get_user_ping(id, iPing, iLoss)
|
||||
g_pingSum[id] += iPing
|
||||
++g_pingCount[id]
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user