25.09.2012, 07:37
Tried it but don't work. Anyways it will be easy if i give my command and you guys can reply with the edit.
I want when player is afk to be unable to speak. ( only the player can type /back )
pawn Код:
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
if(AFK[playerid] == 0)
{
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, 280, "%s has gone AFK.", pname);
SendClientMessageToAll(COLOR_PINK, string);
TogglePlayerControllable(playerid,0);
AFK[playerid] = 1;
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: You are already AFK.");
return 1;
}
if (strcmp("/back", cmdtext, true, 10) == 0)
{
if(AFK[playerid] == 1)
{
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, 280, "%s is now back from being AFK.", pname);
SendClientMessageToAll(COLOR_PINK, string);
TogglePlayerControllable(playerid,1);
AFK[playerid] = 0;
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: You aren't AFK.");
return 1;
}