VenomOG Posted February 19, 2018 Share Posted February 19, 2018 Any help that if player leaves the zone it will stop capturing and remove %? or if another team enters it , it stop captures and removes % Spoiler [/code] local Tufrs = { } local TufrsPos = { { -2629.1337890625, 2250.6875, 250, 250, "Terrorists,Government" , 10000 }, { 2496.23046875, 2687.404296875, 215, 215, "Terrorists,Government" , 10000 }, { -600.02734375, -2121.4833984375, 300, 300, "Terrorists,Government" , 10000 }, { 2566.3857421875, -2574.5048828125, 200, 200, "Terrorists,Government" , 10000 }, --{ X, Y, H, W, Team , Money }, } addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i, v in ipairs(TufrsPos) do local ColShape = createColRectangle(v[1], v[2], v[3], v[4]) local Team = getTeamFromName(v[5]) local TeamName = "N/A" local R, G, B = 255, 000, 000 if Team then R, G, B = getTeamColor(Team) TeamName = getTeamName(Team) end Tufrs[ColShape] = { Radar = createRadarArea(v[1], v[2], v[3], v[4] , R, G, B, 180) , TeamName = TeamName , occupier = 100 , Money = v[6] , } end end ) addEventHandler("onMouseEnter",root, function(mouse) if source == BTN.Open then guiSetAlpha(BTN.Open,0.80) end end ) addEventHandler("onMouseLeave",root, function(Leave) if source == BTN.Open then guiSetAlpha(BTN.Open,1) end end ) function getColPlayerTeam (Col, Team) for i, pla in pairs(getElementsWithinColShape(Col, "player")) do if getPlayerTeam(pla) and getPlayerTeam(pla) ~= getTeamFromName("Criminals") and getTeamName(getPlayerTeam(pla)) == getTeamName(Team) then return true else exports.NGMessages:sendClientMessage( "~Warning : You must kill the other team members in the zone~",pla ,232 ,0 ,0 ) return false end end return false end function getTeamTufrs(Team) local Tufr = { } for Col, v in pairs(Tufrs) do if v.TeamName == getTeamName(Team) then table.insert( Tufr, Col ) end end return Tufr end addEventHandler("onColShapeHit",root, function(pla) local Rader = Tufrs[source] if ( Rader ) then setElementData(pla, "TeamTufrs",Rader ) end end) addEventHandler("onColShapeLeave",root, function(pla) setElementData(pla, "TeamTufrs",false ) end) setTimer (function ( ) for Col, v in pairs(Tufrs) do for i, pla in pairs(getElementsWithinColShape(Col, "player")) do local Team = getPlayerTeam ( pla ) if Team and getColPlayerTeam (Col, Team) then if getTeamName(Team) ~= Tufrs[Col].TeamName then if Tufrs[ Col ].occupier > 1 then Tufrs[ Col ].occupier = Tufrs[ Col ].occupier - 1 setRadarAreaFlashing ( Tufrs[ Col ].Radar, true ) elseif Tufrs[ Col ].occupier == 1 then local r, g, b = getTeamColor ( getPlayerTeam ( pla ) ) setRadarAreaFlashing ( Tufrs[ Col ].Radar, false ) setRadarAreaColor ( Tufrs[ Col ].Radar, r, g, b, 150 ) Tufrs[ Col ].TeamName = getTeamName(Team) Tufrs[ Col ].occupier = 100 exports.NGMessages:sendClientMessage( "~Your Team now controls the turf~",pla ,0 ,255 ,0 ) for i, player in ipairs(getPlayersInTeam( Team )) do local Money = Tufrs[ Col ].Money exports.NGMessages:sendClientMessage("You won ~$~"..Money, player, 0, 255, 0) setElementData(player, "Money", getElementData(player, "Money") + Money) end end else if Tufrs[ Col ].occupier < 99 then Tufrs[ Col ].occupier = Tufrs[ Col ].occupier + 1 elseif Tufrs[ Col ].occupier == 99 then local r, g, b = getTeamColor ( getPlayerTeam ( pla ) ) setRadarAreaFlashing ( Tufrs[ Col ].Radar, false ) setRadarAreaColor ( Tufrs[ Col ].Radar, r, g, b, 150 ) Tufrs[ Col ].TeamName = getTeamName(Team) Tufrs[ Col ].occupier = 100 end end end setElementData(pla, "TeamTufrs",Tufrs[Col] ) end end end,5000, 0)[/code] 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