XxJoexX Posted April 1, 2010 Posted April 1, 2010 Hi i want to add random spawns around LV im a noob to scripting but i want them to be in my GM i have the scripting editor. thanks XxJoexX
karlis Posted April 1, 2010 Posted April 1, 2010 would it be fine if you spawn in some roofs of buildings?
dzek (varez) Posted April 1, 2010 Posted April 1, 2010 search, there was topic about it few weeks ago
Jason_Gregory Posted April 1, 2010 Posted April 1, 2010 Hi Joeyx, spawnTable = { { 2000.000, 2000.000, 100.00, 121.0312}, { 2000.000, 2000.000, 100.00, 121.0312 }, { 2000.000, 2000.000, 100.00, 121.0312 }, { 2000.000, 2000.000, 100.00, 121.0312 }, { 2000.000, 2000.000, 100.00, 121.0312 } } -- X, Y, Z, Rotation X function spawn( player ) randomspawn = math.random( 1, #spawnTable) spawnPlayer( player, spawnTable [randomspawn][1], spawnTable [randomspawn][2], spawnTable [randomspawn][3], spawnTable [randomspawn][4] ) end
karlis Posted April 1, 2010 Posted April 1, 2010 (edited) varez, not rly, he wants total random, not random between few spawns.anyway i made quick example an i hope you dont mind its clientside: --client lvbounds={ x1=1000, x2=2800, y1=600, y2=2800} addEventHandler("onClientPlayerWasted",getRootElement(),function() if source~=getLocalPlayer() then return end repeat x,y=math.random(lvbounds[x1],lvbounds[x2]),math.random(lvbounds[y1],lvbounds[y2]) fadeCamera(false,0) setElementPosition(source,x,y,10) height=getGroundPosition (x,y,300) until height<30 and height>1 triggerServerEvent("spawn",getLocalPlayer(),x,y,height) end) --server addEvent("spawn",true) addEventHandler("spawn",getRootElement(),function(x,y,z) setTimer(function() spawnPlayer(source,x,y,z) fadeCamera(source,true) end,3000,1) end) Edited April 2, 2010 by Guest
Jason_Gregory Posted April 1, 2010 Posted April 1, 2010 The Height of the Current Spawn Position ? He needs to save it, thats just a Example for starting He only asked for random Spawn atm... But yes its a nice Idea getting the Grounds Position before spawning.
XxJoexX Posted April 1, 2010 Author Posted April 1, 2010 Thanks For all your help guys ! So do i just past all that mumbo-jumbo in to my GM ? with mta script editor ?
karlis Posted April 1, 2010 Posted April 1, 2010 watch clientside and serverside tags before, and put them in separated script files
Dark Dragon Posted April 2, 2010 Posted April 2, 2010 getGroundPosition doesn't work outside the streaming range
karlis Posted April 2, 2010 Posted April 2, 2010 ohh forgot that, ill edit that snippet edit:fixed it, not wit will fade screen, go to stream range, get ground pos, and spawn then
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now