Jump to content

Guys please help me


Baseplate

Recommended Posts

when I join the server I join at the X,Y,Z Positions below

but if I die I don't respawn can u guys help me I want him to respawn at hospital

here is the code

function joinHandler() 
    local x = 1959.55 
    local y = -1714.46 
    local z = 10 
    spawnPlayer(source, x, y, z) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox("Welcome to My Server", source) 
end 
addEventHandler("onPlayerJoin", getRootElement(), joinHandler) 

Link to comment

Well mate, here we go:

addEventHandler( "onPlayerWasted", getRootElement( ), 
    function() 
  
         local hX = 1190 
         local hY = -1322 
         local hZ = 14 
  
  
        fadeCamera(source,false) 
        setTimer( spawnPlayer, 2000, 1, source, hX+math.random(0,3), hY+math.random(0,3), hZ, -90, getElementModel(source),0,0,nil ) 
        setTimer(fadeCamera, 2000,1,source,true) 
  
    end 
) 

Now you just replace the hX, hY and hZ variables with the X,Y,Z world locations of the hospital. If you get any error post the /debugscript 3

Edit: Now with positions.

Oh, and remember, thats a CONTINUATION of the code, to spawn after JOIN you need to use the code you posted, and to spawn after DEAD this one above.

Link to comment
function joinHandler() 
local x = 1959.55 
local y = -1714.46 
local z = 10 
spawnPlayer(source, x, y, z) 
fadeCamera(source, true) 
setCameraTarget(source, source) 
outputChatBox("Welcome to My Server", source) 
end 
addEventHandler("onPlayerJoin", getRootElement(), joinHandler) 
  
addEventHandler ("onPlayerWasted",getRootElement(), 
  
function(totalammo,killer,killerweapon,bodypart,stealth) 
  
if getElementData(source,"account") ~= "none" then 
  local x,y,z = getElementPosition (source) 
  
  local sf = getDistanceBetweenPoints3D (x,y,z,-2655.16,639.467,14.4545) 
  
  local lv = getDistanceBetweenPoints3D (x,y,z,1607.23,1816.24,10.82) 
  
  local ls = getDistanceBetweenPoints3D (x,y,z,2035.995,-1403.73,17.27) 
  
  if (sf < lv) then 
  
    if (sf < ls) then 
  
      setTimer (fadeCamera,1000,1,source,false,2.5) setTimer (spawnPlayer,3500,1,source,-2655.16,639.467,14.4545,0,getElementModel (source),0,0,nil) setTimer (fadeCamera,4000,1,source,true,1.0) 
  
    else 
  
      setTimer (fadeCamera,1000,1,source,false,2.5) setTimer (spawnPlayer,3500,1,source,2035.995,-1403.73,17.27,0,getElementModel (source),0,0,nil) setTimer (fadeCamera,4000,1,source,true,1.0) 
  
    end 
  
  else 
  
    if (lv < ls) then 
  
      setTimer (fadeCamera,1000,1,source,false,2.5) setTimer (spawnPlayer,3500,1,source,1607.23,1816.24,10.82,0,getElementModel (source),0,0,nil) setTimer (fadeCamera,4000,1,source,true,1.0) 
  
    else 
  
      setTimer (fadeCamera,1000,1,source,false,2.5) setTimer (spawnPlayer,3500,1,source,2035.995,-1403.73,17.27,0,getElementModel (source),0,0,nil) setTimer (fadeCamera,4000,1,source,true,1.0) 
  
    end 
  
  end 
  
end 
end) 

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