Jump to content

[help]turf system


MoeezKhan

Recommended Posts

hi this turf system when i join in criminal and then i go in turf it blinking but colour not change

----client side----------

function godmodeHandler () 
  cancelEvent () 
end 
  
addEvent ("enableGodMode",true) 
addEventHandler ("enableGodMode",getRootElement(), 
function() 
  if (source == getLocalPlayer()) then 
    addEventHandler ("onClientPlayerDamage",getRootElement(),godmodeHandler) 
  end 
end) 
  
addEvent ("disableGodMode",true) 
addEventHandler ("disableGodMode",getRootElement(), 
function() 
  if (source == getLocalPlayer()) then 
    removeEventHandler ("onClientPlayerDamage",getRootElement(),godmodeHandler) 
  end 
end) 

-----server side----

addEventHandler ("onResourceStart",getResourceRootElement(getThisResource()), 
function() 
  local allGreenzones = getElementsByType ("radararea") 
  for i,v in ipairs (allGreenzones) do 
    local r,g,b,a = getRadarAreaColor (v) 
    if (r == 0) and (g == 255) and (b == 0) and (a == 127) then 
      local x,y = getElementPosition (v) 
      local sx,sy = getRadarAreaSize (v) 
      local col = createColCuboid (x,y, -50, sx,sy, 7500) 
      setElementID (col, "greenzoneColshape") 
    end 
  end 
end) 
  
addEventHandler ("onColShapeHit", getRootElement(),  
function(hitElement, matchingDimension) 
  if (isElement(hitElement)) and (getElementType (hitElement) == "player") and (getElementID (source) == "greenzoneColshape") then 
    triggerClientEvent (hitElement, "enableGodMode", hitElement) 
    outputDebugString (getPlayerName(hitElement) .. " has entered the Grove turf") 
  end 
end) 
  
addEventHandler ("onColShapeLeave", getRootElement(),  
function(leaveElement, matchingDimension) 
  if (getElementType (leaveElement) == "player") and (getElementID (source) == "greenzoneColshape") then 
    triggerClientEvent (leaveElement, "disableGodMode", leaveElement) 
    outputDebugString (getPlayerName(leaveElement) .. " has left the Grove turf") 
  end 
end) 

--map side-----

    "-50" posY="-50" sizeX="100" sizeY="100" color="#000000" dimension="0" /> 
    "25" posY="25" sizeX="100" sizeY="100" color="#7D053F" dimension="0" /> 
    "60" posY="60" sizeX="100" sizeY="100" color="#565051" dimension="0" /> 

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