Jump to content

[HELP]MTA capture mode


relaxx

Recommended Posts

hi i want make a point based capture system but i dont dont how :D There is some problem etc this script use just one marker but i want use ~15 and the point arent deleting so pls help me :(

 

 

local myMarker = createMarker(-184.63004, 2625.75952, 63.49821, 'cylinder', 2.0, 255, 0, 0, 150)
setElementData (myMarker, "owner", "nil")
local usa = 0
local ussr = 0
local turkey = 0
local germany = 0
function MarkerHit( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" then
        local elementType = getElementType( hitElement )
        outputChatBox( elementType.." inside myMarker", getRootElement(), 255, 255, 0 )
        local playerTeam = getPlayerTeam(hitElement)
        local tname = getTeamName ( playerTeam ) 
        outputChatBox(tname)
        outputChatBox(usa)
        outputChatBox(ussr)
        outputChatBox(turkey)
        outputChatBox(germany)
        local r, g, b
        r, g, b = getTeamColor ( playerTeam )
        if(getElementData(myMarker,"owner") ~= tname)then
        Timer = setTimer ( function ( )
        if(getMarkerColor(myMarker) == getTeamColor ( playerTeam ))then
        outputChatBox("asd")
        end
        if(isPlayerInTeam(hitElement, "usa"))then usa = usa+1 end
        if(isPlayerInTeam(hitElement, "ussr"))then ussr = ussr+1 end
        if(isPlayerInTeam(hitElement, "turkey"))then turkey = turkey+1 end
        if(isPlayerInTeam(hitElement, "germany"))then germany = germany+1 end
        setMarkerColor (myMarker, r, g, b, 255 )  
        outputChatBox ( 'You captured')

        
        end, 2000, 1)
        end
    end
end
addEventHandler( "onMarkerHit", myMarker, MarkerHit )

function markerLeave( leaveElement, matchingDimension )
        if getElementType( leaveElement ) == "player" then
          outputChatBox ("#ff0000You have to stay 20 sec in the marker!", getRootElement(), 255, 255, 255, true)
          if isTimer ( Timer ) then 
          killTimer ( Timer )
          
          end
        end
end

addEventHandler( "onMarkerLeave", myMarker, markerLeave )

function isPlayerInTeam(player, team)
    assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
    assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
    return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end

Edited by relaxx
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...