Jump to content

turf system help!


Storm-Hanma

Recommended Posts

hello all i used community resources turf system-https://community.multitheftauto.com/index.php?p=resources&s=details&id=5606

problems:

i added turfs zones and areas too problem is the time to capture turf is 10minutes but i edited it with 5min,but it taking 10min to capture turf!

when someone enter the turf the notifications are popup on my screen also and when i enter to turfs same with others!

when turfs are capture it give outmessage has turfs capture by ballas,but again when i leave turf it says turf owned by no-one!

this system runned perfectly when my developer edited it 3 years ago for my server MTA maze!now when iam doing it again  its not working at all 

please tell me solution

below are pics:https://imgur.com/5kITPzz

 see in the ss

this is the pic taken while turf was captured by ballas gang :https://imgur.com/NMk6Nb2

this one is the pic one my friend enter the turf and notifications pop up:https://imgur.com/esE6cp4

these is lua code:

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", "-No one-")

messages = {
[1] = {"#00ff00[MAZETurfSystem]:#C86f6f Wait 6 minutes to capture the turf.",p, 255, 255, 255,true},
[2] = {"#00ff00[MAZETurfSystem]:#C86f6f Entered friendly turf.",p, 255, 255, 255,true},
[3] = {"#00ff00[MAZETurfSystem]:#C86f6f You need to be in a group to start capturing the turf.",p, 255, 255, 255,true},
[4] = {"#00ff00[MAZETurfSystem]:#C86f6f Turf captured, well done.",p, 255, 255, 255,true},
[5] = {"#00ff00[MAZEturfSystem]:#C86f6f Enter turf without a vehicle.",p, 255, 255, 255,true},
[6] = {"#00ff00[MAZETurfSystem]:#C86f6f Entering a turf owned by: "..getElementData(pCuboid1, "ownedBy"),p, 255, 255, 255,true},
[7] = {"#00ff00[MAZEturfSystem]:#C86f6f Leaving a turf owned by: "..getElementData(pCuboid1, "ownedBy"),p, 255, 255, 255,true}
}

function NeedMsg(p,n,getOwnedBy)
if (n) then
outputChatBox(unpack(messages[n]))
end 
end

--[[ ZONE CREATION ]]--

addEventHandler('onColShapeHit', pCuboid1,
    function(p)
	NeedMsg(p,6)
        if (getPlayerTeam(p)) then
			NeedMsg(p,1)
			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
					NeedMsg(p,2)
				else
					setRadarAreaFlashing( pArea1, true )
					capturing = setTimer( function( )
						setElementData(pCuboid1, "friendly", "yes")
						setElementData(pCuboid1, "ownedBy", getTeamName(pTeam))
						givePlayerMoney( p, 4000 )
						NeedMsg(p,4)
						setRadarAreaColor( pArea1, iR, iG, iB )
						setRadarAreaFlashing( pArea1, false )
					end, 600000, 1
					)
				end
        else
            NeedMsg(p,3)
		end
		
		if (getPedOccupiedVehicle( p )) then
		NeedMsg(p,5)
		end
	end
)

addEventHandler('onColShapeLeave', pCuboid1,
	function(p)
		setRadarAreaFlashing( pArea1, false )
		if isTimer(capturing) then
		killTimer(capturing)
		end
		NeedMsg(p,7)
	end
)

-- [[ -- ]] --


local pCuboid2   = createColCuboid( 2486.5935058594, 678.20172119141, 9.5689830780029,  245, 133, 30 )
local pArea2     = createRadarArea( 2488.8793945313, 680.78289794922, 250, 130, 255, 255, 255, 125 )
setElementData(pCuboid2, "friendly", "no")
setElementData(pCuboid2, "ownedBy", "-No one-")

addEventHandler('onColShapeHit', pCuboid2,
    function(p)
	NeedMsg(p,6)
        if (getPlayerTeam(p)) then
			NeedMsg(p,1)
			local pTeam = getPlayerTeam( p )
            local iR, iG, iB = getTeamColor( pTeam )
			local rR, gG, bB = getRadarAreaColor( pArea2 )
			local data = getElementData(pCuboid2, "friendly")
				if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then
					NeedMsg(p,2)
				else
					setRadarAreaFlashing( pArea2, true )
					capturing = setTimer( function( )
						setElementData(pCuboid2, "friendly", "yes")
						setElementData(pCuboid2, "ownedBy", getTeamName(pTeam))
						givePlayerMoney( p, 4000 )
						NeedMsg(p,4)
						setRadarAreaColor( pArea2, iR, iG, iB )
						setRadarAreaFlashing( pArea2, false )
					end, 600000, 1
					)
				end
        else
            NeedMsg(p,3)
		end
		
		if (getPedOccupiedVehicle( p )) then
		NeedMsg(p,5)
		end
	end
)

addEventHandler('onColShapeLeave', pCuboid2,
	function(p)
		setRadarAreaFlashing( pArea2, false )
		if isTimer(capturing) then
		killTimer(capturing)
		end
		NeedMsg(p,7)
	end
)


local pArea3     = createRadarArea( 1858, 623, 140, 165, 255, 255, 255, 125 )
local pCuboid3   = createColCuboid( 1856.2864990234, 627.07629394531, 9,  138.25, 152.75, 30 )
setElementData(pCuboid3, "friendly", "no")
setElementData(pCuboid3, "ownedBy", "-No one-")

addEventHandler('onColShapeHit', pCuboid3,
    function(p)
	NeedMsg(p,6)
        if (getPlayerTeam(p)) then
			NeedMsg(p,1)
			local pTeam = getPlayerTeam( p )
            local iR, iG, iB = getTeamColor( pTeam )
			local rR, gG, bB = getRadarAreaColor( pArea3 )
			local data = getElementData(pCuboid3, "friendly")
				if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then
					NeedMsg(p,2)
				else
					setRadarAreaFlashing( pArea3, true )
					capturing = setTimer( function( )
						setElementData(pCuboid2, "friendly", "yes")
						setElementData(pCuboid2, "ownedBy", getTeamName(pTeam))
						givePlayerMoney( p, 4000 )
						NeedMsg(p,4)
						setRadarAreaColor( pArea3, iR, iG, iB )
						setRadarAreaFlashing( pArea3, false )
					end, 600000, 1
					)
				end
        else
            NeedMsg(p,3)
		end
		
		if (getPedOccupiedVehicle( p )) then
		NeedMsg(p,5)
		end
	end
)

addEventHandler('onColShapeLeave', pCuboid3,
	function(p)
		setRadarAreaFlashing( pArea3, false )
		if isTimer(capturing) then
		killTimer(capturing)
		end
		NeedMsg(p,7)
	end
)

local pArea4     = createRadarArea( 1577, 663, 180, 130, 255, 255, 255, 125 )
local pCuboid4   = createColCuboid( 1576.8956298828, 662.84362792969, 9.671875, 181, 120.5, 30 )
setElementData(pCuboid4, "friendly", "no")
setElementData(pCuboid4, "ownedBy", "-No one-") 

addEventHandler('onColShapeHit', pCuboid4,
    function(p)
	NeedMsg(p,6)
        if (getPlayerTeam(p)) then
			NeedMsg(p,1)
			local pTeam = getPlayerTeam( p )
            local iR, iG, iB = getTeamColor( pTeam )
			local rR, gG, bB = getRadarAreaColor( pArea4 )
			local data = getElementData(pCuboid3, "friendly")
				if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then
					NeedMsg(p,2)
				else
					setRadarAreaFlashing( pArea4, true )
					capturing = setTimer( function( )
						setElementData(pCuboid4, "friendly", "yes")
						setElementData(pCuboid4, "ownedBy", getTeamName(pTeam))
						givePlayerMoney( p, 4000 )
						NeedMsg(p,4)
						setRadarAreaColor( pArea4, iR, iG, iB )
						setRadarAreaFlashing( pArea4, false )
					end, 600000, 1
					)
				end
        else
            NeedMsg(p,3)
		end
		
		if (getPedOccupiedVehicle( p )) then
		NeedMsg(p,5)
		end
	end
)

addEventHandler('onColShapeLeave', pCuboid4,
	function(p)
		setRadarAreaFlashing( pArea4, false )
		if isTimer(capturing) then
		killTimer(capturing)
		end
		NeedMsg(p,7)
	end
)


local pArea5     = createRadarArea( 2778, 834, 110, 190, 255, 255, 255, 125 )
local pCuboid5   = createColCuboid( 2777.4248046875, 833.88018798828, 9.6484375,  113.5, 188, 30 ) 
setElementData(pCuboid4, "friendly", "no")
setElementData(pCuboid4, "ownedBy", "-No one-") 

addEventHandler('onColShapeHit', pCuboid5,
    function(p)
	NeedMsg(p,6)
        if (getPlayerTeam(p)) then
			NeedMsg(p,1)
			local pTeam = getPlayerTeam( p )
            local iR, iG, iB = getTeamColor( pTeam )
			local rR, gG, bB = getRadarAreaColor( pArea5 )
			local data = getElementData(pCuboid5, "friendly")
				if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then
					NeedMsg(p,2)
				else
					setRadarAreaFlashing( pArea5, true )
					capturing = setTimer( function( )
						setElementData(pCuboid5, "friendly", "yes")
						setElementData(pCuboid5, "ownedBy", getTeamName(pTeam))
						givePlayerMoney( p, 4000 )
						NeedMsg(p,4)
						setRadarAreaColor( pArea5, iR, iG, iB )
						setRadarAreaFlashing( pArea5, false )
					end, 600000, 1
					)
				end
        else
            NeedMsg(p,3)
		end
		
		if (getPedOccupiedVehicle( p )) then
		NeedMsg(p,5)
		end
	end
)

addEventHandler('onColShapeLeave', pCuboid5,
	function(p)
		setRadarAreaFlashing( pArea5, false )
		if isTimer(capturing) then
		killTimer(capturing)
		end
		NeedMsg(p,7)
	end
)


local pArea6     = createRadarArea( 253.6764, -1834.5588, 3.63115, 190, 255, 255, 255, 125 )
local pCuboid6   = createColCuboid( 252.6764, -1833.5588, 2.63115,  255, 255, 255 ) 
setElementData(pCuboid6, "friendly", "no")
setElementData(pCuboid6, "ownedBy", "-No one-") 

addEventHandler('onColShapeHit', pCuboid5,
    function(p)
	NeedMsg(p,6)
        if (getPlayerTeam(p)) then
			NeedMsg(p,1)
			local pTeam = getPlayerTeam( p )
            local iR, iG, iB = getTeamColor( pTeam )
			local rR, gG, bB = getRadarAreaColor( pArea6 )
			local data = getElementData(pCuboid6, "friendly")
				if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then
					NeedMsg(p,2)
				else
					setRadarAreaFlashing( pArea6, true )
					capturing = setTimer( function( )
						setElementData(pCuboid6, "friendly", "yes")
						setElementData(pCuboid6, "ownedBy", getTeamName(pTeam))
						givePlayerMoney( p, 4000 )
						NeedMsg(p,4)
						setRadarAreaColor( pArea6, iR, iG, iB )
						setRadarAreaFlashing( pArea6, false )
					end, 600000, 1
					)
				end
        else
            NeedMsg(p,3)
		end
		
		if (getPedOccupiedVehicle( p )) then
		NeedMsg(p,5)
		end
	end
)

addEventHandler('onColShapeLeave', pCuboid6,
	function(p)
		setRadarAreaFlashing( pArea6, false )
		if isTimer(capturing) then
		killTimer(capturing)
		end
		NeedMsg(p,7)
	end
)







--[     HOW TO MAKE NEW ZONES??     ]]--

--[[  

------------------------------------------------------------------------------------------------------------------------------------
*Copy the code below
*Paste it above 'how to make new zones' comment
*Rename colCuboidNameHere with col cuboid name
*Rename areaNameHere with area name
*Change x,y,z,width,depth,height with the details you want
*Change leftX,bottomY,sizeX,sizeY,R,G,B,A with the details you want
*Done!
------------------------------------------------------------------------------------------------------------------------------------

local colCuboidNameHere = createColCuboid(x, y, z, width, depth, height)
local areaNameHere = createRadarArea( leftX, bottomY, sizeX, sizeY, R, G, B, A )
setElementData(colCuboidNameHere, "friendly", "no")
setElementData(colCuboidNameHere, "ownedBy", "-No one-")

]]--

--[     HOW TO MAKE NEW ZONES WORK??     ]]--

--[[  

------------------------------------------------------------------------------------------------------------------------------------
*Copy the code below
*Paste it above 'how to make new zones' comment
*Rename colCuboidNameHere with col cuboid name
*Rename areaNameHere with area name
*Done!
------------------------------------------------------------------------------------------------------------------------------------


addEventHandler('onColShapeHit', colCuboidNameHere,
    function(p)
	NeedMsg(p,6)
        if (getPlayerTeam(p)) then
			NeedMsg(p,1)
			local pTeam = getPlayerTeam( p )
            local iR, iG, iB = getTeamColor( pTeam )
			local rR, gG, bB = getRadarAreaColor( areaNameHere )
			local data = getElementData(colCuboidNameHere, "friendly")
				if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then
					NeedMsg(p,2)
				else
					setRadarAreaFlashing( areaNameHere, true )
					capturing = setTimer( function( )
						setElementData(colCuboidNameHere, "friendly", "yes")
						setElementData(colCuboidNameHere, "ownedBy", getTeamName(pTeam))
						givePlayerMoney( p, 4000 )
						NeedMsg(p,4)
						setRadarAreaColor( areaNameHere, iR, iG, iB )
						setRadarAreaFlashing( areaNameHere, false )
					end, 600000, 1
					)
				end
        else
            NeedMsg(p,3)
		end
		
		if (getPedOccupiedVehicle( p )) then
		NeedMsg(p,5)
		end
	end
)

addEventHandler('onColShapeLeave', colCuboidNameHere,
	function(p)
		setRadarAreaFlashing( areaNameHere, false )
		if isTimer(capturing) then
		killTimer(capturing)
		end
		NeedMsg(p,7)
	end
)


]]--

help me please i need this like hell!!

Edited by Khadeer143
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...