SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/07/2010, 12:11 PM   #11
FUNExtreme
Gangsta
 
Join Date: Mar 2008
Posts: 792
Reputation: 128
Default Re: Random spawns

@the 2 posts above:
Adding spawns in your method will take much more time then adding them in my method.
+ it will also be a much longer code.

Thanks for the comments!!
FUNExtreme is offline   Reply With Quote
Old 11/08/2010, 05:49 PM   #12
pmk1
Huge Clucker
 
pmk1's Avatar
 
Join Date: Jan 2010
Posts: 351
Reputation: 1
Default Re: Random spawns

nice tut

Last edited by pmk1; 02/01/2012 at 09:47 PM.
pmk1 is offline   Reply With Quote
Old 13/08/2010, 03:31 PM   #13
Min
Big Clucker
 
Min's Avatar
 
Join Date: Jul 2010
Location: \_(o_o)_/
Posts: 106
Reputation: 22
Default Re: Random spawns

Nice,its useful
Min is offline   Reply With Quote
Old 13/08/2010, 10:34 PM   #14
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,802
Reputation: 1160
Default Re: Random spawns

Nice tut! great for noobs
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 23/08/2010, 09:10 AM   #15
AiVAMAN
Gangsta
 
AiVAMAN's Avatar
 
Join Date: Sep 2008
Location: Lietuva
Posts: 540
Reputation: 0
Default Re: Random spawns

You should replace "C:\Program Files\Rockstar Games\GTA San Andreas\savedpositions.txt" to "My Documents\GTA San Andreas User Files\SAMP\savedpositions.txt" because since 03b it has changed. (:
AiVAMAN is offline   Reply With Quote
Old 16/10/2010, 08:13 PM   #16
FUNExtreme
Gangsta
 
Join Date: Mar 2008
Posts: 792
Reputation: 128
Default Re: Random spawns

UPDATE:

- Changed the coordinates saving location
- Made a small adjustement too the spawning code. Replaced 5 with sizeof(RandomSpawns)

Last edited by FUNExtreme; 02/01/2011 at 05:34 PM.
FUNExtreme is offline   Reply With Quote
Old 17/10/2010, 08:00 AM   #17
Aleluja
Big Clucker
 
Join Date: Jul 2010
Location: Croatia
Posts: 98
Reputation: 0
Default Re: Random spawns

Nice work! This will help new scripters
Aleluja is offline   Reply With Quote
Old 02/01/2011, 05:31 PM   #18
Hudgens
Big Clucker
 
Hudgens's Avatar
 
Join Date: Jul 2010
Posts: 189
Reputation: 7
Default Re: Random spawns

Sorry for the bump but...when Im trying to compile I get this error and I did exactly as you explained.

Code:
TDM.pwn(516) : error 017: undefined symbol "RandomPlayerSpawns"
TDM.pwn(516) : error 029: invalid expression, assumed zero
TDM.pwn(516) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB
My code (from what you explained)

This is outside any function.
Code:
new Float:RandomSpawns[][] =
{
    {2319.2280,-1651.7455,14.1590,143.4542}, // Randomspawngrove
    {2175.5120,-1672.8800,16.5499,116.5022}, // Randomspawnballas
    {1920.5571,-1401.1272,13.5703,302.2050}, // Randomspawnskatepark
    {2005.1017,-2437.9197,13.5469,358.3744}, // Randomspawnlsair
    {-2302.4067,-1654.1744,483.4206,295.6445}, // Randomspawnchilliad
    (1695.7886,-2133.8210,144.4791,340.6445), //Randomspawnbigjump
    (1240.2787,-2951.0051,193.1163,340.6445) //Randomspawnstuntjump
};
And OnPlayerSpawn
Code:
public OnPlayerSpawn(playerid)
{
((this is line 516))new Random = random(sizeof(RandomPlayerSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
    return 1;
}
??
__________________


Join Hostile Core today and experience one of the most unique SA-MP servers running.
Hostile Core Website
213.5.176.156:7779
Hudgens is offline   Reply With Quote
Old 02/01/2011, 05:33 PM   #19
FUNExtreme
Gangsta
 
Join Date: Mar 2008
Posts: 792
Reputation: 128
Default Re: Random spawns

Your float is defined as "RandomSpawns"
but in the random you use "RandomPlayerSpawns"

pawn Code:
new Random = random(sizeof(RandomSpawns));


I updated the tutorial

Last edited by FUNExtreme; 02/01/2011 at 05:36 PM. Reason: Added fixed code
FUNExtreme is offline   Reply With Quote
Old 02/01/2011, 05:40 PM   #20
Hudgens
Big Clucker
 
Hudgens's Avatar
 
Join Date: Jul 2010
Posts: 189
Reputation: 7
Default Re: Random spawns

Lol I didn't see that , thank you.

Btw hell'of a fast response for a 2 month old thread lmfao!
__________________


Join Hostile Core today and experience one of the most unique SA-MP servers running.
Hostile Core Website
213.5.176.156:7779
Hudgens 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



All times are GMT. The time now is 08:33 PM.


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