Quote:
Originally Posted by siriusmd99
Because you check if he is not alive but you don't check if he is connected.
You bassicaly are respawning a non connected player.
It confuses because if player is not connected then is_user_alive(id) will return false as it was connected but dead.
So use this instead in both respawn cases:
|
thanks now no error
but another problem plugin work not correctly I would need each round first killed player respawn
now its 1 round ok 1 killed respawned from second round last killed respawned
siriusmd99 can help resolve this ?
Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
new bool:gRespawn = true;
public plugin_init()
{
register_plugin("Respawn After 20 Seconds", "1.1", "hleV");
register_logevent("JoinedTeam", 3, "1=joined team");
RegisterHam(Ham_Spawn, "player", "Spawn", 1);
RegisterHam(Ham_Killed, "player", "Killed", 1);
register_logevent("logevent_round_end", 2, "1=Round_End")
}
public JoinedTeam()
{
new Name[32];
read_logargv(0, Name, 31);
parse_loguser(Name, Name, 31);
new Cl = get_user_index(Name);
if (!task_exists(Cl))
set_task(0.5, "Respawn", Cl);
}
public Spawn(Client)
{
if (!is_user_alive(Client) && is_user_connected(Client))
remove_task(Client);
}
public Killed(Client)
{
if (!task_exists(Client))
set_task(0.5, "Respawn2", Client);
}
public Respawn(Client)
{
if (!is_user_alive(Client) && is_user_connected(Client))
cs_user_spawn(Client);
}
public Respawn2(Client)
{
if (!is_user_alive(Client) && is_user_connected(Client))
{
if(gRespawn)
{
cs_user_spawn(Client);
gRespawn = false;
}
}
}
public logevent_round_end( )
{
gRespawn = true;
}