Quote:
Originally Posted by GXLZPGX
Yes. The first one is calling the function "First_Infected" without a given index, and without an index, I'm gonna take a shot in the dark and say it choses 0 as the index, and 0 isn't a valid player index. The second one though, provides an index.
|
I'd like to add that id can be 0 too, that depends on how you use it.
PHP Code:
new id;
set_task(1.0, "First_Infected", id);
This will call your function, but id passed in the params will be 0.
PHP Code:
public client_putinserver(id)
set_task(1.0, "First_Infected", id);
This will call the function with id being the id of the player that entered the server.
To check if a variable contains a player id, you can use this:
PHP Code:
// Global
#define IsPlayer(%1) (1 <= %1 <= g_iMaxPlayers)
new g_iMaxPlayers;
public plugin_init()
g_iMaxPlayers = get_maxplayers();
SomeFunc(id)
{
if(IsPlayer(id))
// It is a player id, you might wanna check if he's alive and stuff depending on what you are doing here.
}
__________________