20.09.2013, 12:15
fmz tenta assim entгo
pawn Код:
#include <a_samp>
new portao;
forward pp();
forward pp2(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public OnGameModeExit()
{
SetTimer("pp", 1000, false);
return 1;
}
public pp()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
pp2(i);
}
return 1;
}
public pp2(playerid)
{
if(PlayerToPoint(11.0, playerid, 213.8, 1875.0, 11.3))
{
MoveObject(portao, 200.8, 1875.0, 11.3, 5);
}
else
{
MoveObject(portao, 213.8, 1875.0, 11.3, 5);
}
return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
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;
}