Here is a snippet on how you could do with tasks, player tasks and other tasks.
Should be usable in any plugin except if you pass an entity index as task index, if you want to pass an entity and use this, use rather task params to store the entity index.
Same if you want to pass a representating number of something, use params.
PHP Code:
#include < amxmodx >
#include < fun >
#pragma semicolon 1
#define PLUGIN ""
#define VERSION "0.0.1"
#define AUTHOR ""
const MAGIC_NUMBER = 33;
enum _:playerTasks ( += MAGIC_NUMBER )
{
TASK_PLR_PRINT,
TASK_PLR_RESPAWN,
TASK_PLR_REMOVE
}
enum _:genericTasks
{
TASK_PRINTALL = TASK_PLR_REMOVE+1, // use last player tasks + 1
TASK_GIVENADES
}
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0");
set_task(2.0, "PrintAll", TASK_PRINTALL, .flags="b");
}
public Event_HLTV_New_Round()
{
set_task(10.0, "GiveNade", TASK_GIVENADES, .flags="b");
}
public bomb_planted( /* planter */ )
{
remove_task( TASK_GIVENADES );
}
public client_putinserver(id)
{
set_task(15.0, "Advertise_Player", id + TASK_PLR_PRINT);
}
public client_disconnect(id)
{
remove_task(id + TASK_PLR_PRINT);
}
public Advertise_Player( id )
{
id %= MAGIC_NUMBER;
if( is_user_connected(id) )
{
client_print(id, print_chat, "4Welcome on this server, please invit some friends");
}
}
public PrintAll( )
{
client_print(0, print_chat, "^4Random Text");
}
public GiveNade()
{
new players[32], num;
get_players(players, num, "a");
for(--num; num>=0; num--)
{
give_item(players[num], "weapon_hegrenade");
}
}
__________________