17.10.2011, 17:01
Try:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/afk", true))
{
if (PlayerIsAFK[playerid] == 0)
{
new pName[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string, sizeof(string), "--) %s Has entered AFK mode.", pName);
SendClientMessage(playerid,COLOR_YELLOW, "You are now in AFK mode. Use /back to go back!");
SendClientMessageToAll(COLOR_YELLOW, string);
TogglePlayerControllable(playerid, 0);
GetPlayerHealth(playerid, naty[playerid]);
GetPlayerPos(playerid, positions[playerid][0], positions[playerid][1], positions[playerid][2]);
SetPlayerPos(playerid, 2879.5769,2523.5569,10.8203);
SetPlayerHealth(playerid, 999999999999999.99);
PlayerIsAFK[playerid] = 1;
return 1;
}
}
if(strcmp(cmdtext, "/back", true) == 0)
{
if (PlayerIsAFK[playerid] == 1)
{
new pName[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string, sizeof(string), "--) %s Is now back.", pName);
SendClientMessageToAll(COLOR_YELLOW, string);
TogglePlayerControllable(playerid, 1);
SetPlayerHealth(playerid, naty[playerid]);
SetPlayerPos(playerid, positions[playerid][0], positions[playerid][1], positions[playerid][2]);
PlayerIsAFK[playerid] = 0;
}
return 1;
}
return 0;
}