01.03.2011, 20:37
Tenta isso
pawn Код:
forward VoltarAFK(playerid);
new TempoAFK;
gettime(TempoAFK);
if(strcmp(cmd, "/afk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /afk [Minutos] [Motivo]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /afk [Minutos] [Motivo]");
return 1;
}
format(string, sizeof(string), "ADMIN CMD: %s Ficou AFK Por %d Minutos Motivo: %s", giveplayer, TempoAFK, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
SetTimer("VoltarAFK",TempoAFK,false);
return 1;
}
}
}
return 1;
}
public VoltarAFK(playerid)
{
TempoAFK = Kick(playerid);
SendClientMessage(playerid, COLOR_WHITE, "[AVISO] Fostes kickado por exceder o tempo limite de minutos AFK!");
return 1;
}