10.07.2012, 17:06
(
Последний раз редактировалось clarencecuzz; 10.07.2012 в 18:11.
)
pawn Код:
new Gate;
new bool:IsGateOpen;
public OnGameModeInit() //or OnFilterScriptInit
{
Gate = CreateObject(...); //Here's your gate object
SetTimer("GateOpen", 1000, true); //Start the player check
return 1;
}
forward GateOpen();
public GateOpen()
{
for(new i = 0; i < MAX_PLAYERS; i++) //Start a loop
{
if(IsPlayerConnected(i)) //If player is online
{
if(IsPlayerACop(playerid) == true) //CHANGE THIS LINE!!! **************
{
if(IsPlayerInRangeOfPoint(i, ....) //If they are near the point
{
if(IsGateOpen == false)
{
MoveObject(Gate, ....); //Open Position
IsGateOpen = true;
} }
else
{
if(IsGateOpen == true) {
MoveObject(Gate,....); //Back to closed position
IsGateOpen = false; } }
}
}
}
return 1;
}