FuriouZ Posted October 5, 2012 Share Posted October 5, 2012 Hey ! can someone help me with random hospital spawn i have two hospital cordinates 1= 1173.2894287109,-1323.6711425781,15.39380645752,-0 2= 2038.0920410156,-1411.5549316406,17.1640625,-0 lua: addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function spawn(player) repeat until spawnPlayer ( player, 1743.2297363281,-1863.8942871094,13.574516296387,-0, math.random(19,25) ) fadeCamera(player, true) setCameraTarget(player, player) setPlayerTeam (player, nil) end function spawnWasted(player) repeat until spawnPlayer ( player, 1173.2894287109,-1323.6711425781,15.39380645752,-0, math.random(19,25) ) fadeCamera(player, true) setCameraTarget(player, player) setPlayerTeam (player, nil) takePlayerMoney ( player, 150 ) end addEventHandler("onPlayerLogin", root, function() spawn(source) end ) addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source) end ) How i can add here these hospitasl that if i die then spawns me random ? Sorry for my bad english Link to comment
Castillo Posted October 5, 2012 Share Posted October 5, 2012 hospitals = { { 1173.2894287109, -1323.6711425781, 15.39380645752, -0 }, { 2038.0920410156, -1411.5549316406, 17.1640625, -0 } } addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i, player in ipairs ( getElementsByType ( "player" ) ) do spawn ( player ) end end ) function spawn ( player, takeMoney ) local x, y, z, rot = unpack ( hospitals [ math.random ( #hospitals ) ] ) spawnPlayer ( player, x, y, z, rot, math.random ( 19, 25 ) ) fadeCamera ( player, true ) setCameraTarget ( player, player ) setPlayerTeam ( player, nil ) if ( takeMoney ) then takePlayerMoney ( player, 150 ) end end addEventHandler ( "onPlayerLogin", root, function ( ) spawn ( source ) end ) addEventHandler ( "onPlayerWasted", root, function ( ) setTimer ( spawnWasted, 1800, 1, source, true ) end ) Link to comment
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