Simple system help
#1

I want it so when the player connects this happens
Like

Public Onplayerconnect:
[Pafk] == 0
then I will make the /AFk command ((I already have it ready)) So when the AFK Command gets processed it makes the following

[Pafk] == 1

Then when the player attempts to do /afk again and he is already in [Pafk] == 1 It will say "You are already AFK!"

After that, I made the /Back command, so it will be something like..

/Back
{
BLA BLA
[Pafk] == }
Reply
#2

pawn Код:
new Pafk = 0;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/afk", cmdtext, true, 10) == 0)
    {
        if(Pafk == 1)
        {
            SendClientMessage(playerid, 0xEFEFF7AA, "ERROR: Already AFK");
        }
        else if(Pafk == 0)
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "You are now AFK");
            Pafk == 1;
        }
        return 1;
    }
    if (strcmp("/back", cmdtext, true, 10) == 0)
    {
        if(Pafk == 0)
        {
            SendClientMessage(playerid, 0xEFEFF7AA, "ERROR: You are not AFK");
        }
        else if(Pafk == 1)
        {
            Pafk == 0;
            SendClientMessage(playerid, 0xFFFFFFFF, "You are now back");
        }
        return 1;
    }
    return 0;
}

public OnPlayerDisconnect(playerid)
{
    Pafk = 0;
    return 1;
}
Reply
#3

@V1ceC1ty This will not work.

This will:

pawn Код:
new Pafk[MAX_PLAYERS] = 0;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/afk", cmdtext, true, 10) == 0)
    {
        if(Pafk[playerid] == 1)
        {
            SendClientMessage(playerid, 0xEFEFF7AA, "ERROR: Already AFK");
        }
        else if(Pafk[playerid] == 0)
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "You are now AFK");
            Pafk[playerid] == 1;
        }
        return 1;
    }
    if (strcmp("/back", cmdtext, true, 10) == 0)
    {
        if(Pafk[playerid] == 0)
        {
            SendClientMessage(playerid, 0xEFEFF7AA, "ERROR: You are not AFK");
        }
        else if(Pafk[playerid] == 1)
        {
            Pafk[playerid] == 0;
            SendClientMessage(playerid, 0xFFFFFFFF, "You are now back");
        }
        return 1;
    }
    return 0;
}

public OnPlayerDisconnect(playerid)
{
    Pafk[playerid] = 0;
    return 1;
}
Reply
#4

Quote:
Originally Posted by lelemaster
Посмотреть сообщение
@V1ceC1ty This will not work.

This will:

pawn Код:
new Pafk[MAX_PLAYERS] = 0;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/afk", cmdtext, true, 10) == 0)
    {
        if(Pafk[playerid] == 1)
        {
            SendClientMessage(playerid, 0xEFEFF7AA, "ERROR: Already AFK");
        }
        else if(Pafk[playerid] == 0)
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "You are now AFK");
            Pafk[playerid] == 1;
        }
        return 1;
    }
    if (strcmp("/back", cmdtext, true, 10) == 0)
    {
        if(Pafk[playerid] == 0)
        {
            SendClientMessage(playerid, 0xEFEFF7AA, "ERROR: You are not AFK");
        }
        else if(Pafk[playerid] == 1)
        {
            Pafk[playerid] == 0;
            SendClientMessage(playerid, 0xFFFFFFFF, "You are now back");
        }
        return 1;
    }
    return 0;
}

public OnPlayerDisconnect(playerid)
{
    Pafk[playerid] = 0;
    return 1;
}
Oh yes! good correction!
Reply
#5

Deleted..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)