Jump to content

Help respawn players


MatiasRuff

Recommended Posts

Uhm.. I guess you want to make it like.. after a player dies he can spawn at a hospital or something, try this:

  
function spawnOnDeath( ) 
    outputChatBox("You died, wait 10 seconds until you respawn at the Hospital", source, 255, 255, 0) -- send the notification 
    setTimer(function() -- set the timer for spawning 
        cost = math.random(100, 300) -- cost could be anything from 100 to 300 
         
        spawnPlayer(source, 1187.5576171875, -1326.41015625, 13.559711456299, 271, getElementModel(source), 0, 0, getPlayerTeam" class="kw2">getPlayerTeam(source)) -- spawn the player at LS Hospital 
        outputChatBox("The Doctors have treated you, be careful next time. Treatment Cost: ".. tonumber(cost) .. "$", source, 255, 255, 0) -- Money has been taken 
        takePlayerMoney(source, tonumber(cost)) -- take the money 
    end, 10000, 1)   
end 
addEventHandler("onPlayerWasted", getRootElement(), spawnOnDeath) 
  

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