14.05.2012, 17:13
one problem
you created two brackets at finish
pawn Код:
CMD:afk(playerid, params[])
{
new string[128]; // Declaring the string as 128 bit text
if(PlayerInfo[playerid][AFK] == 1) // if the enum we created earlier = 1 (which means the player is already AFK) then
{
SendClientMessage(playerid, COLOR_RED, "You Are Already AFK"); // Send him a message informing him he can't use /afk again because he is already AFK
}
else if(PlayerInfo[playerid][AFK] == 0) // If the enum = 0 (which means the player is not AFK) then
{
new pName[MAX_PLAYER_NAME]; // Declaring pName As MAX_PLAYER_NAME
GetPlayerName(playerid, pName, sizeof(pName)); // Getting Player's name and filling it into pName
format(string, sizeof(string), "%s Is Now AFK", pName); // formatting our string that we defined earlier
SendClientMessageToAll(COLOR_RED, string); // Sending a Client message to all informing them that pName used /afk and he is AFK now
TogglePlayerControllable(playerid, 0); // Freeze the player so he can't (walk, drive, run, etc..)
PlayerInfo[playerid][AFK] = 1; // Change the enum we created to 1 (which means he is already AFK)
}
return 1; // return 1 (means that the operation completed successfully
}
}