killingyasoon Posted September 6, 2018 Share Posted September 6, 2018 (edited) local safezone = createColRectangle (22,22,22,20,30) --this is just a random number.. local Radar = createRadarArea ( 790.6, -1120.1,50,50,r, g, b, alpha) addEventHandler ( "onColShapeHit", safezone, function (thePlayer,matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire",false ) end end) addEventHandler ( "onColShapeLeave", safezone, function ( thePlayer, matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire", true ) end end) how can i change the dim of this safezone ?, i tried doing everything, any help would be appreciated. Edited September 6, 2018 by killingyasoon Link to comment
iMr.WiFi..! Posted September 6, 2018 Share Posted September 6, 2018 setElementDimension 1 Link to comment
killingyasoon Posted September 6, 2018 Author Share Posted September 6, 2018 can you add it here? please if you dont mind. Link to comment
Sorata_Kanda Posted September 6, 2018 Share Posted September 6, 2018 local safezone = createColRectangle (22,22,22,20,30) --this is just a random number.. setElementDimension( safezone, 3 ) -- Dimension is 3, you can use another number aswell. local Radar = createRadarArea ( 790.6, -1120.1,50,50,r, g, b, alpha) addEventHandler ( "onColShapeHit", safezone, function (thePlayer,matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire",false ) end end) addEventHandler ( "onColShapeLeave", safezone, function ( thePlayer, matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire", true ) end end) Link to comment
killingyasoon Posted September 6, 2018 Author Share Posted September 6, 2018 9 minutes ago, Sorata_Kanda said: local safezone = createColRectangle (22,22,22,20,30) --this is just a random number.. setElementDimension( safezone, 3 ) -- Dimension is 3, you can use another number aswell. local Radar = createRadarArea ( 790.6, -1120.1,50,50,r, g, b, alpha) addEventHandler ( "onColShapeHit", safezone, function (thePlayer,matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire",false ) end end) addEventHandler ( "onColShapeLeave", safezone, function ( thePlayer, matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire", true ) end end) nothing happend so far. Link to comment
Sorata_Kanda Posted September 6, 2018 Share Posted September 6, 2018 (edited) 14 minutes ago, killingyasoon said: nothing happend so far. Your parameters for createColRectangle are wrong. You have to delete a number. Edited September 6, 2018 by Sorata_Kanda grammar mistake Link to comment
killingyasoon Posted September 6, 2018 Author Share Posted September 6, 2018 still nothing.. Link to comment
Sorata_Kanda Posted September 6, 2018 Share Posted September 6, 2018 4 minutes ago, killingyasoon said: still nothing.. Please check, if your safezone is even created or not. I'll try your script as soon as I'm back at home. if safezone then outputDebugScript("Safezone was created.") else outputDebugScript("Safezone could not be created.") end Link to comment
killingyasoon Posted September 6, 2018 Author Share Posted September 6, 2018 actually it's working but on main dim. Link to comment
Sorata_Kanda Posted September 6, 2018 Share Posted September 6, 2018 (edited) I tried the script and it's working. You cannot see the colshape unless you have development mode activated and use the client-sided commandsh showcol Add this to a client script and activate development mode. Then type /showcol 1 and go to the position of your collision shape. addCommandHandler("devmode", function(source) if getDevelopmentMode then setDevelopmentMode(false) outputChatBox("Development mode deactivated") else setDevelopmentMode(true) outputChatBox("Development mode activated") end end) EDIT: Don't forget to declare this <min_mta_version server="1.5.4-9.11305" client="1.1.1-9.03355" /> in your meta.xml as setDevelopmentMode won't work then. Edited September 6, 2018 by Sorata_Kanda Link to comment
killingyasoon Posted September 6, 2018 Author Share Posted September 6, 2018 (edited) thank you, it works . Edited September 6, 2018 by killingyasoon Link to comment
Sorata_Kanda Posted September 6, 2018 Share Posted September 6, 2018 (edited) 20 minutes ago, killingyasoon said: i can see the collision, but it doesn't toggle shooting, plus it the radar area shows up on the main map, sorry ik i am a :O. Look up addEventHandler("onWeaponFire", ...) Normally, when you cancel the event, you shouldn't be able to damage players. Edited September 6, 2018 by Sorata_Kanda Link to comment
killingyasoon Posted September 6, 2018 Author Share Posted September 6, 2018 1 minute ago, Sorata_Kanda said: Look up addEventHandler("onWeaponFire", ...) Normally, when you cancel the event, you shouldn't be able to damage players. it works totally fine right now thank you bud, appreciated. 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