Jump to content

Radar Area


DakiLLa

Recommended Posts

I have made DM zone and if player entering the zone - server gives him a weapon, but it dont works. Can you find my mistake? I'm new in lua.

  
local DMArea = createColCuboid ( 2597.5454, 1792.6381, 10.9765, 100, 100, 100 ) 
local DMRadar = createRadarArea ( 2597.5454, 1792.6381, 100, 100, 255, 0, 0 ) 
  
function DM_enter (thePlayer, matchingDimension ) 
    outputChatBox( getClientName(thePlayer) .. " entered DM-zone ", getRootElement(), 241, 166, 10 ) 
    giveWeapon (thePlayer, 31, 200 ) 
end 
addEventHandler ( "onColShapeHit", DMArea, DM_enter ) 
  
function DM_exit (thePlayer, matchingDimension ) 
    if isPlayerDead (thePlayer ) ~= true then 
        takeAllWeapons ( thePlayer ) 
    end 
end 
addEventHandler ( "onColShapeLeave", DMArea, DM_exit ) 
  

thx for replies :wink:

Edited by Guest
Link to comment

The first parameter of onColShapeHit and onColShapeLeave can be a player or vehicle element.

  
function DM_enter (thePlayer, matchingDimension ) 
  if (getElementType(thePlayer) == "player") then 
    outputChatBox( getClientName(thePlayer) .. "entered DM-zone", getRootElement(), 241, 166, 10 ) 
    giveWeapon (thePlayer, 31, 200 ) 
  end 
end 
  

  
function DM_exit (thePlayer, matchingDimension ) 
  if (getElementType(thePlayer) == "player") then 
    if isPlayerDead (thePlayer ) ~= true then 
        takeAllWeapons ( thePlayer  ) 
    end 
  end 
end 
  

EDIT:

Yea, typo.

Edited by Guest
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...