anufis_ok Posted June 1, 2018 Posted June 1, 2018 Help, what's wrong with the code? After the death of the player should be 1 hp. Quote function playerDied(killer, weapon, bodypart) setElementHealth(player, getElementHealth(player) - 99 ) end addEventHandler( "onClientPlayerSpawn", getLocalPlayer(), playerDied )
1LoL1 Posted June 1, 2018 Posted June 1, 2018 (edited) addEventHandler("onClientPlayerSpawn", getLocalPlayer(), function() setElementHealth(source, getElementHealth(source) - 99) end) Edited June 1, 2018 by 1LoL1
Skully Posted June 1, 2018 Posted June 1, 2018 You can simplify it down even further. addEventHandler("onClientPlayerSpawn", localPlayer, function() setElementHealth(source, 1) end)
anufis_ok Posted June 2, 2018 Author Posted June 2, 2018 input:1: attempt to call a nil value (global 'addEventHandler')
Z4Zy Posted June 2, 2018 Posted June 2, 2018 (edited) 1 hour ago, anufis_ok said: input:1: attempt to call a nil value (global 'addEventHandler') Did you add the above code, 8 hours ago, Skully said: addEventHandler("onClientPlayerSpawn", localPlayer, function() setElementHealth(source, 1) end) to the client side in meta.xml ?? Edited June 2, 2018 by DeadthStrock
anufis_ok Posted June 2, 2018 Author Posted June 2, 2018 <meta> <script src="dead.lua" type="server" /> </meta> I understood what the problem was. It was necessary to deliver (client) instead of (server)
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