[Tutorial] AFK System
#5

Quote:
Originally Posted by Skaizo
Посмотреть сообщение
one problem
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
}
}
you created two brackets at finish
Edited
Reply


Messages In This Thread
AFK System | With /whoisafk - by Saad_ - 14.05.2012, 16:48
Re: AFK System - by Skaizo - 14.05.2012, 17:13
Re: AFK System - by HaZaRaS™ - 14.05.2012, 17:16
Re: AFK System - by Mr.Fames - 15.05.2012, 04:57
Re: AFK System - by Saad_ - 15.05.2012, 05:00
Re: AFK System - by Saad_ - 15.05.2012, 06:38
Re: AFK System - by [ABK]Antonio - 15.05.2012, 06:51
Re: AFK System - by Saad_ - 15.05.2012, 06:54
Re: AFK System - by Rube - 15.05.2012, 07:03
Re: AFK System - by [ABK]Antonio - 15.05.2012, 07:09

Forum Jump:


Users browsing this thread: 1 Guest(s)