0 Üye ve 1 Ziyaretçi konuyu incelemekte.
function onPDamage() if getElementData (source, "greenzone") then cancelEvent() endendaddEventHandler ("onClientPlayerDamage", localPlayer, onPDamage)function onPSKill(target) if getElementData (target, "greenzone") then cancelEvent() endendaddEventHandler ("onClientPlayerStealthKill", localPlayer, onPSKill)function invisible() setElementAlpha(localPlayer, 0)endaddCommandHandler ( "invisible", invisible )function renderGreenzoneTag() local streamedPlayers = getElementsByType ("player", root, true) if streamedPlayers and #streamedPlayers ~= 0 then local lpos = {getElementPosition(localPlayer)} for _,p in ipairs (streamedPlayers) do if p and isElement (p) then if getElementData (p, "greenzone") then local ppos = {getElementPosition(p)} if getDistanceBetweenPoints3D (lpos[1], lpos[2], lpos[3], ppos[1], ppos[2], ppos[3]) <= 20 then local x, y = getScreenFromWorldPosition (ppos[1], ppos[2], ppos[3]+1.2) if x and y then dxDrawText ("GÜVENLİ BÖLGE", x+1, y+1, x, y, tocolor (0, 0, 0), 0.5, "bankgothic", "center") dxDrawText ("GÜVENLİ BÖLGE", x, y, x, y, tocolor (0, 220, 0), 0.5, "bankgothic", "center") end end end end end endendaddEventHandler ("onClientRender", root, renderGreenzoneTag)
-- By default it adds greenzone to the Freeroam/play standard spawnpoints to prevent spawnkills, you can add greenzone areas to it using the coordinate format-- Format is: {x = 0, y = 0, z = 0, width = 0, depth = 0, height = 0},local greenzones = { {x = 1435, y = -1795., z = 10, width = 93, depth = 200, height = 20}, -- Grove Street}-- initialize all zones on resource startlocal z = {}function initGreenzones() if greenzones and #greenzones ~= 0 then for _,v in ipairs (greenzones) do if v then if v.x and v.y and v.z and v.width and v.depth and v.height then local c = createColCuboid (v.x, v.y, v.z, v.width, v.depth, v.height) local rarea = createRadarArea (v.x, v.y, v.width, v.depth, 0, 255, 0, 150) setElementParent (rarea, c) if c then z[c] = true for _,p in ipairs (getElementsWithinColShape(c, "player")) do setElementData (p, "greenzone", true) end addEventHandler ("onElementDestroy", c, function() if z[source] then z[source] = nil end end ) addEventHandler ("onColShapeHit", c, function (h, d) if h and d and isElement(h) and getElementType (h) == "player" then setElementData (h, "greenzone", true) outputChatBox ("[SERVER] Güvenli alana geçiş yaptın!", h, 0, 220, 0) end end ) addEventHandler ("onColShapeLeave", c, function (h, d) if h and d and isElement(h) and getElementType (h) == "player" then removeElementData (h, "greenzone") outputChatBox ("[SERVER] Güvenli alandan ayrıldın!", h, 220, 220, 0) end end ) end end end end endendaddEventHandler ("onResourceStart", resourceRoot, initGreenzones)function resetGreenzoneData() for _,p in ipairs (getElementsByType("player")) do if isElement(p) then removeElementData (p, "greenzone") end endendaddEventHandler ("onResourceStop", resourceRoot, resetGreenzoneData)
function initGreenzones() if greenzones and #greenzones ~= 0 then for _,v in ipairs (greenzones) do if v then if v.x and v.y and v.z and v.width and v.depth and v.height then local c = createColCuboid (v.x, v.y, v.z, v.width, v.depth, v.height) local rarea = createRadarArea (v.x, v.y, v.width, v.depth, 0, 255, 0, 150) setElementParent (rarea, c) if c then z[c] = true for _,p in ipairs (getElementsWithinColShape(c, "player")) do setElementData (p, "greenzone", true) end addEventHandler ("onElementDestroy", c, function() if z[source] then z[source] = nil end end ) addEventHandler ("onColShapeHit", c, function (h, d) if h and d and isElement(h) and getElementType (h) == "player" then setElementData (h, "greenzone", true) outputChatBox ("* Greenzone * You have entered the greenzone", h, 0, 220, 0) toggleControl (h, "fire", false) toggleControl (h, "next_weapon", false) toggleControl (h, "previous_weapon", false) toggleControl (h, "aim_weapon", false) toggleControl (h, "vehicle_fire", false) end end ) addEventHandler ("onColShapeLeave", c, function (h, d) if h and d and isElement(h) and getElementType (h) == "player" then removeElementData (h, "greenzone") outputChatBox ("* Greenzone * You have left the greenzone", h, 220, 220, 0) toggleControl (h, "fire", true) toggleControl (h, "next_weapon", true) toggleControl (h, "previous_weapon", true) toggleControl (h, "sprint", true) toggleControl (h, "aim_weapon", true) toggleControl (h, "vehicle_fire", true) end end ) end end end end endend