Jump to content

Resource to start and stop markers and


Zokan

Recommended Posts

I have it so, but it does not work

marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) 
  
  
function startTheResource ( thePlayer, command, resourceName ) 
    if ( mil_protection ) then 
        local resource = getResourceFromName ( resourceName ) 
        local start = startResource ( mil_protection ) 
    end 
end 
addEventHandler ( "onMarkerHit", marker, startTheResource ) 

Link to comment
I have it so, but it does not work

Its completely wrong.You mixing onResourceStart arguments with onMarkerHit.

What resouce you want to start.If its just one then

marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) 
  
  
function startTheResource () 
    resourceName = "mil_protection" 
      local resource = getResourceFromName ( resourceName ) 
      local start = startResource ( resource ) 
end 
addEventHandler ( "onMarkerHit", marker, startTheResource ) 

Link to comment

I've tried it so. Please corrected me when something is wrong'm still new and do not understand how true ...

Script:

marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) 
  
toxogletb = 0 
  
function tooglelstart( pla ) 
          if getElementType ( pla ) == "player" then 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then 
    if (toxogletb == 0) then 
        if ( mil_protection ) then 
            local resource = getResourceFromName ( mil_protection ) 
            local start = startResource ( mil_protection ) 
    elseif (toxogletb == 1) then 
          stopResource(mil_protection) 
end 
end 
end 
end 
addEventHandler ("onMarkerHit", marker, tooglelstart) 

Link to comment

Like that?

  
marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) 
toxogletb = 0 
  
addEventHandler("onMarkerHit", getRootElement(), 
function(markerHit) 
    local resource = getResoruceFromName("mil_protection") -- Resource to stop 
    if(source == marker)then 
        if (getElementType(markerHit) == "player")then 
            if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(markerHit)), aclGetGroup ( "Admin" ) ) then 
                if (toxogletb == 0) then 
                    startResource (resource) 
                elseif (toxogletb == 1) then 
                    stopResource (resource) 
                end 
            end 
        end 
    end 
end) 
  

Link to comment
No it not work it come an error message:

ERROR: test/test:28: attempt to ca

ll global 'getResoruceFromName' (a nil value)

Epic fail... :mrgreen: Sorry

Remplace "getResoruceFromName" per "getResourceFromName" :|

  
marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) 
toxogletb = 0 
  
addEventHandler("onMarkerHit", getRootElement(), 
function(markerHit) 
    local resource = getResourceFromName("mil_protection") -- Resource to stop 
    if(source == marker)then 
        if (getElementType(markerHit) == "player")then 
            if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(markerHit)), aclGetGroup ( "Admin" ) ) then 
                if (toxogletb == 0) then 
                    startResource (resource) 
                elseif (toxogletb == 1) then 
                    stopResource (resource) 
                end 
            end 
        end 
    end 
end) 
  

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...