Jump to content

Hi i whant to make random spawns ?


XxJoexX

Recommended Posts

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

Link to comment

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
Link to comment

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...