Need some small help with spawning - 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: Need some small help with spawning (
/showthread.php?tid=179278)
Need some small help with spawning -
ToPhrESH - 26.09.2010
Well, I created about 17 colors I want people to spawn randomly with. I don't really understand how to do this but i tried this.
This is for the 17 colors i made
pawn Код:
new sColor[ssColors][] = {
{0x8A2BE2FF},
{0x483D8BFF},
{0x00CED1FF},
{0x0000CDFF},
{0x002266FF},
{0xCD7F32FF},
{0xFFC1C1FF},
{0xBC8F8FFF},
{0xFF1493FF},
{0x8B4513FF},
{0xA52A2AFF},
{0xFF7F24FF},
{0x006400FF},
{0xCAFF70FF},
{0x00FF00FF},
{0xFF0000FF},
{0xFFFF00FF}
}
Then I did this above. I was thinks sColor would stand for Spawn Color and [ssColor] are all the 17 colors i defined.
pawn Код:
new rColor = random(sizeof(sColor));
SetPlayerColor(playerid, sColor[rColor][1]);
Then I get errors..
Код:
(103) : error 001: expected token: ";", but found "-identifier-"
(351) : error 032: array index out of bounds (variable "sColor")
Line 103 is
and line 351 is
pawn Код:
SetPlayerColor(playerid, sColor[rColor][1]);
Help with this would greatly be appreciated as I am trying to script a server for my clan! Thanks ffor your time.
Re: Need some small help with spawning -
Retardedwolf - 26.09.2010
SetPlayerColor(playerid, sColor[rColor]);
?
Re: Need some small help with spawning -
Mauzen - 26.09.2010
You do not need a 2D array, one dimension is enough, because a color hex number is nothing else but a integer.
pawn Код:
new sColor[ssColors] = {
0x8A2BE2FF,
0x483D8BFF,
...
(Also you forgot the ; after the last bracket of the array)
Re: Need some small help with spawning -
ToPhrESH - 26.09.2010
Quote:
Originally Posted by Mauzen
You do not need a 2D array, one dimension is enough, because a color hex number is nothing else but a integer.
pawn Код:
new sColor[ssColors] = { 0x8A2BE2FF, 0x483D8BFF, ...
(Also you forgot the ; after the last bracket of the array)
|
thanks alot man.