change player color -
`FuTuRe- - 13.01.2010
Well, i tryed to if the player is premium it changes every 5 seconds
pawn Код:
public Premium()
{
if(pInfo[playerid][perfect] == 1)
{
case 0: SetPlayerColor(playerid, 0x00C3F6AA);
{
case 1: SetPlayerColor(playerid, 0xBF00C7AA);
}
return 1;
}
Код:
(823) : error 017: undefined symbol "playerid"
(824) : error 014: invalid statement; not in switch
(824) : warning 215: expression has no effect
(824) : error 001: expected token: ";", but found ":"
(824) : error 029: invalid expression, assumed zero
(824) : fatal error 107: too many error messages on one line
And YES i know i fail

So i hope somebody can help me.
Re: change player color -
`FuTuRe- - 13.01.2010
bumpzorred
Re: change player color -
Babul - 13.01.2010
i dont get what exactly you want to do, i assume you want to check the players' status each 5 secs then set the players color according to the value...
try one of these solutions, one with "if", other with "case"
Код:
public Premium(playerid)
{
if(pInfo[playerid][perfect] == 1)
{
SetPlayerColor(playerid, 0x00C3F6AA);
return 1;
}
else
{
SetPlayerColor(playerid, 0xBF00C7AA);
return 1;
}
}
other
Код:
public Premium(playerid)
{
switch(pInfo[playerid][perfect])
{
case 0:
{
SetPlayerColor(playerid, 0xBF00C7AA);
return 1;
}
case 1:
{
SetPlayerColor(playerid, 0x00C3F6AA);
return 1;
}
}
}
Re: change player color -
`FuTuRe- - 14.01.2010
I mean, if the player is premium that his color will change each 5 seconds,
Re: change player color -
Klutty - 14.01.2010
Then you will need to set a timer, if you havent already done that.
Re: change player color -
`FuTuRe- - 14.01.2010
Already got one.
Re: change player color -
Babul - 14.01.2010
my idea is to make a premium-variable for each player:
at top of your script, add
Код:
new PlayerColorStatus[MAX_PLAYERS];
new gColor[]={0xffff00aa,0x00ffffaa,0xff00ffaa,0xffffffaa,0x000000aa};
...and this callback somewhere:
Код:
forward Timer();
public Timer()
{
for (ID=0;ID<MAX_PLAYERS;ID++)
{
if(IsPlayerAdmin(ID)==1)//replace the "IsPlayerAdmin(ID)" with "pInfo[ID][perfect]", and it will work for your desired condition...
{
PlayerColorStatus[ID]=(PlayerColorStatus[ID]+1)%sizeof(gColor);//this will "rotate" through the (5 atm) colors
SetPlayerColor(ID,gColor[PlayerColorStatus[ID]]);
}
}
}
for the callback (timer) being executed, you need to set it up somewhere in your OnGameModeInit()...
Код:
SetTimer("Timer",5000,true);//5 seconds (in ms)
edit: i forgot to make the timer, now it will work (i tested, and it works well)
Re: change player color -
Retardedwolf - 14.01.2010
If you are goona use case 0/1: you must switch first.