Kenix Posted October 23, 2011 Share Posted October 23, 2011 (edited) So i need check if all players in team Survivors in marker but it not work debug says nothing . teamSurvivor = createTeam ( "Survivors", 0, 255, 0 ) setTeamFriendlyFire(teamSurvivor, false ) addEventHandler("onGamemodeMapStart", root, function( startedMap ) local Spawnpoint = getElementsByType ("spawnpoint") local random = math.random ( 1, #Spawnpoint ) local posX = getElementData(Spawnpoint[random], "posX") local posY = getElementData(Spawnpoint[random], "posY") local posZ = getElementData(Spawnpoint[random], "posZ") local rot = getElementData(Spawnpoint[random], "rot") or getElementData(Spawnpoint[random], "rotZ") or 0 for i,v in ipairs(getElementsByType("player"))do if not (getElementData(v,"Status") == "Joined") then setElementData( v,"showHud","y") setElementData( v,"Status","Playing") spawnPlayer ( v, posX, posY, posZ, rot, getElementData(v,"skin") ) setCameraTarget( v ) setPlayerTeam( v,teamSurvivor) setAllData( v,"showZombieWon","n") setAllData( v,"showSurvivorsWonPassing","n") dropStats( v ) end end local allPlayersInMarker = false local lastmarker = nil local marker = nil local mapRoot = getResourceRootElement(startedMap) local Final_Marker = getElementsByType ("Final_marker",mapRoot) for i,v in ipairs(Final_Marker) do local r,g,b,a = getColorFromString ( tostring(getElementData( v,"color")) ) marker = createMarker( tonumber(getElementData(v,"posX")), tonumber(getElementData(v,"posY")), tonumber(getElementData(v,"posZ")), "cylinder", tonumber(getElementData(v,"size")), r, g, b, a ) lastmarker = v end addEventHandler("onMarkerHit",root, function( player, dim ) if isTimer( CheckPlayersInMarker ) then killTimer( CheckPlayersInMarker ) end CheckPlayersInMarker = setTimer( function ( player,marker,source,lastmarker ) if isElement( player ) and getElementType( player ) == "player" then if source ~= marker then return end for i,v in pairs( getPlayersInTeam( getTeamFromName ( "Survivors" ) ) ) do if isElementWithinMarker ( v, marker ) then -- all players in marker destroyElement( source ) Endgame(true) --------- achievement --------------- setElementData( v,"achm3","y") end end end end,1000,0,player,marker,source,lastmarker ) end ) end ) Help guys Edited October 23, 2011 by Guest 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