command problem help rep+
#1

when player again type /aduty and when admin turn off admin duty he have cj skin and white color


Код:
CMD:aduty(playerid, params[])
{
    if(pInfo[playerid][pLevel] >= 1)
    {
        new skin[MAX_PLAYERS];
        if(OnDuty[playerid] == 0)
        {
            skin[playerid] = GetPlayerSkin(playerid);
            SetPlayerSkin(playerid, 217);
            SetPlayerHealth(playerid, 100000);
            SetPlayerArmour(playerid, 100000);
            SetPlayerColor(playerid, 0x01FCFFFF);
            OnDuty[playerid] = 1;
        }
        else if(OnDuty[playerid] == 1)
        {
            SetPlayerSkin(playerid, skin[playerid]);
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 0);
            SetPlayerColor(playerid, 0xFFFFFFFF);
            OnDuty[playerid] = 0;
        }
    }
    else
    {
        SendClientMessage(playerid, red, "You are not administrator.");
    }
    return true;
}
Reply
#2

Of course he will get a white color, because you do SetPlayerColor to white!
Reply
#3

i want color like before and skin like before
Reply
#4

The skin array should be global, otherwise it gets set as 0 each time you use the command, and won't remember what it was set to.
And for the white color, you should store the players color in a global array as well, like the skin.
Reply
#5

i can't understand give example
Reply
#6

Quote:
Originally Posted by Mijata
Посмотреть сообщение
i can't understand give example
No, we are not going to give you the code. Calvin explained it pretty clear so just go ahead and change the things he said.
Reply
#7

If you don't understand basic scripting, you should go watch tutorials, and try doing some easier things instead of asking for people to do it for you here.
Reply
#8

You can declare that skin variable exactly where you declared "pLevel".Let's say you call it "pSkin" and you're gonna use it like "pInfo[playerid][pSkin]".
Reply
#9

Код:
#define COLOR_WHITE 0xFFFFFFAA //- If you do not have COLOR_WHITE Defined, or use -1

CMD:aduty(playerid, params[])
{
    if(pInfo[playerid][pLevel] >= 1)
    {
        new skin[MAX_PLAYERS];
        if(OnDuty[playerid] == 0)
        {
            skin[playerid] = GetPlayerSkin(playerid);
            SetPlayerSkin(playerid, 217);
            SetPlayerHealth(playerid, 100000);
            SetPlayerArmour(playerid, 100000);
            SetPlayerColor(playerid, 0x01FCFFFF);
            OnDuty[playerid] = 1;
        }
        else if(OnDuty[playerid] == 1)
        {
            SetPlayerSkin(playerid, GetPlayerSkin[playerid]);
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 0);
            SetPlayerColor(playerid, 0xFFFFFFAA); // OR SetPlayerColor(playerid, -1);
            OnDuty[playerid] = 0;
        }
    }
    else
    {
        SendClientMessage(playerid, red, "You are not administrator.");
    }
    return true;
}
Reply
#10

Quote:
Originally Posted by MrCallum
Посмотреть сообщение
Код:
#define COLOR_WHITE 0xFFFFFFAA //- If you do not have COLOR_WHITE Defined, or use -1

CMD:aduty(playerid, params[])
{
    if(pInfo[playerid][pLevel] >= 1)
    {
        new skin[MAX_PLAYERS];
        if(OnDuty[playerid] == 0)
        {
            skin[playerid] = GetPlayerSkin(playerid);
            SetPlayerSkin(playerid, 217);
            SetPlayerHealth(playerid, 100000);
            SetPlayerArmour(playerid, 100000);
            SetPlayerColor(playerid, 0x01FCFFFF);
            OnDuty[playerid] = 1;
        }
        else if(OnDuty[playerid] == 1)
        {
            SetPlayerSkin(playerid, GetPlayerSkin[playerid]);
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 0);
            SetPlayerColor(playerid, 0xFFFFFFAA); // OR SetPlayerColor(playerid, -1);
            OnDuty[playerid] = 0;
        }
    }
    else
    {
        SendClientMessage(playerid, red, "You are not administrator.");
    }
    return true;
}
How's that even supposed to work?
GetPlayerSkin is a function, so use parenthesis, not brackets.
And even doing GetPlayerSkin(playerid) will just set it to the skin he currently has.
As i said, you need to use a global array to store the data in, not a local one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)