Jump to content

[Help] Turfing


damien111

Recommended Posts

I need help with getting this to work, there will probally be more questions after this on this topic, okay, so right now , the problem is that i get a debug error when i try to get the teamcolor..Im not sure why, as it is all defined, any ideas?

    local pArea     = createRadarArea( -1442.904296875, -971.251953125, 100, 100, 0, 0, 0, 125 ) 
    local pCuboid   = createColRectangle( -1442.904296875, -971.251953125, 100, 100 ) 
    BigSmokes = createTeam("Nazis", 255, 0, 255) 
addEventHandler("onResourceStart",resourceRoot,function() 
end ) 
      
            addEventHandler('onColShapeHit', root, 
                function( p ) -- you should have added player param here 
                local pTeam = getPlayerTeam( p )     
                local iR, iG, iB = getTeamColor( pTeam ) 
                local rR, rG, rB = getRadarAreaColor ( pArea ) 
                    if (getPlayerTeam( p )) then 
                      if( source == pCuboid ) then 
                        if ( iR == rR and iG == rG and iB == rB ) then 
                         
                        else 
                        if(getElementData( aCuboid, "TurfInProgress" )) then 
                         
                        else 
                        setRadarAreaFlashing ( aArea, true ) 
                setElementData( aCuboid, "TurfInProgress", true ) 
                 
                   wave1 = setTimer( 
                   function() 
                   setElementData( aCuboid, "TurfInProgress", false ) 
                   setRadarAreaColor ( aArea, tR, tG, tB, 125 ) 
                   setRadarAreaFlashing ( aArea, false) 
                   country = getElementData( p, "Country" ) 
                   setElementData( aArea, "CountryOwned", country) 
                   end, 60000, 1 ) 
                end 
            end 
        end 
    end 
end 
                      ) 
  
    addEventHandler( 
        'onColShapeLeave', root,    
        function( ) 
if( source == pCuboid ) then 
setRadarAreaFlashing( pArea, false ) 
setElementData( aCuboid, "TurfInProgress", false ) 
setRadarAreaFlashing ( aArea, false) 
            end 
            end 
    ) 
     
addEventHandler( "onPlayerWasted", getRootElement( ), 
    function() 
if( source == pCuboid ) then 
setRadarAreaFlashing( pArea, false ) 
setElementData( aCuboid, "TurfInProgress", false ) 
setRadarAreaFlashing ( aArea, false) 
end 
end 
) 

Link to comment

it's basic and easy

local pArea     = createRadarArea( -1442.904296875, -971.251953125, 100, 100, 0, 0, 0, 125 ) 
    local pCuboid   = createColRectangle( -1442.904296875, -971.251953125, 100, 100 ) 
    BigSmokes = createTeam("Nazis", 255, 0, 255) 
addEventHandler("onResourceStart",resourceRoot,function() 
end ) 
      
            addEventHandler('onColShapeHit', root, 
                function( p ) -- you should have added player param here   
                local iR, iG, iB = getTeamColor(getPlayerTeam( p ) ) 
                local rR, rG, rB = getRadarAreaColor ( pArea ) 
                    if (getPlayerTeam( p )) then 
                      if( source == pCuboid ) then 
                        if ( iR == rR and iG == rG and iB == rB ) then 
                        
                        else 
                        if(getElementData( aCuboid, "TurfInProgress" )) then 
                        
                        else 
                        setRadarAreaFlashing ( aArea, true ) 
                setElementData( aCuboid, "TurfInProgress", true ) 
                
                   wave1 = setTimer( 
                   function() 
                   setElementData( aCuboid, "TurfInProgress", false ) 
                   setRadarAreaColor ( aArea, tR, tG, tB, 125 ) 
                   setRadarAreaFlashing ( aArea, false) 
                   country = getElementData( p, "Country" ) 
                   setElementData( aArea, "CountryOwned", country) 
                   end, 60000, 1 ) 
                end 
            end 
        end 
    end 
end 
                      ) 
  
    addEventHandler( 
        'onColShapeLeave', root,   
        function( ) 
if( source == pCuboid ) then 
setRadarAreaFlashing( pArea, false ) 
setElementData( aCuboid, "TurfInProgress", false ) 
setRadarAreaFlashing ( aArea, false) 
            end 
            end 
    ) 
    
addEventHandler( "onPlayerWasted", getRootElement( ), 
    function() 
if( source == pCuboid ) then 
setRadarAreaFlashing( pArea, false ) 
setElementData( aCuboid, "TurfInProgress", false ) 
setRadarAreaFlashing ( aArea, false) 
end 
end 
) 

and replace all aCuboid to pCuboid and aArea to pArea

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