Jump to content

Hi i whant to make random spawns ?


XxJoexX

Recommended Posts

Posted

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 :cry:

Posted

search, there was topic about it few weeks ago

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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

Stats_Signature.php?name=Jason_Gregory
Contact me if you need a Website / Signature ↑ / Mapuploadsystem

(HTML5, JS, PHP, ASP.NET, MySQL / Sybase)

Posted (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 by Guest
Posted

The Height of the Current Spawn Position ?

He needs to save it, thats just a Example for starting :roll:

He only asked for random Spawn atm...

But yes its a nice Idea getting the Grounds Position before spawning.

Stats_Signature.php?name=Jason_Gregory
Contact me if you need a Website / Signature ↑ / Mapuploadsystem

(HTML5, JS, PHP, ASP.NET, MySQL / Sybase)

Posted

he didnt tell it exactly ;)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...