Originally Posted by Mxnn
(Post 1240347)
PHP Code:
#include <fakemeta>
new bool: can_revive[33]
public event_death()
{
new id = read_data(2)
reset_player(id)
if(g_haskit[id])
{
g_haskit[id] = false
}
static Float:minsize[3]
pev(id, pev_mins, minsize)
if(minsize[2] == -18.0)
g_wasducking[id] = true
else
g_wasducking[id] = false
set_task(0.5, "task_check_dead_flag", id)
set_task(15, "task_b", id)
}
public task_check_dead_flag(id)
{
if(!is_user_connected(id))
return
if(pev(id, pev_deadflag) == DEAD_DEAD)
create_fake_corpse(id)
else
set_task(0.5, "task_check_dead_flag", id)
}
public task_b(id) {
can_revive[id] = false
}
public round_start()
for (new i=1; i<=get_maxplayers(); i++)
if (is_user_alive(i) && is_user_connected(i))
can_revive[i] = true
//Now you have to check if player want to revive someone..
//I suppose that to revive someone you have to write in say "/revive [name]"
public plugin_init() {
register_event("HLTV","Event_StartRound","a","1=0","2=0")
register_clcmd("say /revive", "sayrevive", ADMIN_ALL)
}
public sayrevive(id, level, cid) {
if (!cmd_access(id, level, cid, 3)
//He put more of 3 arguments
return PLUGIN_HANDLED
new data[32]
read_argv(2, data, 31)
if (!is_user_alive(id) || is_user_alive(data))
//Revived client are alive or reviver are dead
return PLUGIN_HANDLED
new rid = find_player("lb", data)
if (!rid)
//Part of name doesn't found
return PLUGIN_HANDLED
if (!can_revive[rid]) //If can revive is false
//15 seconds have passed
return PLUGIN_HANDLED
ExecuteHamB(Ham_CS_RoundRespawn, rid)
set_task(0.1,"revivePl",0,rid,2)
return PLUGIN_CONTINUE
}
public revivePl(id)
{
fm_DispatchSpawn(id)
if (get_user_team(id)==1)
{
fm_give_item(id,weapons[WEAPON_KNIFE])
fm_give_item(id,weapons[WEAPON_GLOCK18])
fm_give_item_x(id,ammo_9mm,2)
}
else
{
fm_give_item(id,weapons[WEAPON_KNIFE])
fm_give_item(id,weapons[WEAPON_USP])
fm_give_item_x(id,ammo_45acp,2)
}
}
Test it
|