15.09.2011, 22:16
que un comando funcione cuando un jugador este serca de otro jugador unos 3 metro o mas.
forward JugadorCercaDeJugador(Float:R, playerid, targetid);
public JugadorCercaDeJugador(Float:R, playerid, targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Float:aX, Float:aY, Float:aZ;
new Float:bX, Float:bY, Float:bZ;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, bX, bY, bZ);
GetPlayerPos(targetid, aX, aY, aZ);
X = (bX - aX);
Y = (bY - aY);
Z = (bZ - aZ);
if (((X < R) && (X > -R)) && ((Y < R) && (Y > -R)) && ((Z < R) && (Z > -R)))
{
return 1;
}
}
return 0;
}
if(JugadorCercaDeJugador(5.0, playerid, jugador2))
{
//Comando
}