Jump to content

Recommended Posts

Posted

Hey all, looking into getting into some scripting for Rage, I know a fair amount but something I seem to have hit a roadblock with and cant find any answers to is whether or not it is possible to set up regions, for example lets say i wanted the whole map to be able to do a pick locking script, but if you are at Mission Row PD, that script is disabled whilst you are in the region. 

Could anyone advise me on this? 

Many Thanks 

Posted

what do you exactly mean by "Region" is it like an area,so from my understanding and correct me if im wrong,you want a specific task/script to be triggered/ran for all players excluding those in that specific region or area?

Posted
2 hours ago, hash_ said:

what do you exactly mean by "Region" is it like an area,so from my understanding and correct me if im wrong,you want a specific task/script to be triggered/ran for all players excluding those in that specific region or area?

Yes, that is exactly what i want. Or more specifically a regions that when entered disables a pick locking script for that individual player 

Posted (edited)

Well you can make that using colshapes 

 

Define the area using a colshape and do something like

OnPlayerEnterColShape(player,colshape)
if(colshape = region)//if the colshape the player entered is equal to the colshape that you've set for the specific area or region
player.setdata("DISABLEPICKLOCK",true);//set the data for the player so that he has this data

//and when the player leaves the colshape u can do something like
  
 OnPlayerExitColShape(player,colshape)
  if(colshape == region)
  player.resetData("DISABLEPICKLOCK");// or you can simply use player.setdata(DISABLEPICKLOCK,false) if you're planning to use it later

//then when a player tries to pick a lock we check if he has the data or not..
if(player.hasdata("DISABLEPICKLOCK")) //he has this data which means he cannot pick lock simply return; to stop the funciton from executing.
else
  //continue the lock picking...
  
  
        
  

there are more than one colshape types,rect,circle etc...

 

do some googling and pick the one that suits your needs the most, but the concept is the same.

 

another approach would be to use vdist

mp.game.system.vdist(x1, y1, z1, x2, y2, z2);

this is client side you pass the current player position to the argument and pass the point x y z that is your region coords,this function will then calculate the distance between the player's position and the region and return a value then you can do a simple comparison like 

if(value > 3) return; //player is too far from the region or no where near it

 

Edited by hash_

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