SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/04/2017, 04:54 PM   #1
silverms
Huge Clucker
 
Join Date: Sep 2016
Location: USA
Posts: 207
Reputation: 5
Default Random Position

hey I have this
PHP Code:
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?
__________________
silverms is offline   Reply With Quote
Old 21/04/2017, 05:02 PM   #2
coool
Huge Clucker
 
Join Date: Feb 2013
Location: Pakistan, Sindh
Posts: 396
Reputation: 20
Default Re: Random Position

PHP Code:
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); 
__________________
SCRIPTING ON LOW RATES

My Writing Works
Lost In Future


Code:
Every thing in the world either a potato or not a potato
coool is offline   Reply With Quote
Old 21/04/2017, 05:32 PM   #3
silverms
Huge Clucker
 
Join Date: Sep 2016
Location: USA
Posts: 207
Reputation: 5
Default Re: Random Position

now
PHP Code:
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
__________________
silverms is offline   Reply With Quote
Old 21/04/2017, 06:19 PM   #4
Toroi
Gangsta
 
Toroi's Avatar
 
Join Date: Feb 2017
Location: Venezuela
Posts: 753
Reputation: 133
Default Re: Random Position

Add the float tag to the array

PHP Code:
new Float:tfl[][] = 
__________________
Scripting Help in a nutshell

Quote:
Originally Posted by Thanks View Post
So.. hey everyone im trying to searching at google how to make leaderboard with Textdraws so i find many but Not in my brain...
Toroi is online now   Reply With Quote
Old 21/04/2017, 08:39 PM   #5
oktokt1
Big Clucker
 
oktokt1's Avatar
 
Join Date: Jan 2016
Location: Egypt, Cairo
Posts: 160
Reputation: 14
Default Re: Random Position

Note:

add 1 more float for Angle.
it will be like
PHP Code:
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]); 
__________________

Mapping.
--------------------
Learning Scripting.
Helping Newbies Mappers.

Last edited by oktokt1; 21/04/2017 at 10:06 PM.
oktokt1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Random position around player GoldenLion Scripting Help 2 19/03/2017 02:05 PM
Random Position OneITWiz Scripting Help 3 24/04/2014 01:52 PM
Random set position ragu1987 Scripting Help 2 20/10/2013 01:30 PM
RANDOM POSITION ?? park4bmx Scripting Help 8 24/11/2012 07:12 PM
Random Position ? park4bmx Help Archive 3 25/02/2011 04:04 PM


All times are GMT. The time now is 06:52 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.