como hacer... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (
https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: como hacer... (
/showthread.php?tid=283624)
como hacer... -
(SERGIO) - 15.09.2011
que un comando funcione cuando un jugador este serca de otro jugador unos 3 metro o mas.
Respuesta: como hacer... -
Voychuk - 15.09.2011
pawn Код:
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;
}
Y para el comando pones un
pawn Код:
if(JugadorCercaDeJugador(5.0, playerid, jugador2))
{
//Comando
}
Creditos: Sacado del ProxdetectorS del Ravens 0.3c