Enum help
#1

I want to make a cmd that will toggle something I know it will use enums this is something what i tought:

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/afk", cmdtext, true, 10) == 0)
	{
		If user = afk then
                      print("You are no longer AFK!")
                Else
                      print("You are now afk!")
                End if
		return 1;
	}
	return 0;
}
I know the code is not right, I stopped with pawn for a while so bear with me
Reply
#2

pawn Code:
new bool:IsAFK[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    IsAFK[playerid] = false;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/afk", cmdtext, true, 4) == 0)
    {
        if(IsAFK[playerid] == false)  
        {
            SendClientMessage(playerid, -1, "You are now AFK!")
            IsAFK[playerid] = true;  
        }
        else
        {
            IsAFK[playerid] = false;
            SendClientMessage(playerid, -1, "You are not AFK anymore.");
        }
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)