Код:
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
new name [ MAX_PLAYER_NAME ] ;
GetPlayerName ( playerid , name , MAX_PLAYER_NAME ) ;
new string [ 128 ] ;
if(jAFK[playerid] == 0)
{
format ( string , 128 , "%s [AFK]" , name ) ;
SetPlayerName ( playerid , string ) ;
SendClientMessage(playerid,COLOR_WHITE,"Vous кtes AFK, pour vous enlever AFK, taper la commande /afk de nouveau.");
jAFK[playerid] = 1;
GetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]);
TogglePlayerControllable(playerid,0);
format(string,sizeof string,"%s est maintenant AFK.",name);
SendClientMessageToAll(COLOR_WHITE,string);
PlayerPlaySound(playerid, 1068, 0.0, 0.0, 0.0);
timer = SetTimerEx("afkkick", 1800000,true, "i", playerid);
timer2 = SetTimerEx("afkrandom", 3000,true, "i", playerid);
return 1;
}
else
{
jAFK[playerid] = 0;
TogglePlayerControllable(playerid,1);
format(string,sizeof string,"%s n'est plus AFK.",name);
SendClientMessageToAll(COLOR_WHITE,string);
PlayerPlaySound(playerid,1098,0.0,0.0,0.0);
KillTimer(timer);
KillTimer(timer2);
etape = 0;
SetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]);
SetCameraBehindPlayer(playerid);
format(string,sizeof string,"%s",name);
SetPlayerName(playerid,string);
return 1;
}