/toggold?
#1

pawn Код:
if (!strcmp("/toggold", cmdtext, true, 10))
    {
        new gold[MAX_PLAYERS];
        if(IsPlayerVipType(playerid, 1 || 2 || 3))
        {
            gold[playerid] = 0;
            SetPlayerColor(playerid, COLOR_GOLD);
            SendClientMessage(playerid, COLOR_WHITE, "[Donator Info] Your color is now set to Gold");
        }
        else
        {
            gold[playerid] = 1;
            SetPlayerColor(playerid, COLOR_WHITE);
            SendClientMessage(playerid, COLOR_WHITE, "[Donator Info] You  have set your Color back to White");
        }
        return 1;
    }
Is this correct, As it does not set the players color back to white if he has already set it to Gold?
Reply
#2

pawn Код:
if (!strcmp("/toggold", cmdtext, true, 10))
    {
        new gold[MAX_PLAYERS];
        if(IsPlayerVipType(playerid, 1 || 2 || 3))
        {
if(gold[playerid] = 1){
            gold[playerid] = 0;
            SetPlayerColor(playerid, COLOR_GOLD);
            SendClientMessage(playerid, COLOR_WHITE, "[Donator Info] Your color is now set to Gold");
}
        }
        else
        {
if(gold[playerid] = 0)
{
            gold[playerid] = 1;
            SetPlayerColor(playerid, COLOR_WHITE);
            SendClientMessage(playerid, COLOR_WHITE, "[Donator Info] You  have set your Color back to White");
}
        }
        return 1;
    }
Im guessing thats how you want?
Reply
#3

Hmm, It still does not work..?
Reply
#4

pawn Код:
if (!strcmp("/toggold", cmdtext, true, 10))
    {
        new gold[MAX_PLAYERS];
        if(IsPlayerVipType(playerid, 1 || 2 || 3))
        {
            gold[playerid] = 1;
            SetPlayerColor(playerid, COLOR_GOLD);
            SendClientMessage(playerid, COLOR_WHITE, "[Donator Info] Your color is now set to Gold");
        }
        else if(gold[playerid] == 0)
        {
            gold[playerid] = 0;
            SetPlayerColor(playerid, COLOR_WHITE);
            SendClientMessage(playerid, COLOR_WHITE, "[Donator Info] You  have set your Color back to White");
        }
        return 1;
    }
Reply
#5

pawn Код:
if(IsPlayerVipType(playerid, 1 || 2 || 3))
This condition isn't valid.
Reply
#6

Quote:
Originally Posted by rs.pect
Посмотреть сообщение
pawn Код:
if(IsPlayerVipType(playerid, 1 || 2 || 3))
This condition isn't valid.
It is valid.
Reply
#7

Maybe it is, but what means this?
pawn Код:
1 || 2 || 3
With this, he returns true to second parameter.
Reply
#8

pawn Код:
if (!strcmp("/toggold", cmdtext, true, 10))
    {
        new gold[MAX_PLAYERS];
        if(IsPlayerVipType(playerid, 1) || IsPlayerVipType(playerid, 2) || IsPlayerVipType(playerid, 3))
        {
            if(gold[playerid] == 0)
            {
               gold[playerid] = 1;
               SetPlayerColor(playerid, COLOR_GOLD);
               SendClientMessage(playerid, COLOR_WHITE, "[Donator Info] Your color is now set to Gold");
            }
            else if(gold[playerid] == 1)
            {
               gold[playerid] = 0;
               SetPlayerColor(playerid, COLOR_WHITE);
               SendClientMessage(playerid, COLOR_WHITE, "[Donator Info] You  have set your Color back to White");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "[Error] You're not a VIP");
        }
        return 1;
    }
Reply
#9

Nope, Still nothing..
Reply
#10

Quote:
Originally Posted by -Luis
Посмотреть сообщение
Nope, Still nothing..
pawn Код:
new gold[ MAX_PLAYERS ];
if (!strcmp("/toggold", cmdtext, true, 8))
{
        if ( IsPlayerVipType( playerid, 1 ) ||
             IsPlayerVipType( playerid, 2 ) ||
             IsPlayerVipType( playerid, 3 )
        )
        {
            if ( gold[ playerid ] == 1 )
            {
                gold [playerid ] = 0;
                SetPlayerColor( playerid, COLOR_GOLD );
                SendClientMessage( playerid, COLOR_WHITE, "[Donator Info] Your color is now set to Gold" );
            }
            else if ( gold[ playerid ] == 0 )
            {
                gold[ playerid ] = 1;
                SetPlayerColor( playerid, COLOR_WHITE );
                SendClientMessage( playerid, COLOR_WHITE, "[Donator Info] You  have set your Color back to White" );
            }
        } else return SendClientMessage( playerid, COLOR_RED, "You are not a VIP Member");
        return 1;
}
First of all, you should make the 'gold[ MAX_PLAYERS ];' variable GLOBAL.
Because creating it always over and over it will automatically set to 0 over and over.
Second, you set 10 characters at strcmp( ... ), it was 8 "/ t o g g o l d" = 8 characters.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)