DjOptimus is correct. You must check if the player is connected before you use functions on that player everywhere you use a for loop with g_max_clients. You should be seeing errors in your logs. Also remember to enable debug when testing your plugins.
Tip: Any time you see code that repeats more than a few times, you need to optimize:
PHP Code:
public menu_handler(id, countdowne, item)
{
if(item == MENU_EXIT)
{
menu_destroy(countdowne)
return PLUGIN_HANDLED
}
new Data[7], Name[64]
new Access, Callback
menu_item_getinfo(countdowne, item, Access, Data,5, Name, 63, Callback)
new Key = str_to_num(Data)
switch(Key)
{
case 1: timer = 30
case 2: timer = 60
case 3: timer = 100
}
menu_destroy(countdowne)
set_hudmessage(255, 255, 255, -1.0, 0.86, 0, 6.0, 10.0)
show_hudmessage(0, "Heute spielen wir verstecken!")
get_user_name(id, name, 32)
set_task(1.0, "countdownv", 6875)
return PLUGIN_HANDLED
}
public countdownv(id)
{
if( timer <= 0 )
{
set_hudmessage( 0, 255, 0, -1.0, 0.50, 2, 5.0, 8.0, 0.0, 0.0, 10)
show_hudmessage(0, "Wir hoffen, ihr habt euch gut versteckt!")
stop_t_from_moving(id)
}
else
{
set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
show_hudmessage(0, "%s startete einen Countdown.^nZeit bis die CT's kommen: %i", name, timer)
timer--
set_task(1.0, "countdownv", 6875)
}
}
This will save you about 300 lines of code.
__________________