SA-MP Forums Archive
random cp's? - 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: random cp's? (/showthread.php?tid=185807)



random cp's? - Gh0sT_ - 26.10.2010

im tryied to create random checkpoints, but im getting error. :/

Quote:

new Float:RandomCP[][] =
{
{1075.9678,2385.3535,11.1081,357.8982},
{1094.9563,2357.5154,10.8203,358.8381},
{1067.7051,2365.5979,17.3643,268.5973},
{1110.4586,2356.1936,10.8203,58.9753}
};

when player enter the car.

Quote:

new Random1 = random(10);
SetPlayerRaceCheckpoint(playerid, 1,RandomCP[Random1][0], RandomCP[Random1][1], RandomCP[Random1][2], 10);




Re: random cp's? - 0ne - 26.10.2010

instead of new random1 = random(10);

try:

pawn Код:
new Random1 = random(sizeof(RandomCP));



Re: random cp's? - Gh0sT_ - 26.10.2010

nah.. didnt help.


Re: random cp's? - BMGP - 26.10.2010

Quote:
Originally Posted by Gh0sT_
Посмотреть сообщение
im tryied to create random checkpoints, but im getting error. :/


when player enter the car.
I dont know if this is the main error but instead of new Float:RandomCP[][] = it should be

pawn Код:
new Float:RandomCP[4][3] =
{
{1075.9678,2385.3535,11.1081,357.8982},
{1094.9563,2357.5154,10.8203,358.8381},
{1067.7051,2365.5979,17.3643,268.5973},
{1110.4586,2356.1936,10.8203,58.9753}
};
4 -> Rows
3 -> "column"(in this script they are 3 coordinates: X,Y,Z)

And then this code:
pawn Код:
new Random1 = random(sizeof(RandomCP));
SetPlayerCheckpoint(playerid, RandomCP[Random1][0], RandomCP[Random1][1],RandomCP[Random1][2],10);
Tell me if it works :P


Re: random cp's? - MadeMan - 26.10.2010

What error do you get?


Re: random cp's? - Gh0sT_ - 26.10.2010

To BMGP:

error 018: initialization data exceeds declared size

{1075.9678,2385.3535,11.1081,357.8982},

(errors at all enum koordinates line's)


Re: random cp's? - legodude - 26.10.2010

you haverotation in a array with coords for checkpoints wich dont neeed royation


Re: random cp's? - Gh0sT_ - 26.10.2010

what you mean


Re: random cp's? - Gh0sT_ - 26.10.2010

please, help.


Re: random cp's? - MadeMan - 26.10.2010

Quote:
Originally Posted by Gh0sT_
Посмотреть сообщение
im tryied to create random checkpoints, but im getting error. :/


when player enter the car.
What error?