11.01.2018, 12:34
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.
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:
If you don't succeed. post what you did try and we will gladly try to help 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=1; idx<MAX_GATES; idx++)
{
new Float:cur[3];
if(GateInfo[idx][gModel])
{
GetDynamicObjectPos(GateInfo[idx][gGate], cur[0], cur[1], cur[2]);
if(IsPlayerInRangeOfPoint(playerid, 8, cur[0], cur[1], cur[2]) || IsPlayerInRangeOfPoint(playerid, 8, GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]) || IsPlayerInRangeOfPoint(playerid, 8, GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ]))
{
//do something to open the 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