nasserdfdd Posted August 16, 2015 Posted August 16, 2015 hi all so why it is not working addEventHandler("onPlayerJoin",root, function( ) if getPlayerTeam = "" then setPlayerTeam (client, "Unemployed") setElementData(client, "Role", "Unemployed") end
HUNGRY:3 Posted August 16, 2015 Posted August 16, 2015 addEventHandler("onPlayerJoin",root, function( ) local empTeam = getTeamFromName("Unemployed") setPlayerTeam (source, empTeam) setElementData(source, "Role", "Unemployed") end
t3wz Posted August 16, 2015 Posted August 16, 2015 This isn't working because client isn't defined, if you go to the onPlayerJoin page on wiki you will see that there is a source, which is the player who joined. you should have used this instead of client. also in line 3, you are checking if getPlayerTeam (a function) is equal to an empty string, this never will true...
anumaz Posted August 17, 2015 Posted August 17, 2015 addEventHandler("onPlayerJoin",root, function() if not getPlayerTeam(source) then local empTeam = getTeamFromName("Unemployed") setPlayerTeam (source, empTeam) setElementData(source, "Role", "Unemployed") end end)
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