13.12.2010, 11:37
Hi,is it possible that isplayerinrangeofpoint then the gate automaticly open and it giveplayermoney -$15?
public OnPlayerStateChange(playerid, oldstate, newstate)
{
if(IsPlayerInRangeOfPoint(playerid, distance, x, y, z)) // distance from x,y,z
{
MoveObject(objectid, x, y, z); // x, y, z where the gate will be moved to
GivePlayerMoney(playerid, -115);
}
return 1;
}
pawn Код:
|
public OnGameModeInit()
{
SetTimer("AutoGate", 3000, 1);
return 1;
}
forward AutoGate();
public AutoGate()
{
foreach(Player, i) // Using "foreach" we're going to loop through the online players.
{
if(IsPlayerInRangeOfPoint(i, 20.0, GateX, GateY, GateZ)) // We need to check if the any of the players are in-range of the gate.
{
MoveObject(OBJECT_ID, GateOpenX, GateOpenY, GateOpenZ, 2.0); // If they are in-range, let's open it.
SetTimer("AutoGateClose", 3000, 1);
break; // Stop the loop - we found the player.
}
}
return 1;
}
forward AutoGateClose();
public AutoGateClose()
{
MoveObject(OBJECT_ID, GateCloseX, GateCloseY, GateCloseZ, 2.0);
return 1;
}