Snakegold Posted July 27, 2018 Share Posted July 27, 2018 Why they can kill me while i'm in the safezone?? x, y, size = 228.22802734375, 295.55911254883, 120 local greenzone = createColRectangle ( -2434.68799, -688.11896, 150, 200 ) local greenzonemaparea = createRadarArea (-2434.68799, -688.11896, 150, 200, 0, 255, 0, 100) function greenzoneEnter ( thePlayer, matchingDimension ) if getElementData(thePlayer,"invincible",false) then setElementData(thePlayer,"invincible",true) if getElementType( thePlayer ) ~= "player" then return end setElementData(thePlayer,"invincible",false) outputChatBox ( "* You Entered The Greenzone!", thePlayer, 50, 252, 3 ) 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 end addEventHandler ( "onColShapeHit", greenzone, greenzoneEnter ) function greenzoneExit ( thePlayer, matchingDimension ) if getElementType( thePlayer ) ~= "player" then return end outputChatBox ( "* You Left The Greenzone!", thePlayer, 50, 252, 3 ) 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 ) -- a,ti death addEventHandler ( "onClientPlayerDamage",root, function () if getElementData(source,"invincible") then cancelEvent() end end) addEventHandler("onClientPlayerStealthKill",localPlayer, function (targetPlayer) if getElementData(targetPlayer,"invincible") then cancelEvent() end end) Link to comment
Dimos7 Posted July 27, 2018 Share Posted July 27, 2018 First you put it false and second you dont check if true to can el the damage 1 Link to comment
Erknneto Posted July 27, 2018 Share Posted July 27, 2018 You were making some functions not work as they should, and you're not using client-side when you need to be using. This may be working. SERVER SIDE --[[ SERVER SIDE --]] local greenzone = createColRectangle(-2434.68799,-688.11896,150,200) local greenzoneMap = createRadarArea(-2434.68799,-688.11896,150,200,0,255,0,100) function greenzoneEnter (element) if ( getElementType(element) == "player" ) then if not ( getElementData(element,"invincible") ) then setElementData(element,"invincible",true) end outputChatBox("You've entered the greenzone!",element,50,252,3) toggleControl(element,"fire",false) toggleControl(element,"next_weapon",false) toggleControl(element,"previous_weapon",false) toggleControl(element,"aim_weapon",false) toggleControl(element,"vehicle_fire",false) toggleControl(element,"vehicle_secondary_fire",false) setPedWeaponSlot(element,0) end end addEventHandler("onColShapeHit",greenzone,greenzoneEnter) function greenzoneLeave (element) if ( getElementType(element) == "player" ) then if ( getElementData(element,"invincible") ) then setElementData(element,"invincible",false) end outputChatBox("You've left the greenzone!",element,50,252,3) toggleControl(element,"fire",true) toggleControl(element,"next_weapon",true) toggleControl(element,"previous_weapon",true) toggleControl(element,"aim_weapon",true) toggleControl(element,"vehicle_fire",true) toggleControl(element,"vehicle_secondary_fire",true) end end addEventHandler("onColShapeLeave",greenzone,greenzoneEnter) CLIENT SIDE --[[ CLIENT SIDE --]] addEventHandler("onClientPlayerDamage",getLocalPlayer(),function() if ( getElementData(localPlayer,"invincible") ) then cancelEvent() end end) addEventHandler("onClientPlayerStealthKill",getLocalPlayer(),function(target) if ( getElementData(target,"invincible") ) then cancelEvent() end end) 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now