Random Position
#1

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?
Reply
#2

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); 
Reply
#3

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
Reply
#4

Add the float tag to the array

PHP код:
new Float:tfl[][] = 
Reply
#5

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]); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)