PHP Code:
/*
* AMX Mod X script.
* Auto restart Knives by PEREF
* Skrypt powstal na bazie skryptu Auto-Restart by VikuS
* Dziala tylko pod AMXX
*
* amx_auto_rr_knives -- 1-ON 0-OFF
*
* CVAR: auto_rr_time <time> default 45
*
*/
#include <amxmodx>
#include <amxmisc>
new bool:AutoRR = true
new bool:knifeArena = false
new counter
// ints and floats for set_hudmessage parameters
new const Float:floats[][] =
{ // x,y,fxtime,holdtime,fadeintime,fadeouttime
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1},
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1},
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1},
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1},
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1},
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1},
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1},
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1},
{0.75, 0.70, 0.02, 1.0, 0.01, 0.1}
}
new const ints[][] =
{ // r,g,b,effect,channel
{000, 100, 255, 2, 1},
{000, 205, 000, 2, 1},
{255, 255, 000, 2, 1},
{000, 255, 255, 2, 1},
{255, 048, 048, 2, 1},
{255, 127, 000, 2, 1},
{238, 018, 137, 2, 1},
{139, 069, 019, 2, 1},
{155, 048, 255, 2, 1}
}
public plugin_init()
{
register_plugin("Auto-Restart-Knives","0.2","PEREF")
register_dictionary("auto_restart_knives.txt")
register_concmd("amx_auto_rr_knives","auto_rr",ADMIN_CFG," - 1 : ON | 0 : OFF")
register_cvar("auto_rr_time","50")
register_event("TextMsg","restart_time","a","2&#Game_C")
register_event("CurWeapon","switchweapon","be","1=1","2!26")
return PLUGIN_CONTINUE
}
public auto_rr(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_CONTINUE
new arg[2]
read_argv(1,arg,1)
if(equal(arg, "1"))
{
AutoRR = true
client_print(id,print_console,"[AMXX] %L", LANG_PLAYER, "ENABLED")
}
else if(equal(arg, "0"))
{
AutoRR = false
client_print(id,print_console,"[AMXX] %L", LANG_PLAYER, "DISABLED")
}
else if(!equal(arg, "1") || equal(!arg, "0"))
{
client_print(id,print_console,"amx_auto_rr_knives 1 = On | 0 = Off");
}
return PLUGIN_HANDLED
}
public switchweapon(id)
{
if (!knifeArena)
return PLUGIN_CONTINUE
engclient_cmd(id,"weapon_deagle")
return PLUGIN_CONTINUE
}
public restart_time()
{
if (AutoRR==true)
{
new counter = get_cvar_num("auto_rr_time")
knifeArena = true
pause("ac","M_Antirusher.amxx")
set_hudmessage(000, 100, 255, 0.75, 0.70, 2, 0.02, 1.0, 0.01, 0.1, 1)
show_hudmessage(0, "%L", LANG_PLAYER, "AUTO_RR_FOR_SEC",counter)
set_task(1.0, "seconds_func",_,_,_,"a", counter)
}
}
public seconds_func()
{
new a = counter % 9
if( counter > 3 )
{
set_hudmessage(ints[a][0],ints[a][1],ints[a][2],floats[a][0],floats[a][1],ints[a][3],floats[a][2],floats[a][3],floats[a][4],floats[a][5],ints[a][4])
show_hudmessage(0,"%L", LANG_PLAYER, "AUTO_RR_FOR_SEC",counter)
if( counter == 45 )
{
client_cmd(0,"spk cyr4x/PaPROCH.wav")
}
}
else
{
set_hudmessage(250, 100, 100, -1.0, 0.25, 1, 0.02, 1.0, 0.01, 0.1, 1)
new numstring[6]
switch( counter )
{
case 3: copy(numstring, 5, "THREE")
case 2: copy(numstring, 5, "TWO")
case 1:
{
copy(numstring, 5, "ONE")
set_task(1.0,"restart_map")
}
}
show_hudmessage(0,"%L", LANG_PLAYER, numstring,counter)
num_to_word(counter, numstring, 5)
client_cmd(0,"spk fvox/%s.wav", numstring)
}
counter--
}
public restart_map()
{
if (AutoRR==true)
{
set_cvar_float("sv_restart",1.0)
knifeArena = false
unpause("ac","M_Antirusher.amxx")
set_task(2.0,"hudmess_show",0)
set_hudmessage(250, 100, 100, -1.0, 0.25, 1, 0.02, 1.0, 0.01, 0.1, 1)
show_hudmessage(0, "%L", LANG_PLAYER, "AUTOMATIC")
client_cmd(0,"spk cyr4x/mifMotto.wav")
}
}
public hudmess_show()
{
set_hudmessage(000, 100, 255, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
show_hudmessage(0, "%L", LANG_PLAYER, "NICE_GAME")
}
public plugin_precache()
{
precache_sound( "misc/one.wav")
precache_sound( "misc/two.wav")
precache_sound( "misc/three.wav")
precache_sound( "cyr4x/PaPROCH.wav")
precache_sound( "cyr4x/mifMotto.wav")
return PLUGIN_CONTINUE
}