If player is close to other player (help) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: If player is close to other player (help) (
/showthread.php?tid=67515)
If player is close to other player (help) -
Yoyoyo - 01.03.2009
I need to make something like if 1 person is like close to 1 player he can like blow him up using a command. So it would be like this
/explode
{
Createexplosion(blah
else if
{
Sendcilentmessage(playerid,COLOR_BLAH, "You are to far away from him to blow him up!");
return 1;
}
Please help. Thank you. If there is a guide to like how to make this you can just send that
Tell me how to make. It has something to do with Isplayerinarea or like Radius / Playertopoint
Re: If player is close to other player (help) -
Rks25 - 01.03.2009
GetDistanceBetweenPlayers(p1,p2); Search for that.
Re: If player is close to other player (help) -
1337pr0 - 02.03.2009
pawn Код:
IsPlayerNearPlayer(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;
}