PHP Code:
public client_connect(id)
{
new playername[32]
get_user_name(id, playername, 31)
new pug = fopen(pug_ini_file, "r")
fseek(pug, -1, SEEK_END)
getchar = fgetc(pug)
if (getchar == '0')
{
client_print(id, print_chat, "%s Please type .rdy to be Ready! You will be kicked in %d seconds if you don't type it.", PREFIX, timeleft)
timeleft -= 30
set_task(30.0, "Continue")
}
else
{
client_print(id, print_chat, "%s You have entered to this match as it has already started, you will be used as a substitution.", PREFIX)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public Continue(id)
{
new playersteam[30]
get_user_authid(id, playersteam, 29)
for (new k; k<typedalrdycounter ; k++)
{
if (equali(playersteam, typedalrdy[k]))
{
return PLUGIN_HANDLED;
}
else
{
continue;
}
}
new playername[32]
get_user_name(id, playername, 31)
client_print(id, print_chat, "%s Please type .rdy to be Ready! You will be kicked in %d seconds if you don't type it.", PREFIX, timeleft)
switch(timeleft)
{
case 90:
{
timeleft -= 30
set_task(30.0, "Continue")
}
case 60:
{
timeleft -= 30
set_task(30.0, "Continue")
}
case 30:
{
timeleft -= 20
set_task(20.0, "Continue")
}
case 10:
{
timeleft = 0
set_task(10.0, "Continue")
}
case 0:
{
client_cmd(id, "disconnect")
client_print(0, print_chat, "%s %s have been kicked for not typing .rdy for 2 minutes.", PREFIX, playername)
}
}
return PLUGIN_HANDLED
}
public Prepare(id)
{
new playersteam[30]
get_user_authid(id, playersteam, 29)
for (new k; k<typedalrdycounter ; k++)
{
if (equali(playersteam, typedalrdy[k]))
{
client_print(id, print_chat, "%s You have already typed .rdy!", PREFIX)
return PLUGIN_HANDLED;
}
else if ((iszero[k] != 1))
{
client_print(id, print_chat, "%s You are now ready!", PREFIX)
copy(typedalrdy[k], 29, playersteam)
typedalrdycounter++
playersleft--
iszero[typedalrdycounter] = 1
}
}
if (iszero[typedalrdycounter] != 1)
{
copy(typedalrdy[typedalrdycounter], 29, playersteam)
typedalrdycounter++
playersleft--
}