Jump to content

Turfing system


Mike269

Recommended Posts

Hello everyone where in this script can I change how much time you must stand in turf to turf it ?

server.lua:

local pCuboid1 = createColCuboid(2133.1950683594, 633.66455078125, 10, 197.5, 92, 30) 
local pArea1 = createRadarArea( 2130, 630, 200, 100, 255, 255, 255, 125 ) 
setElementData(pCuboid1, "friendly", "no") 
setElementData(pCuboid1, "ownedBy", "") 
  
function callClientFunction(client, funcname, ...) 
    local arg = { ... } 
    if (arg[1]) then 
        for key, value in next, arg do 
            if (type(value) == "number") then arg[key] = tostring(value) end 
        end 
    end 
    triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) 
end 
  
addEventHandler('onColShapeHit', pCuboid1, 
    function(p) 
    local getOwnedBy = getElementData(pCuboid1, "ownedBy") 
    callClientFunction(p, "NeedMsg", 6, getOwnedBy) 
    callClientFunction(p, "NeedMsg", 1) 
        if (getPlayerTeam(p)) then 
            local pTeam = getPlayerTeam( p ) 
            local iR, iG, iB = getTeamColor( pTeam ) 
            local rR, gG, bB = getRadarAreaColor( pArea1 ) 
            local data = getElementData(pCuboid1, "friendly") 
                if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then 
                    callClientFunction(p, "NeedMsg", 2) 
                else 
                    setRadarAreaFlashing( pArea1, true ) 
                    capturing = setTimer( function( ) 
                        setElementData(pCuboid1, "friendly", "yes") 
                        setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) 
                        givePlayerMoney( p, 4000 ) 
                        callClientFunction(p, "NeedMsg", 4) 
                        setRadarAreaColor( pArea1, iR, iG, iB ) 
                        setRadarAreaFlashing( pArea1, false ) 
                    end, 600000, 1 
                    ) 
                end 
        else 
            callClientFunction(p, "NeedMsg", 3) 
        end 
         
        if (getPedOccupiedVehicle( p )) then 
        callClientFunction(p, "NeedMsg", 5) 
        end 
    end 
) 
  
addEventHandler('onColShapeLeave', pCuboid1, 
    function(p) 
        local getOwnedBy = getElementData(pCuboid1, "ownedBy") 
        setRadarAreaFlashing( pArea1, false ) 
        callClientFunction(p, "NeedMsg", 7, getOwnedBy) 
        if isTimer(capturing) then 
        killTimer(capturing) 
        end 
    end 
) 

client.lua

local x,y = guiGetScreenSize(); 
versija = '1.4.0 BETA' 
kurejas = 'Manve' 
  
messages = { 
[1] = {"Wait 10 Minutes To Capture The Turf."}, 
[2] = {"Entered Friendly Turf."}, 
[3] = {"You Need To Be In A Group."}, 
[4] = {"Turf Captured, Well Done."}, 
[5] = {"Enter Turf Without A Vehicle."}, 
} 
  
function NeedMsg(n,getOwnedBy) 
if (n < 6) then 
outputChatBox(unpack(messages[n]), 200, 111, 111) 
elseif ( n > 8 ) then 
outputChatBox("FOUND FATAL ERROR", 255, 0, 0) 
elseif ( n == 6 ) then 
outputChatBox("Entered A Turf Owned By '"..getOwnedBy.."'",200,111,111) 
elseif ( n == 7 ) then 
outputChatBox("Leaving A Turf Owned By '"..getOwnedBy.."'",200,111,111) 
end  
end 
  
function callClientFunction(funcname, ...) 
    local arg = { ... } 
    if (arg[1]) then 
        for key, value in next, arg do arg[key] = tonumber(value) or value end 
    end 
    loadstring("return "..funcname)()(unpack(arg)) 
end 
addEvent("onServerCallsClientFunction", true) 
addEventHandler("onServerCallsClientFunction", resourceRoot, callClientFunction) 

Link to comment

Here:

  
                    capturing = setTimer( function( ) 
                        setElementData(pCuboid1, "friendly", "yes") 
                        setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) 
                        givePlayerMoney( p, 4000 ) 
                        callClientFunction(p, "NeedMsg", 4) 
                        setRadarAreaColor( pArea1, iR, iG, iB ) 
                        setRadarAreaFlashing( pArea1, false ) 
                    end, 600000, 1 -- 2nd arguement here. means: 600000. Replace it1 
                    ) 
                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...