If player is close to other player (help)
#1

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
Reply
#2

GetDistanceBetweenPlayers(p1,p2); Search for that.
Reply
#3

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)