SA-MP Forums Archive
/toggold? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /toggold? (/showthread.php?tid=191046)



/toggold? - Luis- - 17.11.2010

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?


Re: /toggold? - DiddyBop - 17.11.2010

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?


Re: /toggold? - Luis- - 17.11.2010

Hmm, It still does not work..?


Re: /toggold? - ••• ĤБĶБM ••• - 17.11.2010

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



Re: /toggold? - rs.pect - 17.11.2010

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


Re: /toggold? - ••• ĤБĶБM ••• - 17.11.2010

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


Re: /toggold? - rs.pect - 17.11.2010

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


Re: /toggold? - Flyfishes - 17.11.2010

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



Re: /toggold? - Luis- - 17.11.2010

Nope, Still nothing..


Re: /toggold? - Zh3r0 - 17.11.2010

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.