FlyingSpoon Posted April 24, 2015 Share Posted April 24, 2015 - - CLIENT-SIDE addEventHandler("onClientPlayerWasted", getRootElement(), function () if source == localPlayer then spawnSystem() setElementHealth ( localPlayer, 100 ) triggerServerEvent ( "on.death", localPlayer ) end end) SERVER-SIDE function onPlayerDeath() takeAllWeapons ( source ) end addEvent("on.death", true) addEventHandler("on.death", getRootElement(), onPlayerDeath)) When I spawn as a new character, my health is still 0 and I am basically dead, why? Link to comment
WhoAmI Posted April 24, 2015 Share Posted April 24, 2015 Move setElementHealth to s-side. Link to comment
FlyingSpoon Posted April 24, 2015 Author Share Posted April 24, 2015 Nothing still happens. Link to comment
Walid Posted April 24, 2015 Share Posted April 24, 2015 Nothing still happens. You need to use i think you are trying to use setElementPosition() spawnPlayer ( ) Link to comment
FlyingSpoon Posted April 24, 2015 Author Share Posted April 24, 2015 Well I changed it a little, CLIENT-SIDE function spawnSystem() --- addEvent("openGUI", true) addEventHandler("openGUI", getRootElement(), spawnSystem) SERVER-SIDE function onDeath() triggerClientEvent(source, "openGUI", source) takeAllWeapons ( source ) end addEventHandler("onPlayerWasted", getRootElement(), onDeath) Doesn't open GUI when I died? Link to comment
WhoAmI Posted April 24, 2015 Share Posted April 24, 2015 function onDeath() triggerClientEvent(source, "openGUI", source) takeAllWeapons ( source ) setElementHealth ( source, 100 ) end addEventHandler("onPlayerWasted", getRootElement(), onDeath) Link to comment
FlyingSpoon Posted April 24, 2015 Author Share Posted April 24, 2015 Still doesn't open GUI. Link to comment
Walid Posted April 24, 2015 Share Posted April 24, 2015 Still doesn't open GUI. Post your code here Link to comment
FlyingSpoon Posted April 24, 2015 Author Share Posted April 24, 2015 CLIENT-SIDE function spawnSystem() --- addEvent("openGUI", true) addEventHandler("openGUI", getRootElement(), spawnSystem) SERVER-SIDE function onDeath() triggerClientEvent(source, "openGUI", source) takeAllWeapons ( source ) end addEventHandler("onPlayerWasted", getRootElement(), onDeath) Link to comment
Dimos7 Posted April 24, 2015 Share Posted April 24, 2015 CLIENT-SIDE function spawnSystem() --- addEvent("openGUI", true) addEventHandler("openGUI", getRootElement(), spawnSystem) SERVER-SIDE function onDeath() triggerClientEvent(source, "openGUI", getRootElement()) takeAllWeapons (source) end addEventHandler("onPlayerWasted", getRootElement(), onDeath) Link to comment
Enargy, Posted April 24, 2015 Share Posted April 24, 2015 as Walid told you, do you find this? --SERVER function onDeath() local my_position = {getElementPosition( source )}; local playerSpawn = setTimer(spawnPlayer, 2000, 1, source, unpack(my_position) ); if playerSpawn then triggerClientEvent(source, "openGUI", source); takeAllWeapons ( source ); end end addEventHandler("onPlayerWasted", getRootElement(), onDeath) -- CLIENT function spawnSystem() outputChatBox("I am respawning") end addEvent("openGUI", true) addEventHandler("openGUI", getRootElement(), spawnSystem) otherwise I tried your code with outputs and it works perfectly. i don't know but it might be your spawnSystem function Link to comment
Walid Posted April 25, 2015 Share Posted April 25, 2015 Guys i already helped him via PM . @raysmta next time try to write resolved ; fixed something like that. 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