Jump to content

turf system


MoeezKhan

Recommended Posts

Hi all this is turf system but is not working please anybody fix it

----client side----

addEvent('countdown', true) 
function reduceCountdown( ) 
    cont = 3 
    setTimer( 
    function()  
    cont = cont -1  
    outputChatBox( cont, 255, 255, 255 ) 
    end,1000,3 
    ) 
end 
addEventHandler('countdown', root, reduceCountdown) 
  
addEvent('time', true); 
addEventHandler('time', root, 
function( ) 
local w, h = guiGetScreenSize( ); 
local styleLetters = guiCreateFont( 'font.ttf', 20 ); 
test = guiCreateLabel( w*0.0002, h*0.0011, 0.475, 0.1, 'Wait 10 minutes to capture the turf.', true ); 
guiLabelSetColor( test, 255, 255, 0 ) 
guiSetFont( test, styleLetters ); 
    setTimer( 
    function( ) 
        if isElement( test ) then 
            destroyElement( test ); 
        end 
    end, 5000, 1 
    ); 
end 
); 
  
addEvent('friendly', true); 
addEventHandler('friendly', root, 
function( ) 
local w, h = guiGetScreenSize( ); 
local styleLetters2 = guiCreateFont( 'font.ttf', 20 ); 
test2 = guiCreateLabel( w*0.00025, h*0.0011, 0.475, 0.1, 'You entered friendly turf.', true ); 
guiLabelSetColor( test2, 0, 255, 0 ) 
guiSetFont( test2, styleLetters2 ); 
    setTimer( 
    function( ) 
        if isElement( test2 ) then 
            destroyElement( test2 ); 
        end 
    end, 5000, 1 
    ); 
end 
); 
  
addEvent('group', true); 
addEventHandler('group', root, 
function( ) 
local w, h = guiGetScreenSize( ); 
local styleLetters3 = guiCreateFont( 'font.ttf', 20 ); 
test3 = guiCreateLabel( w*0.0003, h*0.0011, 0.475, 0.1, 'You need a group.', true ); 
guiLabelSetColor( test3, 255, 0, 0 ) 
guiSetFont( test3, styleLetters3 ); 
    setTimer( 
    function( ) 
        if isElement( test3 ) then 
            destroyElement( test3 ); 
        end 
    end, 5000, 1 
    ); 
end 
); 
  
addEvent('time2', true); 
addEventHandler('time2', root, 
function( ) 
    if isElement( test ) then 
        destroyElement( test ) 
    end 
end 
); 
  
addEvent('friendly2', true); 
addEventHandler('friendly2', root, 
function( ) 
    if isElement( test2 ) then 
        destroyElement( test2 ) 
    end 
end 
); 

---server side----

    local pArea     = createRadarArea( 2130, 630, 200, 100, 255, 255, 255, 125 ) 
    local pArea2     = createRadarArea( 2488.8793945313, 680.78289794922, 250, 130, 255, 255, 255, 125 ) 
    local pCuboid   = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 30 ) 
    local pCuboid2   = createColCuboid( 2486.5935058594, 678.20172119141, 9.5689830780029,  245, 133, 30 ) 
    local pArea3     = createRadarArea( 1858, 623, 140, 165, 255, 255, 255, 125 ) 
    local pCuboid3   = createColCuboid( 1856.2864990234, 627.07629394531, 9,  138.25, 152.75, 30 ) 
    local pArea4     = createRadarArea( 1577, 663, 180, 130, 255, 255, 255, 125 ) 
    local pCuboid4   = createColCuboid( 1576.8956298828, 662.84362792969, 9.671875, 181, 120.5, 30 )  
    local pArea5     = createRadarArea( 2778, 834, 110, 190, 255, 255, 255, 125 ) 
    local pCuboid5   = createColCuboid( 2777.4248046875, 833.88018798828, 9.6484375,  113.5, 188, 30 )  
      
addEventHandler("onResourceStart", resourceRoot, 
function() 
    outputDebugString("|~| Turf system by manve1 |~| Has been turned on! |~| This system was downloaded from MTA Community. |~|", 3, 0, 255, 0) 
end  
) 
  
--[[addEventHandler("onResourceStop", resourceRoot, 
function() 
    outputDebugString("|~| Turf system by manve1 |~| Has been turned off! |~| This system was downloaded from MTA Community. |~|", 3, 0, 255, 0) 
  
    saveS = xmlLoadFile( 'file_saves.xml' ) 
    local save_info = xmlFindChild(saveS, 'turf', 0) 
    xmlNodeSetAttribute( save_info, 'saved', 'nothing new' ) 
  
end  
)]] 
            addEventHandler( 
                'onColShapeHit', pCuboid, 
                function( player ) 
                    if (getPlayerTeam( player )) then 
                        local pTeam = getPlayerTeam( player ) 
                        local iR, iG, iB = getTeamColor( pTeam ) 
                        local rR, gG, bB = getRadarAreaColor( pArea ) 
                        if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then 
                            triggerClientEvent(player, 'friendly', player) 
                        else 
                        setRadarAreaFlashing( pArea, true ) 
                        triggerClientEvent(player, 'time', player) 
                        triggerClientEvent(player, 'countdown', player) 
                        pArea1Timer = setTimer( function() 
                        setRadarAreaColor (pArea, iR, iG, iB, 100); 
                        givePlayerMoney( player, 4000 ); 
                        outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", player, 0, 255, 0, true ); 
                        setRadarAreaFlashing( pArea, false ) 
                        end, 6000, 1 ) 
                        end 
                    else 
                        triggerClientEvent(player, 'group', player) 
                    end 
                end 
        ) 
  
    addEventHandler( 
        'onColShapeLeave', root,    
        function( player ) 
            if( source == pCuboid ) then 
                setRadarAreaFlashing( pArea, false ) 
                triggerClientEvent(player, 'time2', player) 
                triggerClientEvent(player, 'friendly2', player) 
                if isTimer( pArea1Timer ) then 
                    killTimer( pArea1Timer ) 
                end 
            end 
        end 
    ) 
     
    ----------------------------- 
    addEventHandler(  
        'onColShapeHit', root, 
        function( p ) 
          if (getPlayerTeam( p )) then 
            if( source == pCuboid2 ) then 
                local pTeam = getPlayerTeam( player ) 
                local iR, iG, iB = getTeamColor( pTeam ) 
                local rR, gG, bB = getRadarAreaColor( pArea2 ) 
                if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then 
                        triggerClientEvent(player, 'friendly', player) 
                else 
                setRadarAreaFlashing( pArea2, true ) 
                triggerClientEvent(player, 'time', player) 
                pArea2Timer = setTimer( function() 
                setRadarAreaColor (pArea2, iR2, iG2, iB2, 100); 
                givePlayerMoney( p, 4000 ); 
                outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); 
                setRadarAreaFlashing( pArea2, false ) 
                end, 600000, 1 ) 
                end 
                end 
          else   
                triggerClientEvent(player, 'group', player) 
          end 
             
        end 
    ) 
  
    addEventHandler( 
        'onColShapeLeave', root,    
        function( p ) 
            if( source == pCuboid2 ) then 
                setRadarAreaFlashing( pArea2, false ) 
                triggerClientEvent(player, 'time2', player) 
                triggerClientEvent(player, 'friendly2', player) 
                if isTimer( pArea2Timer ) then 
                    killTimer( pArea2Timer ) 
                end 
            end 
        end 
    ) 
     
    ------------------------------------ 
     
        addEventHandler(  
        'onColShapeHit', root, 
        function( p ) 
          if (getPlayerTeam( p )) then 
            if( source == pCuboid3 ) then 
                local pTeam = getPlayerTeam( player ) 
                local iR, iG, iB = getTeamColor( pTeam ) 
                local rR, gG, bB = getRadarAreaColor( pArea3 ) 
                if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then 
                    triggerClientEvent(player, 'friendly', player) 
                else 
                setRadarAreaFlashing( pArea3, true ) 
                triggerClientEvent(player, 'time', player) 
                pArea3Timer = setTimer( function() 
                setRadarAreaColor (pArea3, iR2, iG2, iB2, 100); 
                givePlayerMoney( p, 4000 ); 
                outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); 
                setRadarAreaFlashing( pArea3, false ) 
                end, 600000, 1 ) 
                end 
            end 
          else   
                triggerClientEvent(player, 'group', player) 
          end 
             
        end 
    ) 
  
    addEventHandler( 
        'onColShapeLeave', root,    
        function( p ) 
            if( source == pCuboid3 ) then 
                setRadarAreaFlashing( pArea3, false ) 
                triggerClientEvent(player, 'time2', player) 
                triggerClientEvent(player, 'friendly2', player) 
                if isTimer( pArea3Timer ) then 
                    killTimer( pArea3Timer ) 
                end 
            end 
        end 
    ) 
     
    ------------------------------------- 
     
            addEventHandler(  
        'onColShapeHit', root, 
        function( p ) 
          if (getPlayerTeam( p )) then 
            if( source == pCuboid4 ) then 
                local pTeam = getPlayerTeam( player ) 
                local iR, iG, iB = getTeamColor( pTeam ) 
                local rR, gG, bB = getRadarAreaColor( pArea4 ) 
                if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then 
                    triggerClientEvent(player, 'friendly', player) 
                else 
                setRadarAreaFlashing( pArea4, true ) 
                triggerClientEvent(player, 'time', player) 
                pArea4Timer = setTimer( function() 
                setRadarAreaColor (pArea4, iR2, iG2, iB2, 100); 
                givePlayerMoney( p, 4000 ); 
                outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); 
                setRadarAreaFlashing( pArea4, false ) 
                end, 600000, 1 ) 
                end 
            end 
          else   
                triggerClientEvent(player, 'group', player) 
          end 
             
        end 
    ) 
  
    addEventHandler( 
        'onColShapeLeave', root,    
        function( p ) 
            if( source == pCuboid4 ) then 
                setRadarAreaFlashing( pArea4, false ) 
                triggerClientEvent(player, 'time2', player) 
                triggerClientEvent(player, 'friendly2', player) 
                if isTimer( pArea3Timer ) then 
                    killTimer( pArea3Timer ) 
                end 
            end 
        end 
    ) 
     
    ----------------------------------- 
     
                addEventHandler(  
        'onColShapeHit', root, 
        function( p ) 
          if (getPlayerTeam( p )) then 
            if( source == pCuboid5 ) then 
                local pTeam = getPlayerTeam( player ) 
                local iR, iG, iB = getTeamColor( pTeam ) 
                local rR, gG, bB = getRadarAreaColor( pArea5 ) 
                if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then 
                    triggerClientEvent(player, 'friendly', player) 
                else 
                setRadarAreaFlashing( pArea5, true ) 
                triggerClientEvent(player, 'time', player) 
                pArea5Timer = setTimer( function() 
                setRadarAreaColor (pArea5, iR2, iG2, iB2, 100); 
                givePlayerMoney( p, 4000 ); 
                outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); 
                setRadarAreaFlashing( pArea5, false ) 
                end, 600000, 1 ) 
                end 
            end 
          else   
                triggerClientEvent(player, 'group', player) 
          end 
             
        end 
    ) 
  
    addEventHandler( 
        'onColShapeLeave', root,    
        function( p ) 
            if( source == pCuboid5 ) then 
                setRadarAreaFlashing( pArea5, false ) 
                triggerClientEvent(player, 'time2', player) 
                triggerClientEvent(player, 'friendly2', player) 
                if isTimer( pArea5Timer ) then 
                    killTimer( pArea5Timer ) 
                end 
            end 
        end 
    ) 
  

bugs

WARNING: turf/turf-s.lua:91: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nill 
WARNING: turf/turf-s.lua:135: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil 
WARNING: turf/turf-s.lua:179: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil 
WARNING: turf/turf-s.lua:223: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil 

  • Like 1
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...