[Tutorial] How to create a simple AFK system
#7

Quote:
Originally Posted by Necip
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/afk", cmdtext, true, 10) == 0)
    {
        new Name[MAX_PLAYER_NAME]; // Defining the Player's Name
        GetPlayerName(playerid, Name, sizeof(Name));
        if  (isAFK[playerid] == 0) // if the player is NOT AFK
        {
            isAFK[playerid] = 1; // Turning his state to AFK mode
            format( string, sizeof(string), "%s is AFK !", Name); // Formatting the message to be sended
            SendClientMessageToAll(-1 , string); // Sends message to everyone to inform he is AFK, put a color in yourcolorhere part of this code to make it work.
        }
        else { // if the player is already AFK
            isAFK[playerid] = 0; // Turning his state to NO-AFK mode
            format( string, sizeof(string), "%s is back!", Name); // Formatting the message to be sended
            SendClientMessageToAll(-1, string); // Sends message to inform he is back , put a color in yourcolorhere part of this code to make it work.
        }
        return 1;
    }
    return 1;
}
The last should be "return 0;".

Quote:
Originally Posted by Rufio
Посмотреть сообщение
pawn Код:
if(strcmp("/afk", cmdtext, true, 10) == 0)
"/afk" has 4 lenght, not 10. Well, the lenght is option so it's better not to use it at all if it's gonna be incorrect or use it with the correct lenght.
Reply


Messages In This Thread
How to create a simple AFK system - by Rufio - 17.03.2013, 22:20
Re: How to create a simple AFK system - by StuartD - 17.03.2013, 22:24
Re: How to create a simple AFK system - by Rufio - 17.03.2013, 22:24
Re: How to create a simple AFK system - by LeeXian99 - 22.03.2013, 14:56
Re: How to create a simple AFK system - by qazwsx - 02.08.2013, 09:31
Re: How to create a simple AFK system - by Necip - 02.08.2013, 09:55
Re: How to create a simple AFK system - by Konstantinos - 02.08.2013, 10:00
Re: How to create a simple AFK system - by Necip - 02.08.2013, 11:49
Re: How to create a simple AFK system - by NinjahZ - 07.08.2013, 22:48
Re: How to create a simple AFK system - by AfikAtashga - 07.08.2013, 23:56

Forum Jump:


Users browsing this thread: 1 Guest(s)