Jump to content

how to change the dim of that zone.


killingyasoon

Recommended Posts

Posted (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 by killingyasoon
Posted
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) 

 

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

Posted
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

 

Posted (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 by Sorata_Kanda
Posted (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 by Sorata_Kanda
Posted
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.

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