Jump to content

Help with radar area.


Bilal135

Recommended Posts

My script works fine, but the dx text appears just for a second on hit of col shape and won't stay until I leave the radar area. So here's it, I can't find anyway to solve this problem so I'm here to ask for help.

server

local radararea = createRadarArea(1338.5789794922, -1753.3083496094, 200, 200, 255, 0, 0) 
local col = createColRectangle(1338.5789794922, -1753.3083496094, 100, 200) 
function sa() 
         setElementAlpha(radararea, 100) 
end 
addEventHandler("onResourceStart", root, sa)  
  
function areaEnter(thePlayer, matchingDimension) 
         if (getElementType(thePlayer) == "player") then 
         setRadarAreaFlashing(radararea, true) 
         triggerClientEvent(thePlayer, "colHit", thePlayer) 
end 
end 
addEventHandler("onColShapeHit", getRootElement(), areaEnter) 
  
function areaExit(thePlayer, matchingDimension) 
         if (getElementType(thePlayer) == "player") then 
         if isPedDead(thePlayer) ~= true then 
         setRadarAreaFlashing(radararea, false) 
end 
end 
end 
addEventHandler("onColShapeLeave", getRootElement(), areaExit) 

client:

addEvent("colHit", true) 
addEventHandler("colHit", root, 
function() 
dxDrawText("You have entered the red zone. A hidden package (Gunbox) can be found here.", 378, 594, 1055, 680, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false) 
  
end 
) 

Link to comment

Server :

  
local radararea = createRadarArea(1338.5789794922, -1753.3083496094, 200, 200, 255, 0, 0) 
local col = createColRectangle(1338.5789794922, -1753.3083496094, 100, 200) 
  
function sa() 
setElementAlpha(radararea, 100) 
end 
addEventHandler("onResourceStart", root, sa) 
      
function areaEnter(thePlayer, matchingDimension) 
if (getElementType(thePlayer) == "player") then 
setRadarAreaFlashing(radararea, true) 
triggerClientEvent(thePlayer, "colHit", thePlayer) 
end 
end 
addEventHandler("onColShapeHit", getRootElement(), areaEnter) 
      
function areaExit(thePlayer, matchingDimension) 
if (getElementType(thePlayer) == "player") then 
if isPedDead(thePlayer) ~= true then 
setRadarAreaFlashing(radararea, false) 
triggerClientEvent(thePlayer, "colLeave", thePlayer) 
end 
end 
end 
addEventHandler("onColShapeLeave", getRootElement(), areaExit) 
  

Client :

  
function drawText () 
dxDrawText("You have entered the red zone. A hidden package (Gunbox) can be found here.", 378, 594, 1055, 680, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false) 
end 
addEvent("colHit", true) 
addEventHandler("colHit", root, 
function() 
addEventHandler("onClientRender", root, drawText) 
end 
) 
addEvent("colLeave", true) 
addEventHandler("colLeave", root, 
function() 
removeEventHandler( "onClientRender", root, drawText ) 
end 
) 
  

Probably u need edit the size of createColRectangle

Link to comment
function draw() 
     dxDrawText("You have entered the red zone. A hidden package (Gunbox) can be found here.", 378, 594, 1055, 680, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false) 
end 
addEvent("colHit", true) 
addEventHandler("colHit", root, draw) 
addEventHandler("onClientRender", root, draw) 

Link to comment
function draw() 
     dxDrawText("You have entered the red zone. A hidden package (Gunbox) can be found here.", 378, 594, 1055, 680, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false) 
end 
addEvent("colHit", true) 
addEventHandler("colHit", root, draw) 
addEventHandler("onClientRender", root, draw) 

That works, but it doesn't get removed when out of the zone.

EDIT: it appears as the resource starts, no matter if the player is out of redzone or not.

Link to comment

Server:

local radararea = createRadarArea(1338.5789794922, -1753.3083496094, 200, 200, 255, 0, 0) 
local col = createColRectangle(1338.5789794922, -1753.3083496094, 100, 200) 
function sa() 
         setElementAlpha(radararea, 100) 
end 
addEventHandler("onResourceStart", root, sa) 
  
function areaEnter(thePlayer, matchingDimension) 
         if (getElementType(thePlayer) == "player") then 
         setRadarAreaFlashing(radararea, true) 
         triggerClientEvent(thePlayer, "colHit", thePlayer) 
end 
end 
addEventHandler("onColShapeHit", getRootElement(), areaEnter) 
  
function areaExit(thePlayer, matchingDimension) 
         if (getElementType(thePlayer) == "player") then 
         if isPedDead(thePlayer) ~= true then 
         setRadarAreaFlashing(radararea, false) 
         triggerClientEvent(thePlayer, "colLeave", thePlayer) 
end 
end 
end 
addEventHandler("onColShapeLeave", getRootElement(), areaExit) 

Client:

function Draw() 
     dxDrawText("You have entered the red zone. A hidden package (Gunbox) can be found here.", 378, 594, 1055, 680, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false) 
end 
addEvent("colHit", true) 
addEventHandler("colHit", root, 
      function() 
           addEventHandler("onClientRender", root, Draw) 
      end 
) 
  
addEvent("colLeave", true) 
addEventHandler("colLeave", root, 
     function() 
           removeEventHandler("onClientRender", root, Draw) 
     end 
) 

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