Quote:
Originally Posted by shortguy
Works Fine
Code:
public OnPluginStart() {
HookEvent("player_death", Event_PlayerDeath);
}
public Action Timer_RespawnClient(Handle timer, int client) {
CS_RespawnPlayer(client);
}
public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
int userID = GetEventInt(event, "userid");
int client = GetClientOfUserId(userID);
if (!IsPlayerAlive(client)) {
CreateTimer(0.000001, Timer_RespawnClient, client);
}
return Plugin_Continue;
}
Fails to spawn correctly:
Code:
public OnPluginStart() {
HookEvent("player_death", Event_PlayerDeath);
}
public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
int userID = GetEventInt(event, "userid");
int client = GetClientOfUserId(userID);
if (!IsPlayerAlive(client)) {
CS_RespawnPlayer(client);
}
return Plugin_Continue;
}
|
From coding side it looks good but i think the thing that make this bug is because you need to create timer for 1.0 that check who dead and respawn him... (it checks every 1.0 second who dead and respawn)
Create the timer outside the event(maybe on plugin start or map start).
I think i got more reason but no way to explain it sorry so when i back i will fix it..
__________________