Jump to content

onClientPlayerDamage


DLmass

Recommended Posts

x, y, size = 1844.5594482422, 1375.3376464844, 120 
local greenzone = createColRectangle ( 1844.5594482422, 1375.3376464844, 284, 312.22 ) 
local greenzonemaparea = createRadarArea (1844.5594482422, 1375.3376464844, 284, 312.22, 0, 255, 0, 120) 
  
function greenzoneEnter ( thePlayer, matchingDimension ) 
    if getElementType( thePlayer ) ~= "player" then return end 
    triggerClientEvent(thePlayer, "zoneEnter", thePlayer) 
    toggleControl ( thePlayer, "fire", false ) 
    toggleControl ( thePlayer, "next_weapon", false ) 
    toggleControl ( thePlayer, "previous_weapon", false ) 
    setPedWeaponSlot ( thePlayer, 0 ) 
    toggleControl ( thePlayer, "aim_weapon", false ) 
    toggleControl ( thePlayer, "vehicle_fire", false ) 
    toggleControl ( thePlayer, "vehicle_secondary_fire", false ) 
    removeEventHandler ("onClientPlayerDamage", getRootElement(), cancelEventEvent) 
end 
addEventHandler ( "onColShapeHit", greenzone, greenzoneEnter ) 
  
  
function greenzoneExit ( thePlayer, matchingDimension ) 
    if getElementType( thePlayer ) ~= "player" then return end 
    triggerClientEvent(thePlayer, "zoneExit", thePlayer) 
    toggleControl ( thePlayer, "fire", true ) 
    toggleControl ( thePlayer, "next_weapon", true ) 
    toggleControl ( thePlayer, "previous_weapon", true ) 
    toggleControl ( thePlayer, "aim_weapon", true ) 
    toggleControl ( thePlayer, "vehicle_fire", true ) 
    toggleControl ( thePlayer, "vehicle_secondary_fire", true ) 
    removeEventHandler ("onClientPlayerDamage", getRootElement(), triggerEvent) 
end 
addEventHandler ( "onColShapeLeave", greenzone, greenzoneExit ) 
  

i tried to add:

removeEventHandler ("onClientPlayerDamage", getRootElement(), cancelEventEvent) 

but it diden't work... becouse players outside the greenzone can shoot players inside and that makes them die

Edited by Guest
Link to comment
x, y, size = 1844.5594482422, 1375.3376464844, 120 
local greenzone = createColRectangle ( 1844.5594482422, 1375.3376464844, 284, 312.22 ) 
local greenzonemaparea = createRadarArea (1844.5594482422, 1375.3376464844, 284, 312.22, 0, 255, 0, 120)                                                                   safe = false  
function greenzoneEnter ( thePlayer, matchingDimension ) 
    if getElementType( thePlayer ) ~= "player" then return end 
                                  safe = true triggerClientEvent(thePlayer, "zoneEnter", thePlayer) 
    toggleControl ( thePlayer, "fire", false ) 
    toggleControl ( thePlayer, "next_weapon", false ) 
    toggleControl ( thePlayer, "previous_weapon", false ) 
    setPedWeaponSlot ( thePlayer, 0 ) 
    toggleControl ( thePlayer, "aim_weapon", false ) 
    toggleControl ( thePlayer, "vehicle_fire", false ) 
    toggleControl ( thePlayer, "vehicle_secondary_fire", false ) 
end 
addEventHandler ( "onColShapeHit", greenzone, greenzoneEnter ) 
  
  
function greenzoneExit ( thePlayer, matchingDimension ) 
    if getElementType( thePlayer ) ~= "player" then return end 
                                 safe = false triggerClientEvent(thePlayer, "zoneExit", thePlayer) 
    toggleControl ( thePlayer, "fire", true ) 
    toggleControl ( thePlayer, "next_weapon", true ) 
    toggleControl ( thePlayer, "previous_weapon", true ) 
    toggleControl ( thePlayer, "aim_weapon", true ) 
    toggleControl ( thePlayer, "vehicle_fire", true ) 
    toggleControl ( thePlayer, "vehicle_secondary_fire", true ) 
end 
addEventHandler ( "onColShapeLeave", greenzone, greenzoneExit )              addEventHandler ("onClientPlayerDamage", getRootElement(), function()                    if safe == true then       
                                    cancelEvent()           end                          end) 
  

this full code

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