Quote:
Originally Posted by thEsp
@learning
1. There is no reason to declare specific task indexes when you aren't using them.
2. Function "client_start_command2" will send "say .ready" command to server, not a specific user.
3. Use loops instead ^.
4. Don't pass variables to tasks when you don't need them, pass only when you do.
|
I get it now , but i have 1 problem :
1- how to delay the command "client_cmd(i , "say .ready")" in "Event_TextMsg_Restarting" function ?
PHP Code:
#include <amxmodx>
#define TASK_TIME 10.0
new g_MaxPlayers
public plugin_init()
{
register_plugin("Auto Ready Command" , "0.01" , "LearninG")
register_event("TextMsg", "Event_TextMsg_Restarting", "a", "2=#Game_will_restart_in")
g_MaxPlayers = get_maxplayers()
}
public client_putinserver(id)
{
set_task(TASK_TIME , "client_start_command")
}
public Event_TextMsg_Restarting(id)
{
for (new i = 1; i<= g_MaxPlayers; i++)
{
client_cmd(i , "say .ready")
}
}
public client_start_command(id)
{
client_cmd(id , "say .ready")
}