Alazam Posted February 2, 2014 Share 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 Link to comment
Spajk Posted February 2, 2014 Share Posted February 2, 2014 "selection" isn't defined. Link to comment
Alazam Posted February 2, 2014 Author Share 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? Link to comment
Moderators IIYAMA Posted February 4, 2014 Moderators Share Posted February 4, 2014 "selection" 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