Jump to content

WHy this script not start working when player join? always need to restart script.


Viudes

Recommended Posts

Posted
local connectedPlayers = getElementsByType ( "player" )
for i, aPlayer in ipairs(connectedPlayers) do
	bindKey ( aPlayer, "x", "down",SuperStop)
end

WHy this script not start working when player join? always need to restart script. 

Posted

Your code only binds the key to every connected player at the time of starting the script. You also need to add the following event handler:

addEventHandler("onPlayerJoin", root, 
  function()
    bindKey(source, "x", "down", SuperStop)
  end
)

 

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