SA-MP Forums Archive
-Once again, a noob question of me ; )- - 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: -Once again, a noob question of me ; )- (/showthread.php?tid=191577)



-Once again, a noob question of me ; )- - knackworst - 19.11.2010

I got little problem with making a color command, I downloaded the colohandler Include and what I want to make is this:

if a player types /color <r value> <g value> <bvalue>
then the player's name should become those values...

This is what I got so far:
Код:
   //Color system
   
   if(strcmp("/color", cmdtext, true) == 0)
   {
   SetPlayerColor(playerid, CreateColor(R,G,B););
   }
Lol, plz help me out!


Re: -Once again, a noob question of me ; )- - WillyP - 19.11.2010

So you want a custom colour stock/function?


AW: -Once again, a noob question of me ; )- - Extremo - 19.11.2010

Well.. some indentitation would be great. Instead of:
pawn Код:
if(strcmp("/color", cmdtext, true) == 0)
{
SetPlayerColor(playerid, CreateColor(R,G,B););
}
This would be much better to read:
pawn Код:
if(strcmp("/color", cmdtext, true) == 0)
{
   SetPlayerColor(playerid, CreateColor(R,G,B););
}
So, also, when specifing params in a function, as in:
pawn Код:
Function(params)
You never use a semicolon within the params, so this line:
pawn Код:
SetPlayerColor(playerid, CreateColor(R,G,B););
becomes this line:
pawn Код:
SetPlayerColor(playerid, CreateColor(R,G,B));
Now, looking at your color system, you would have to convert R,G,B to a syntax like 0xRRGGBB and you should be good.

EDIT:

Remember that the colors are in hex. So, FF means 15*15 which equals to 255.. just like RGB


Re: -Once again, a noob question of me ; )- - knackworst - 19.11.2010

Wow, that's very complicated for me as a beginner : O