Jump to content

can any one help as fast as possible in simple script


nasserdfdd

Recommended Posts

Posted

hi all so why it is not working

addEventHandler("onPlayerJoin",root, 
function( ) 
if getPlayerTeam = "" then 
setPlayerTeam (client, "Unemployed") 
setElementData(client, "Role", "Unemployed") 
end 

Posted
addEventHandler("onPlayerJoin",root, 
function( ) 
local empTeam = getTeamFromName("Unemployed") 
setPlayerTeam (source, empTeam) 
setElementData(source, "Role", "Unemployed") 
end 
  

Posted

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

Posted
addEventHandler("onPlayerJoin",root, 
function() 
if not getPlayerTeam(source) then 
local empTeam = getTeamFromName("Unemployed") 
setPlayerTeam (source, empTeam) 
setElementData(source, "Role", "Unemployed") 
end 
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...