SA-MP Forums Archive
[Tutorial] [TUT]How to change player colours - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] [TUT]How to change player colours (/showthread.php?tid=140392)



[TUT]How to change player colours - johnathon956 - 08.04.2010

add this to the top of your script you can change these numbers

pawn Code:
new playerColors[MAX_PLAYERS] = {
0xAA3333AA,
0xAFAFAFAA,
0x33AA33AA,
0xAA3333AA,
0xFFFF00AA,
0xFFFFFFAA,
0xFF9900AA,
0xFF8C55FF,
0x6DC5F3FF,
0xFF0000FF,
0x2986CEFF,
0xC6BEBDFF,
0x000000FF,
0x74E80099,
0xBE615099,
0x00BBBB99,
0xFF0000FF
};
now add this too
pawn Code:
SetPlayerColor(playerid, playerColors[playerid % sizeof playerColors]);
thanks too ♣ Joker ♠

pawn Code:
public OnPlayerRequestClass(playerid, classid)
hope this helps you i dont know if there is allready a tut for this i found this myself


Re: [TUT]How to change player colours - Steven82 - 08.04.2010

Very simple TUT, but will help the noobs.


Re: [TUT]How to change player colours - johnathon956 - 08.04.2010

Quote:
Originally Posted by Steven82
Very simple TUT, but will help the noobs.
yep simple but works


Re: [TUT]How to change player colours - DarrenReeder - 08.04.2010

very niiice


Re: [TUT]How to change player colours - snoob - 08.04.2010

Quote:
Originally Posted by johnathon956
Quote:
Originally Posted by Steven82
Very simple TUT, but will help the noobs.
yep simple but works
work until you have more then 17 player ... then you are out of array boundary.


Re: [TUT]How to change player colours - Nero_3D - 09.04.2010

Quote:
Originally Posted by snoob
Quote:
Originally Posted by johnathon956
Quote:
Originally Posted by Steven82
Very simple TUT, but will help the noobs.
yep simple but works
work until you have more then 17 player ... then you are out of array boundary.
there is an easy fix for that

pawn Code:
SetPlayerColor(playerid, playerColors[playerid % sizeof playerColors]);



Re: [TUT]How to change player colours - johnathon956 - 09.04.2010

Quote:
Originally Posted by ♣ Joker ♠
Quote:
Originally Posted by snoob
Quote:
Originally Posted by johnathon956
Quote:
Originally Posted by Steven82
Very simple TUT, but will help the noobs.
yep simple but works
work until you have more then 17 player ... then you are out of array boundary.
there is an easy fix for that

pawn Code:
SetPlayerColor(playerid, playerColors[playerid % sizeof playerColors]);
lol why didnt i thing of that XD


Re: [TUT]How to change player colours - Grim_ - 09.04.2010

Quote:
Originally Posted by ♣ Joker ♠
Quote:
Originally Posted by snoob
Quote:
Originally Posted by johnathon956
Quote:
Originally Posted by Steven82
Very simple TUT, but will help the noobs.
yep simple but works
work until you have more then 17 player ... then you are out of array boundary.
there is an easy fix for that

pawn Code:
SetPlayerColor(playerid, playerColors[playerid % sizeof playerColors]);
I have a question, what exactly does "%" do? I never found a good place to find an explanation :/


Re: [TUT]How to change player colours - johnathon956 - 09.04.2010

Quote:
Originally Posted by _Xerxes_
Quote:
Originally Posted by ♣ Joker ♠
Quote:
Originally Posted by snoob
Quote:
Originally Posted by johnathon956
Quote:
Originally Posted by Steven82
Very simple TUT, but will help the noobs.
yep simple but works
work until you have more then 17 player ... then you are out of array boundary.
there is an easy fix for that

pawn Code:
SetPlayerColor(playerid, playerColors[playerid % sizeof playerColors]);
I have a question, what exactly does "%" do? I never found a good place to find an explanation :/
uhm dunno XD


Re: [TUT]How to change player colours - Nero_3D - 09.04.2010

Quote:
Originally Posted by _Xerxes_
Quote:
Originally Posted by ♣ Joker ♠
Quote:
Originally Posted by snoob
Quote:
Originally Posted by johnathon956
Quote:
Originally Posted by Steven82
Very simple TUT, but will help the noobs.
yep simple but works
work until you have more then 17 player ... then you are out of array boundary.
there is an easy fix for that

pawn Code:
SetPlayerColor(playerid, playerColors[playerid % sizeof playerColors]);
I have a question, what exactly does "%" do? I never found a good place to find an explanation :/
It calculates the Rest from a division

Example:
playerid = 48 48 % 17 = 14
playerid = 15 15 % 17 = 15