Little help with random spawns -
mickos - 16.07.2012
Hey this is a very little question about random spawns.
I want 2 or more random spawns sections I mean this:
PHP код:
public OnPlayerSpawn(playerid)
{
switch(GetPlayerSkin(playerid))
{
case 105,106,107,269,270,271:
{
new rand = random(sizeof(gRandomSpawns));
SetPlayerPos(playerid, gRandomSpawns[rand][0], gRandomSpawns[rand][1], gRandomSpawns[rand][2]);
SetPlayerColor(playerid, 0x499C67FF);
}
}
switch(GetPlayerSkin(playerid))
{
case 102,103,104:
{
new rand = random(sizeof(bRandomSpawns));
SetPlayerPos(playerid, bRandomSpawns[rand][0], bRandomSpawns[rand][1], bRandomSpawns[rand][2]);
}
}
return 1;
}
I think its wrong and it is!
I got one error namely:
PHP код:
C:\Users\Edward\Desktop\SA-MP Server Gangwars\pawno\GangWarsULv.03.pwn(348) : error 018: initialization data exceeds declared size
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Ty,
Re: Little help with random spawns -
mickos - 16.07.2012
Hmm anyone? I am really really bored about this, I work 3 days on this random spawns! because I didnt realy know how to make it, now i need only know how to fix this..
Re: Little help with random spawns -
leonardo1434 - 16.07.2012
The size of the array 2D is bigger than the value you've placed.
Re: Little help with random spawns -
mickos - 16.07.2012
I didnt see why it is bigger than the value ?
Re: Little help with random spawns -
hansen111 - 16.07.2012
show the code where you define the array called gRandomSpawns
Re: Little help with random spawns -
mickos - 16.07.2012
I didnt #define gRandomSpawns
Re: Little help with random spawns -
hansen111 - 16.07.2012
Not litterally #define, i ment the code where you create the array, like new Float: gRandomSpawns[?][?];
Re: Little help with random spawns -
mickos - 16.07.2012
Ohw here:
PHP код:
new Float:gRandomSpawns[4][3] =
{
{2509.3162,-1654.4011,13.6194},
{2511.2471,-1688.7179,13.5511},
{2471.9990,-1686.6086,13.5078},
{2509.3162,-1654.4011,13.6194}
};
new Float:bRandomSpawns[3][3] = //Ballas
{
{2140.7705,-1700.4626,15.0784},
{2146.6111,-1665.4973,15.0859},
{2144.3179,-1685.4233,15.0859},
};
Re: Little help with random spawns -
hansen111 - 16.07.2012
Remove the last comma in bRandomSpawns:
new Float:bRandomSpawns[3][3] = //Ballas
{
{2140.7705,-1700.4626,15.0784},
{2146.6111,-1665.4973,15.0859},
{2144.3179,-1685.4233,15.0859}, <- REMOVE
};
so you get:
new Float:bRandomSpawns[3][3] = //Ballas
{
{2140.7705,-1700.4626,15.0784},
{2146.6111,-1665.4973,15.0859},
{2144.3179,-1685.4233,15.0859}
};
Re: Little help with random spawns -
mickos - 16.07.2012
Cool it works!, thanks for your help +rep for you.
But one question, why did i need removed the last comma? I dont know why if I know it than I know it for the next time.