SA-MP Forums Archive
Random Position - 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)
+--- Thread: Random Position (/showthread.php?tid=632897)



Random Position - silverms - 21.04.2017

hey I have this
PHP код:
SetPlayerRaceCheckpoint(playerid1, -1643.4783, -2686.901448.20210005.0); 
but I want it to be set in a random location so how can I do it like I define 2 locations and set the race to one of them randomly how?


Re: Random Position - coool - 21.04.2017

PHP код:
new cps[][] = //An array for holding the pos of our cps
{
     {
xyz}, //for first
     
{xyz//for second
};
new 
rand Random(sizeof(cps)); //random the size of cps, in this case 2. And put it in variable rand
SetPlayerRaceCheckpoint(playerid1cps[rand][0], cps[rand][1], cps[rand][2], 0005.0); 



Re: Random Position - silverms - 21.04.2017

now
PHP код:
new tfl[][] =
{
    {-
1643.4783, -2686.901448.2021},
    {-
71.0421, -1159.66261.3745},
    {
2482.3040, -2089.821513.1609}
}; 
on every one of {blabla} I get 3 warnings tag mismatch


Re: Random Position - Toroi - 21.04.2017

Add the float tag to the array

PHP код:
new Float:tfl[][] = 



Re: Random Position - oktokt1 - 21.04.2017

Note:

add 1 more float for Angle.
it will be like
PHP код:
new Float:tfl[][][][] = 

    {-
1643.4783, -2686.901448.2021,Angle}, 
    {-
71.0421, -1159.66261.3745,Angle}, 
    {
2482.3040, -2089.821513.1609,Angle
};
new 
rand Random(sizeof(tfl)); //random the size of tfl, in this case 2. And put it in variable rand 
SetPlayerRaceCheckpoint(playerid1tfl[rand][0], tfl[rand][1], tfl[rand][2], 0005.0);  
SetFacingAngle(playerid,tfl[rand][4]);