DakiLLa Posted July 29, 2008 Share Posted July 29, 2008 (edited) 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 Edited July 29, 2008 by Guest Link to comment
Ace_Gambit Posted July 29, 2008 Share Posted July 29, 2008 (edited) 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 July 29, 2008 by Guest Link to comment
50p Posted July 29, 2008 Share Posted July 29, 2008 Why do you take weapons from everyone when someone leaves the area? Link to comment
DakiLLa Posted July 29, 2008 Author Share Posted July 29, 2008 takeAllWeapons ( thePlayer ) *fixed* 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