Код
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#pragma semicolon 1
#define PLUGIN_NAME "Respawn"
#define PLUGIN_VERSION "1.2"
#define PLUGIN_AUTHOR "Contra"
#define REMOVE_TIME 15.0
public plugin_precache() register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
public plugin_init()
{
RegisterHam(Ham_Spawn, "player", "CPlayer__Spawn_Post", 1);
RegisterHam(Ham_Killed, "player", "CPlayer__Killed_Post", 1);
register_clcmd("joinclass", "CClientCommand__joinclass");
register_menucmd(register_menuid("#Terrorist_Select"), 1023, "CMenu__SelectClass");
register_menucmd(register_menuid("#CT_Select"), 1023, "CMenu__SelectClass");
register_forward(FM_SetModel, "SetModelPre", 0);
}
public client_disconnect(id) remove_task(id);
public CPlayer__Spawn_Post(id) remove_task(id);
public CPlayer__Killed_Post(id) set_task(0.1, "CTask__Respawn", id);
public CClientCommand__joinclass(id)
{
new iTeam = _:cs_get_user_team(id);
if (!iTeam || iTeam == 3) return;
if (is_user_alive(id)) return;
new szArg[3];
read_argv(1, szArg, 2);
if (str_to_num(szArg) > 4) return;
set_task(0.2, "CTask__Respawn", id);
}
public CMenu__SelectClass(id, key)
{
if (is_user_alive(id)) return;
set_task(0.2, "CTask__Respawn", id);
}
public CTask__Respawn(id) ExecuteHamB(Ham_CS_RoundRespawn, id);
public SetModelPre(pE, const szM[]) {
if (strlen(szM) < 8) return;
new szClassName[10];
entity_get_string(pE, EV_SZ_classname, szClassName, 9);
if (!equal(szClassName, "weaponbox")) return;
entity_set_float(pE, EV_FL_nextthink, get_gametime() + REMOVE_TIME);
}
+ удаление оружия через 15 секунд(которое на полу лежат)