Baseplate Posted August 15, 2011 Share Posted August 15, 2011 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
Headshot4Fun Posted August 15, 2011 Share Posted August 15, 2011 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
Baseplate Posted August 15, 2011 Author Share Posted August 15, 2011 well it respawn but it change the Skin to CJ Skin Link to comment
Headshot4Fun Posted August 15, 2011 Share Posted August 15, 2011 well it respawn but it change the Skin to CJ SkinHmm, then i don't know. Try again with this one, i updated it Link to comment
Baseplate Posted August 15, 2011 Author Share Posted August 15, 2011 Works Fine thanks Headshot can u delete the codes please?? Link to comment
Castillo Posted August 15, 2011 Share Posted August 15, 2011 Turismo, I wouldn't call that fair, this topic could help someone with a similar problem in future. Link to comment
Headshot4Fun Posted August 15, 2011 Share Posted August 15, 2011 Works Fine thanksHeadshot can u delete the codes please?? Why? Let this code be free the way he wanted to be And after all. is just an small code. No one would try to "stole" this. Its easier create a new one with your own configs. Link to comment
Axel Posted August 16, 2011 Share Posted August 16, 2011 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
Baseplate Posted August 16, 2011 Author Share Posted August 16, 2011 Axel...what is that for?? Link to comment
mjau Posted August 16, 2011 Share Posted August 16, 2011 i think it is if you die in lv you spawn at lv hospital and if you die in ls you spawn ls hospital and the same with SF Link to comment
Baseplate Posted August 16, 2011 Author Share Posted August 16, 2011 yea yea it does I just test it Link to comment
Castillo Posted August 16, 2011 Share Posted August 16, 2011 If I'm right, what Axel posted is scripted by JasperNL o_O. 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