18.10.2011, 19:49
Add this on top of script
Add this somewhere you want after OnGameModeInit or somefhing
Usage of if(ProxDetectorS(8.0, playerid, targetid))
It will get the distance of playerid and target name and if its true it will continue
pawn Код:
forward ProxDetectorS(Float:radi, playerid, targetid);
pawn Код:
public ProxDetectorS(Float:radi, playerid, targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
GetPlayerPos(targetid, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
pawn Код:
8.0 = The Radius Like if the radius between the 2 varibles.
playerid = Player One You can use whatever you want
targetid = Player 2 You can use whatever you want here