Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------------------- CONFIGS --------------------------------------------
- cuboid = createColCuboid ( 118.59999847412,406.10000610352, 0 , 179, 161, 30.10000038147 )
- GroupName = "FG_Admins"
- maxvehicles = 20
- maxair = 10
- EnableVehicleGodMode = true
- DateExpired = "Never"
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- function ResourceStart( )
- local vehs = getElementsByType("vehicle")
- for key, val in ipairs(vehs) do
- if isElementWithinColShape(val, cuboid) and not ( getElementData ( val , "isExploded" ) ) then
- SetVehicleGodMode(val,true)
- fixVehicle(val)
- end
- end
- end
- addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ),ResourceStart)
- function ResourceStop( )
- local vehs = getElementsByType("vehicle")
- for key, val in ipairs(vehs) do
- if isElementWithinColShape(val, cuboid) then
- SetVehicleGodMode(val,false)
- end
- end
- end
- addEventHandler( "onResourceStop", getResourceRootElement( getThisResource() ),ResourceStop)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- function createGate ()
- Gate1 = createObject ( 16775, 243.099609375, 464.2998046875, 5.5999999046326, 0, 0, 0 )
- Gate2 = createObject ( 5333,115.7,199.1,10.2, 0, 0, 270 )
- end
- addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate )
- function closeGate (PlayerID)
- if ( getElementData ( PlayerID , "gang" ) == GroupName ) or is_admin(PlayerID) then
- if getElementData(source,"gang") == "None" then return end
- if not doesGangExists(getElementData(source,"gang")) then return end
- for i, PlayerID in ipairs(getPlayersByGang(getElementData(source,"gang"))) do
- if getElementData(PlayerID,"gang") == "None" then break end
- if getElementData(PlayerID,"gang") == getElementData(source,"gang") then
- moveObject ( Gate1, 1000, 243.099609375, 464.2998046875, 5.5999999046326 )
- triggerClientEvent( source, "dxPickupsText", PlayerID, "BRAMA ZAMKNIETA", 255,0,0 )
- end
- end
- end
- end
- end
- addCommandHandler("zamknij",closeGate)
- function openGate (PlayerID)
- if ( getElementData ( PlayerID , "gang" ) == GroupName ) or is_admin(PlayerID) then
- if getElementData(source,"gang") == "None" then return end
- if not doesGangExists(getElementData(source,"gang")) then return end
- for i, PlayerID in ipairs(getPlayersByGang(getElementData(source,"gang"))) do
- if getElementData(PlayerID,"gang") == "None" then break end
- if getElementData(PlayerID,"gang") == getElementData(source,"gang") then
- moveObject ( Gate1, 1000, 243.099609375, 464.2998046875, -1 )
- triggerClientEvent( source, "dxPickupsText", PlayerID, "BRAMA OTWARTA", 173,255,47 )
- end
- end
- end
- end
- end
- addCommandHandler("otworz",openGate)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- function enterVehicle ( player, seat, jacked )
- if isElementWithinColShape(source, cuboid) then
- if ( is_group(player) or is_admin(player) ) and seat == 0 then
- setElementFrozen(source, false)
- sendMsg(player, "[BASE] Freeze in the vehicle has been disabled!")
- end
- end
- end
- addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle )
- function exitVehicle ( player, seat, jacked )
- if isElementWithinColShape(source, cuboid) then
- if ( is_group(player) or is_admin(player) ) and seat == 0 then
- setElementFrozen(source, true)
- sendMsg(player, "[BASE] Freeze in the vehicle has been enabled!")
- end
- end
- end
- addEventHandler ( "onVehicleExit", getRootElement(), exitVehicle)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- ZL_TIMER = {}
- function target_hit(element, dim)
- if dim == true and getElementType(element) == "player" then
- if is_group(element) then
- setTimer(function()
- sendMsg(element, "[BASE] Your base has "..CountVehicles().."/"..maxvehicles.." vehicles and "..CountAir().."/"..maxair.." airs! Expiration date:#FF0000 "..DateExpired) end,
- 100, 1)
- elseif is_admin(element) then
- sendMsg(element, "[BASE] Baza nalezy do gangu#FF0000 "..GroupName.."#E7D9B0 i wygasa#FF0000 "..DateExpired.."")
- setTimer(function()
- sendMsg(element, "[BASE] Stan limitu: "..CountVehicles().."/"..maxvehicles.." poj. ladowych i "..CountAir().."/"..maxair.." poj. powietrznych") end,
- 100, 1)
- else
- sendMsg(element, "[BASE]#FF0000 Warning!#E7D9B0 This is private base. You have 3 seconds to leave this area!")
- setTimer(target2, 3000, 1, element, dim)
- sendMsgOwners(element)
- end
- end
- if getElementType(element) == "vehicle" then
- if getElementData(element , "isExploded") then
- return
- end
- if CountVehicles() > maxvehicles then
- destroyVehicle(element, 0)
- elseif CountAir() > maxair then
- destroyVehicle(element, 1)
- else
- SetVehicleGodMode(element,true)
- fixVehicle(element)
- end
- end
- end
- addEventHandler("onColShapeHit", cuboid, target_hit)
- function target2(element, dim)
- if getElementType(element) == "player" then
- if isElementWithinColShape(element, cuboid) then
- ZL_TIMER[element] = setTimer(ZL_killIntruder, 150, 1, element)
- end
- end
- end
- function ZL_killIntruder(p)
- setElementData(p, "blood", -20)
- setTimer(target2, 100, 1, p, true)
- end
- function target_leave(element, dim)
- if getElementType ( element ) == "vehicle" then
- SetVehicleGodMode(element,false)
- end
- if getElementType(element) == "player" then
- if isTimer(ZL_TIMER[element]) then
- killTimer(ZL_TIMER[element])
- end
- end
- end
- addEventHandler("onColShapeLeave", cuboid, target_leave)
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- function CountAir()
- local countair=0
- local vehicles = getElementsWithinColShape (cuboid, "vehicle" ) or {}
- for _,v in ipairs(vehicles) do
- if isVehicleBlown(v) == false then
- if getElementModel(v) == 593 or getElementModel(v) == 497 or getElementModel(v) == 487 then
- countair = countair + 1
- end
- end
- end
- return countair
- end
- function CountVehicles()
- local countvehicles=0
- local vehicles = getElementsWithinColShape (cuboid, "vehicle" ) or {}
- for _,v in ipairs(vehicles) do
- if isVehicleBlown(v) == false then
- if not ( getElementModel(v) == 593 or getElementModel(v) == 497 or getElementModel(v) == 487 or getElementModel(v) == 422 or getElementModel(v) == 471 or getElementModel(v) == 550 or getElementModel(v) == 509 ) then
- countvehicles = countvehicles + 1
- end
- end
- end
- return countvehicles
- end
- function destroyVehicle(hitElement, isAir)
- if getElementType(hitElement) == 'vehicle' then
- local occupants = getVehicleOccupants(hitElement) or {}
- for seat, occupant in pairs(occupants) do
- if (getElementType(occupant) == "player") then
- if is_group(occupant) then
- removePedFromVehicle(occupant)
- if isAir >= 1 then
- sendMsg(occupant, "[BASE]#FF0000 Warning!#E7D9B0 Your gang crossed the airs limit ( max is "..maxair.." )!")
- else
- sendMsg(occupant, "[BASE]#FF0000 Warning!#E7D9B0 Your gang crossed the vehicles limit ( max is "..maxvehicles.." )!")
- end
- end
- SetVehicleGodMode(hitElement,false)
- end
- end
- setTimer( function()
- if isElementWithinColShape(hitElement, cuboid) then
- setElementPosition(hitElement,619.0, -3126.6, -2.1)
- end
- end, 3000, 1)
- end
- end
- ----------------------------------------------------------------------------------------------------------------------------------------------------------
- function SetVehicleGodMode( VehicleID, godEoD )
- if EnableVehicleGodMode == true then
- setVehicleDamageProof (VehicleID, godEoD )
- end
- end
- function is_admin(index)
- local accName = getAccountName(getPlayerAccount(index))
- if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ("user."..accName, aclGetGroup ( "SuperModeratorFG" ) ) ) then
- return true
- else
- return false
- end
- end
- function is_group( PlayerID )
- if ( getElementData ( PlayerID , "gang" ) == GroupName ) then
- return true
- else
- return false
- end
- end
- function sendMsgOwners( PlayerID )
- local connectedPlayers = getElementsByType ( "player" )
- for i, aPlayer in ipairs(connectedPlayers) do
- if( is_group (aPlayer) == true ) then
- sendMsg(aPlayer,"[BASE]#FF0000 Warning!#E7D9B0 Player#FFCB00 "..skipColorCode ( PlayerID ) .."#E7D9B0 is trying to attack the base!")
- end
- end
- end
- function sendMsg(iplayer,msg)
- outputChatBox ( msg, iplayer, 231, 217, 176, true )
- end
- function skipColorCode ( s )
- if type ( s ) == "string" then
- return string.gsub ( s, "(#%x%x%x%x%x%x)", "" )
- elseif type ( s ) == "userdata" and getElementType ( s ) == "player" then
- return string.gsub ( getPlayerName ( s ), "(#%x%x%x%x%x%x)", "" )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement