11.01.2018, 13:30
PHP код:
// onplayerconnect
OpenGateTimer(playerid);
stock OpenGateTimer(playerid, time)
{
SetTimerEx("OpenGateTimer2", 3000, true, "i", playerid);
}
forward OpenGateTimer2(playerid);
public OpenGateTimer2(playerid)
{
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]))
{
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;
}
}
}
}