29.06.2009, 20:42
how do i make something so if a player is in a certain position a action will happen
explain in depth plz i am a noob
explain in depth plz i am a noob
public OnGameModeInit()
{
SetTimer("MyAction", 100, true);
return 1;
}
forward MyAction();
public MyAction()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerToPoint(Float:Radi, playerid, PosX, PosX, PosZ))
{
//The Action
}
}
}
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
return 0;
}
if(IsPlayerInArea(playerid, max x, min x, max y, min y)