Jump to content

Help with spawning


xyz

Recommended Posts

I'm in middle of making a hospital spawn script, but how can I get the respawns from table and spawn the player to the one that is nearest?

local LSH = {2030.03125, -1418.8076171875, 16.9921875} 
local LSMH = {2030.03515625, -1418.8623046875, 16.9921875} 
local hospitals = {LSH, LSMH} 
  
function respawn(player) 
    spawnPlayer() 
    fadeCamera(player, true) 
    setCameraTarget(player, player) 
end 

Link to comment
local Hospitals = 
{ 
    {2030.03125, -1418.8076171875, 16.9921875}, 
    {2030.03515625, -1418.8623046875, 16.9921875}, 
} 
  
  
  
  
function DeathSpawn( thePlayer, Hospitals ) 
    local random = math.random( 1, #Hospitals ) 
    spawnPlayer( 
        thePlayer, 
        Hospitals[random][1], 
        Hospitals[random][2] 
    ) 
end 
  
function respawn(player) 
   fadeCamera ( source, false, 1.0, 255, 0, 0 ) 
    setTimer( DeathSpawn, 3000, 1, source,Hospitals ) 
    setTimer( fadeCamera, 2500, 1, source, true, 0.5 ) 
end 
addEventHandler("onPlayerWasted", root, respawn 

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