14.01.2018, 03:28
PHP код:
stock AutoOpenOrgGates(playerid)
{
SetTimerEx("AutoOpenOrgGate", 3000, true, "i", playerid);
}
PHP код:
forward AutoOpenOrgGate(playerid);
public AutoOpenOrgGate(playerid)
{
new done, str[265], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
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][gOOwned] != 0)
{
if(GetPVarInt(playerid, "playerorg") != 0)
{
format(str, sizeof(str), "org%d", GetPVarInt(playerid, "playerorg"));
if(GateInfo[idx][gOOwned]!= 0)
{
if(!GateInfo[idx][gStatus])
{
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]);
SendClientMessage(playerid, COLOR_YELLOW,"Thanks for visiting in your org, the gate will close automatically");
break;
}
}
else {
format(str, sizeof(str), "This gate has been assigned to '%s' you cant open it.", GateInfo[idx][gOOwned]);
SendClientMessage(playerid, COLOR_WHITE, str);
break;
}
}
else {
format(str, sizeof(str), "This gate has been assigned to '%s' you cant open it.", GateInfo[idx][gOOwned]);
SendClientMessage(playerid, COLOR_WHITE, str);
break;
}
}
}
}
}
return 1;
}