- Регистрация
- 5 Авг 2018
- Сообщения
- 143
- Симпатии
- 0
- Предупреждения
- 260
Здравствуйте Уважаемые, подскажите добрые люди как встроить в плагин функцию приостановки плагина miscstats на время разминки в плагине warmup_random
Код:
#include <amxmodx>
#include <fakemeta_util>
#include <cstrike>
#include <fun>
#include <dhudmessage>
#include <hamsandwich>
new Timer, SecondsCvar
//new bool:first_time=true
new g_mode = 0
/*
1 - Knife
2 - Deagle
3 - Scout
4 - AWP
5 - Grenade
*/
#define TASK_REVIVE 2312
new const szWeaponNames[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
"weapon_ak47", "weapon_knife", "weapon_p90" }
public plugin_init()
{
register_plugin( "Warmup Random" , "4.0Stable", "VCL" )
register_event("DeathMsg", "on_death", "a")
register_event( "CurWeapon", "EventCurWeapon", "be", "2!29" )
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
for (new i = 1; i < sizeof szWeaponNames; i++)
if (szWeaponNames[i][0]) RegisterHam(Ham_Item_AddToPlayer, szWeaponNames[i], "fw_Weapon_AddToPlayer_Post", 1)
SecondsCvar = register_cvar("wr_rr_time","60.0")
Timer = get_pcvar_num(SecondsCvar)
g_mode = random_num(1,5)
if(random_num(0,1)==1) g_mode = random_num(1,5)
set_task(1.0, "start_rr_timer", 0, _, _, "a", Timer)
}
public on_death()
{
new victim
victim = read_data(2)
if(g_mode!=0) set_task(1.0, "fnRevivePlayer", victim+TASK_REVIVE)
}
public fw_Weapon_AddToPlayer_Post(weapon, id)
{
if(g_mode!=0 && !task_exists(id)) set_task(0.1,"give_items",id)
}
public fwHamPlayerSpawnPost(id)
{
if(g_mode!=0 && !task_exists(id)) set_task(0.1,"give_items",id)
}
public give_items(id)
{
if(g_mode!=0 && is_user_connected(id) && is_user_alive(id))
{
fm_strip_user_weapons(id)
switch(g_mode)
{
case 1:
{
fm_give_item(id, "weapon_knife")
set_user_health(id, 35)
}
case 2:
{
fm_give_item(id, "weapon_knife")
fm_give_item(id, "weapon_deagle")
cs_set_user_bpammo(id,CSW_DEAGLE,120)
}
case 3:
{
fm_give_item(id, "weapon_knife")
fm_give_item(id, "weapon_scout")
cs_set_user_bpammo(id,CSW_SCOUT, 90)
}
case 4:
{
fm_give_item(id, "weapon_knife")
fm_give_item(id, "weapon_awp")
cs_set_user_bpammo(id,CSW_AWP,90)
}
case 5:
{
fm_give_item(id, "weapon_hegrenade")
cs_set_user_bpammo(id,CSW_HEGRENADE, 90)
}
}
}
}
public fnRevivePlayer(id)
{
id-=TASK_REVIVE
if(!is_user_alive(id) && g_mode!=0 && is_user_connected(id))
{
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
}
public EventCurWeapon(id)
{
/*if(g_mode!=0 && is_user_connected(id) && is_user_alive(id))
{
switch(g_mode)
{
case 1: engclient_cmd(id, "weapon_knife")
case 2: engclient_cmd(id, "weapon_deagle")
case 3: engclient_cmd(id, "weapon_scout")
case 4: engclient_cmd(id, "weapon_awp")
case 5: engclient_cmd(id, "weapon_hegrenade")
}
}*/
}
public start_rr_timer()
{
if(get_pcvar_num(SecondsCvar)==Timer)
{
g_mode = random_num(1,5)
if(random_num(0,1)==1) g_mode = random_num(1,5)
for(new i=1;i<=32;i++)
{
give_items(i)
}
}
Timer--
new mode_name[32]
switch(g_mode)
{
case 1: format(mode_name,charsmax(mode_name),"Ножах")
case 2: format(mode_name,charsmax(mode_name),"Диглах")
case 3: format(mode_name,charsmax(mode_name),"Мухах")
case 4: format(mode_name,charsmax(mode_name),"AWP")
case 5: format(mode_name,charsmax(mode_name),"Гранатах")
default: format(mode_name,charsmax(mode_name),"ERROR")
}
if(g_mode==0)
{
remove_task()
}
else
{
set_dhudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.25, 0, 0.0, 1.1, 0.0, 0.0)
show_dhudmessage(0, "Разминка на %s!^nРестарт через %d сек", mode_name,Timer)
}
if(Timer < 1)
{
server_cmd("sv_restartround 1")
set_task(3.0, "rr_end")
g_mode = 0
}
}
public rr_end()
{
g_mode = 0
set_hudmessage( random_num(0, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.78, 2, 6.0, 3.0, 0.1, 1.5, false )
new message[100]
new servname[64]
get_cvar_string("hostname",servname,charsmax(servname))
format(message,charsmax(message),"Всем удачи!^nПриятной игры",servname)
show_hudmessage(0, message)
}