Automatic Gates Open/Close
#5

This forum is not about asking people to do it for you.
This is what you need to do:

You will have to create a timer to check for example very 2/3 seconds if a player is near a gate.
This can be done like this:
You can create something like this inside that timer to check which gate the player is near.
PHP код:
for(new idx=1idx<MAX_GATESidx++)
{
    new 
Float:cur[3];
    if(
GateInfo[idx][gModel])
    {
        
GetDynamicObjectPos(GateInfo[idx][gGate], cur[0], cur[1], cur[2]);
        if(
IsPlayerInRangeOfPoint(playerid8cur[0], cur[1], cur[2]) || IsPlayerInRangeOfPoint(playerid8GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]) || IsPlayerInRangeOfPoint(playerid8GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ]))
        {
            
//do something to open the gate
        
}
    }

So after the script checked which gate the player is near, you will have to open and close this gate.

This can be done like this:

PHP код:
if(GateInfo[idx][gOwner]!= 0)
    {
        if(!
GateInfo[idx][gStatus]) // open the gate
        
{
            
GateInfo[idx][gStatus] = 1;
            
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
            
// add a timer to close the gate here
            
break;
        }
    }
    else return 
0// If player does not 
If you don't succeed. post what you did try and we will gladly try to help you.
Reply


Messages In This Thread
Automatic Gates Open/Close - by BulletRaja - 10.01.2018, 17:10
Re: Automatic Gates Open/Close - by solstice_ - 10.01.2018, 19:08
Re: Automatic Gates Open/Close - by BulletRaja - 11.01.2018, 08:11
Re: Automatic Gates Open/Close - by Ritzy2K - 11.01.2018, 12:32
Re: Automatic Gates Open/Close - by jasperschellekens - 11.01.2018, 12:34
Re: Automatic Gates Open/Close - by BulletRaja - 11.01.2018, 12:50
Re: Automatic Gates Open/Close - by jasperschellekens - 11.01.2018, 12:53
Re: Automatic Gates Open/Close - by BulletRaja - 11.01.2018, 13:06
Re: Automatic Gates Open/Close - by jasperschellekens - 11.01.2018, 13:30
Re: Automatic Gates Open/Close - by BulletRaja - 11.01.2018, 14:01

Forum Jump:


Users browsing this thread: 3 Guest(s)