Soapbosnia Posted May 5, 2018 Share Posted May 5, 2018 WARNING:Wasted/server.lua:5:Bad argument "addEventHandler" [Expected element at argument 2,got nil]. The code: function respawnOnWasted () spawnPlayer (source, 0, 0, 5, 0, math.random (0,288), 0, 0) end addEventHandler( "onPlayerWasted", thePlayer, function() bindKey ( player, "F", "both", respawnOnWasted ) end ) Link to comment
LilDawage Posted May 5, 2018 Share Posted May 5, 2018 8 minutes ago, Soapbosnia said: WARNING:Wasted/server.lua:5:Bad argument "addEventHandler" [Expected element at argument 2,got nil]. The code: function respawnOnWasted () spawnPlayer (source, 0, 0, 5, 0, math.random (0,288), 0, 0) end addEventHandler( "onPlayerWasted", thePlayer, function() bindKey ( thePlayer, "F", "both", respawnOnWasted ) end ) Link to comment
Moderators Patrick Posted May 5, 2018 Moderators Share Posted May 5, 2018 -- SERVER SIDE function respawnOnWasted(player) spawnPlayer(player, 0, 0, 5, 0, math.random (0,288), 0, 0) unbindKey(player, "F", "both", respawnOnWasted) end addEventHandler("onPlayerWasted", getRootElement(), function() bindKey(source, "F", "both", respawnOnWasted) end) 1 Link to comment
Soapbosnia Posted May 5, 2018 Author Share Posted May 5, 2018 @Patrick2562Thank you so much bro it works <3 Link to comment
Moderators Patrick Posted May 6, 2018 Moderators Share Posted May 6, 2018 You are welcome! Link to comment
Hoffmann Posted May 6, 2018 Share Posted May 6, 2018 (edited) Your code doesn't work because you used unknown "thePlayer" element instead of passing getRootElement which literally means "all players". Passing "thePlayer" instead of "source" in the bindKey function also causes errors. Edited May 6, 2018 by NeverUnbeatable 1 Link to comment
Soapbosnia Posted May 6, 2018 Author Share Posted May 6, 2018 @NeverUnbeatableOk thanks,il keep that in mind 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