Color 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Color help (
/showthread.php?tid=108203)
Color help -
Nikos12 - 12.11.2009
Hi guys.... I have a cops and robbers server and i want to know how can i make : if player is wanted level 1,2,3,4 is yellow and if he is 5,6 he is orange....
Re: Color help -
retart441 - 12.11.2009
Define the colors at the top.
Create a variable at the top.
EXAMPLE
pawn Код:
new WantedLevel[MAX_PLAYERS];
UnderOnPlayerDeath - Only if you want this to happen when the player kills someone.
pawn Код:
WantedLevel[killerid] += 1;
Now you can either do it under on player death, or w/e you want, but make some if statements, and else ifs.
pawn Код:
if(WantedLevel[killerid] == 1)
{
SetPlayerColor(killerid, /*COLOR*/);
return 1;
}
else if(WantedLevel[killerid] == 2)
{
SetPlayerColor(killerid, /*COLOR*/);
return 1;
}
/*So on*/
Re: Color help -
Nikos12 - 12.11.2009
Realy thank you man!!!!!! One more question.... 1 Star= 4 wanted levels??
Re: Color help -
retart441 - 12.11.2009
SetPlayerWantedLevel Under Each one.
pawn Код:
If(WantedLevel[killerid] == 1)
{
/* Things above */
SetPlayerWantedLevel(killerid, 1);
return 1;
}
if(WantedLevel[killerid] == 2)
{
/* Things above */
SetPlayerWantedLevel(killerid, 2);
return 1;
}
/* That will put the literal stars on there screen */
Re: Color help -
[XST]O_x - 12.11.2009
Quote:
Originally Posted by Nikos12
1 Star= 4 wanted levels??
|
No.
1 Star= 1 Wanted level *-*
Re: Color help -
Nikos12 - 12.11.2009
ok guys thank you
Re: Color help -
Blantas - 12.11.2009
Please delete this post
Re: Color help -
radhakr - 12.11.2009
You could use
switch here, instead of
if,
else if and
else:
pawn Код:
switch (WantedLevel[killerid])
{
case 1:
{
//code from if(WantedLevel[killerid] == 1)
}
case 2:
{
//code from else if(WantedLevel[killerid] == 2)
}
default:
{
//code from else
}
}
Maybe useful to know for some other time.
https://sampwiki.blast.hk/wiki/Control_Structures#switch_2