02.04.2009, 16:22
Quote:
|
Originally Posted by raydrezack
Well, I honestly wasn't exactly sure how to do such a thing with "AddAutoGate", so I just used the typical auto gate method:
Код:
#include <a_samp>
new gate;
new gate2;
new OpenGate[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Auto Gates ");
print("--------------------------------------\n");
gate = CreateObject(10841, 2207.830322, -3391.702148, 15.105540, 0.0,0.0,90.00);
gate2 = CreateObject(2634, 2322.646484, -3393.401855, 18.768494, 0.0, 0.0, 00.00);
SetTimerEx("GateCheck", 100, 1, "i");
return 1;
}
forward GateCheck();
public GateCheck()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(PlayerToPoint(5.0, i, 2207.830322, -3391.702148, 15.105540) && OpenGate[i] == 0)
{
SetTimerEx("GateOn", 45000, 0, "i");
}
else if(!PlayerToPoint(5.0, i, 2207.830322, -3391.702148, 15.105540) && OpenGate[i] == 1)
{
MoveObject(gate, 2207.830322, -3391.702148, 15.105540, 5.0);
OpenGate[i] = 0;
}
}
}
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(PlayerToPoint(5.0, i, 2322.646484, -3393.401855, 18.768494) && OpenGate[i] == 0)
{
SetTimerEx("GateOn2", 45000, 0, "i");
}
else if(!PlayerToPoint(5.0, i, 2322.646484, -3393.401855, 18.768494) && OpenGate[i] == 1)
{
MoveObject(gate2, 2322.646484, -3393.401855, 18.768494, 5.0);
OpenGate[i] = 0;
}
}
}
return 1;
}
forward GateOn();
public GateOn()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
MoveObject(gate, 2207.830322, -3391.702148, 0, 5.0);
OpenGate[i] = 1;
return 1;
}
}
return 0;
}
forward GateOn2();
public GateOn2()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
MoveObject(gate2, 2322.646484, -3393.401855, 0, 5.0);
OpenGate[i] = 1;
return 1;
}
}
return 0;
}
stock PlayerToPoint(Float:radi,playerid,Float:x,Float:y,Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) return 1;
return 0;
}
|
thanks in advance,
Borg245

