Quote:
Originally Posted by Balimbanana
It might be too early to color them. Should maybe debug each step, IsPlayerAlive might be false at the immediate point of player_spawn. You could try setting a timer or looping timer this is what I usually do for post spawn:
Code:
public Action Event_PlayerSpawn(Event event, char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
CreateTimer(0.5,SpawnPost,client,TIMER_FLAG_NO_MAPCHANGE);
}
public Action SpawnPost(Handle timer, int client)
{
if (IsValidEntity(client) && IsPlayerAlive(client))
{
//Code to run
}
else if (IsClientConnected(client))
{
CreateTimer(0.5,SpawnPost,client,TIMER_FLAG_NO_MAPCHANGE);
}
}
|
I don't think so, if you're hooking an event with
EventHookMode_Post (default) then player is actually alive at
player_spawn event.
Also, since you're using
EventHookMode_Post, you should replace your event callback from
Code:
public Action Event_PlayerSpawn(Event event, char[] name, bool dontBroadcast)
to
Code:
public void Event_PlayerSpawn(Event event, char[] name, bool dontBroadcast)
void is used with
EventHookMode_Post and
EventHookMode_PostNoCopy while
Action is used with
EventHookMode_Pre
Try to use
SetEntityRenderMode with
SetEntityRenderColor, for example:
Code:
SetEntityRenderMode(client, RENDER_TRANSCOLOR);
SetEntityRenderColor(client, 255, 0, 0, 255);
And at the end, if you want to color ALL players then you don't need to check their teams + you should not include
cstrike library if your code doesn't have anything CS-related.
__________________