Jump to content

i need help


Recommended Posts

Posted

hello,

how to cancelEvent when player hit the colShape

and he can't use weapon on the colShape

Best,Regards

____________________________________________________________________________________

Learning lua language

Posted
function cancelColShapeHit() 
    cancelEvent() 
end 
addEventHandler("onColShapeHit", getRootElement(), cancelColShapeHit) 

And you mean you want to prevent him using weapons in the colshape?

Posted
function cancelColShapeHit() 
local SafeA = createColRectangle ( 1607.28125, 1829.31506, 64, 64) 
    cancelEvent() 
end 
addEventHandler("onColShapeHit", getRootElement(), cancelColShapeHit) 

like this ?

not work

____________________________________________________________________________________

Learning lua language

Posted

For a free-fire zone

local SafeA = createColRectangle ( 1607.28125, 1829.31506, 64, 64) 
  
function addRestriction(element) 
    if getElementType(element) ~= 'player' then return end 
    togglePlayerRestrictionless(element,false) 
    setPedWeaponSlot(element,0) 
end 
addEventHandler("onColShapeHit", SafeA , addRestriction) 
  
function remRestriction(element) 
    if getElementType(element) ~= 'player' then return end 
    togglePlayerRestrictionless(element,true) 
end 
addEventHandler("onColShapeLeave", SafeA , remRestriction) 
  
function togglePlayerRestrictionless(player,toggle) 
    toggleControl(player,'fire',toggle) 
    toggleControl(player,'aim_weapon',toggle) 
    toggleControl(player,'next_weapon',toggle) 
    toggleControl(player,'previous_weapon',toggle) 
    toggleControl(player,'vehicle_fire',toggle) 
    toggleControl(player,'vehicle_secondary_fire',toggle) 
end 

Powered by Kimsufi©

n-560x95_FFFFFF_FFFFFF_000000_000000.png

ZHP on FacebookZHP on YoutubeSupport us

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