SA-MP Forums Archive
Simple system help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Simple system help (/showthread.php?tid=387894)



Simple system help - Juan_Viz - 26.10.2012

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] == }


Re: Simple system help - V1ceC1ty - 26.10.2012

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;
}



Re : Re: Simple system help - lelemaster - 26.10.2012

@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;
}



Re: Re : Re: Simple system help - V1ceC1ty - 26.10.2012

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!


Respuesta: Simple system help - Juan_Viz - 26.10.2012

Deleted..