Alazam Posted February 2, 2014 Posted February 2, 2014 hello i have a little probleme i have test to create a team and attribute to player when they connect function loadMap(startedMap) mapRoot = getResourceRootElement(startedMap) end addEventHandler("onGamemodeMapStart", getRootElement(), loadMap) 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("Connecter", source) setPlayerTeam ( source, selection ) end function teamselect () createTeam ( selection, 0, 0, 0 ) end addEventHandler("onGamemodeMapStart", getRootElement(), teamselect) Thank for help
Alazam Posted February 2, 2014 Author Posted February 2, 2014 And how ? 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("Connecter", source) setPlayerTeam ( source, selection ) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) normally with that all player who join go to the team created in function teamselect () createTeam ( selection, 0, 0, 0 ) end addEventHandler("onGamemodeMapStart", getRootElement(), teamselect) no?
Moderators IIYAMA Posted February 4, 2014 Moderators Posted February 4, 2014 "selection" Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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