Jump to content

مطلوب فنكش


Recommended Posts

local LSPD = createColPolygon(551.60919,-1284.31934 , 1610, -1601, 1610, -1723, 1502, -1723, 1500, -1601) -- LSPD 
local SFPD = createColRectangle(551.60919,-1284.31934 , 200, 120) -- SFPD 
local AS = createColTube(2130.44556,-1151.15137 , 10, 30, 10) -- Allsaints Hospital 
local JF = createColRectangle(2130.44556,-1151.15137 , 125, 80) -- Jefferson Hospital 
local SF1 = createColRectangle(-2745, 576, 135, 100) -- SF Hospital 
local LV = createColPolygon(1559, 1801, 1559, 1801, 1558, 1910, 1674, 1910, 1681, 1806) -- LV Hospital 
local LVR = createColPolygon(1719, 1923, 1719, 1923, 1755, 1924, 1756, 2000, 1718, 2000) -- LV Recovery 
local PHI = createColPolygon(4324, 844, 4324, 844, 4401, 804, 4374, 697, 4373, 674, 4335, 670, 4335, 605, 4281, 605, 4280, 708, 4259, 799) -- Pirate 
local LVE = createColPolygon(1242, 819, 1242, 819, 1245, 789, 1202, 788, 1201, 817) -- LV East Hospital 
  
local zones = {LSPD, SFPD, AS, JF, SF1, LV, LVR, PHI, LVE} 
  
function isElementWithinSafeZone(element) 
    if (not isElement(element)) then return false end 
    if (getElementDimension(element) ~= 0 or getElementInterior(element) ~= 0) then return false end 
    for i, zone in pairs(zones) do 
        if (isElementWithinColShape(element, zone)) then return true end 
    end 
    return false 
end 
  
function enterSafeZone(element, matchingDimension) 
    if (element ~= localPlayer or not matchingDimension) then return end 
    if (getElementDimension(element) ~= 0) then return end 
    if (exports.CORteams:isPlayerInTeams(localPlayer, "Staff")) then return end 
    if (isTimer(leaveTimer)) then killTimer(leaveTimer) end 
    if (exports.CORteams:isPlayerInTeams(localPlayer, "Armed Forces", "SWAT Team", "Police Service", "Government")) then 
        --exports.CIThelp:dm("You have entered a no-camping zone, please leave the area within 1 minute or you will be killed", 0, 255, 0) 
        --leaveTimer = setTimer(handleLimit, 60000, 1) 
        --exports.CIThelp:modTextBar("campHandler", "Protected, no camp area", 0, 255, 0) 
    else 
        --exports.CIThelp:dm("You have entered a no-camping zone, please leave the area within 1 minute(s) or you will be killed", 0, 255, 0) 
        --leaveTimer = setTimer(handleLimit, 60000, 1) 
        setPedWeaponSlot(localPlayer, 0) 
        --exports.CIThelp:modTextBar("campHandler", "Protected, no camp area", 0, 255, 0) 
    end 
end 
  
function exitSafeZone(element, matchingDimension) 
    if (element ~= localPlayer or not matchingDimension) then return end 
    if (isTimer(leaveTimer)) then killTimer(leaveTimer) end 
    exports.CIThelp:modTextBar("campHandler", "") 
end 
  
for i, zone in pairs(zones) do 
    addEventHandler("onClientColShapeHit", zone, enterSafeZone) 
    addEventHandler("onClientColShapeLeave", zone, exitSafeZone) 
end 
  
function handleLimit() 
    if (exports.CORteams:isPlayerInTeams(localPlayer, "Staff")) then 
        return 
    end 
    if (getElementDimension(localPlayer) ~= 0) then 
        exports.CIThelp:modTextBar("campHandler", "") 
        return 
    end 
    exports.CIThelp:dm("You have been killed for camping", 0, 255, 0) 
    setElementHealth(localPlayer, 0) 
end 
  
function preventWeaponUse(prevSlot, newSlot) 
    if (not isElementWithinSafeZone(localPlayer)) then return end 
    if (getElementDimension(localPlayer) ~= 0) then return end 
    if (exports.CORteams:isPlayerInTeams(localPlayer, "Staff")) then return end 
    if (exports.CORteams:isPlayerInTeams(localPlayer, "Armed Forces", "SWAT Team", "Police Service", "Government")) then 
        setPedWeaponSlot(localPlayer, 1) 
    elseif (getElementData(localPlayer, "o") == "Explorer" or getElementData(localPlayer, "o") == "News Reporter") then 
        setPedWeaponSlot(localPlayer, 9) 
    else 
        exports.CORtexts:output("You are not allowed to use weapons in a no camping zone", 0, 255, 0) 
        setPedWeaponSlot(localPlayer, 0) 
    end 
end 
addEventHandler("onClientPlayerWeaponSwitch", localPlayer, preventWeaponUse) 

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