Alazam Posted February 4, 2014 Share Posted February 4, 2014 Hello i have a little problem i want to create a team when the ressource start and all player who join the server go in this team function joinHandler() local spawn = getElementsByType("spawnpoint", mapRoot) local x,y,z,r for key, value in pairs(spawn) do x = getElementData(value, "posX") y = getElementData(value, "posY") z = getElementData(value, "posZ") r = getElementData(value, "rot") end spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Connected", source) setPlayerTeam ( source, team ) end function teamselect () createTeam ( team, 0, 0, 0 ) end addEventHandler("onGamemodeMapStart", getRootElement(), teamselect) Please i need some help Link to comment
xeon17 Posted February 4, 2014 Share Posted February 4, 2014 You mean something like this ? local team = createTeam("team", 0, 0, 0) function Jointeam(player) setPlayerTeam(player, team outputChatBox("Connected", player, 0, 0, 0, true) end end addEventHandler("onPlayerJoin", getRootElement(), jointeam) Link to comment
Alazam Posted February 4, 2014 Author Share Posted February 4, 2014 Thank but why write local team ? Link to comment
Gallardo9944 Posted February 4, 2014 Share Posted February 4, 2014 local variables can't be accessed from the outside of the file, that means they're local, so it results into a faster access (it doesn't have to be looped through _G to be found). 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