[Not Solved] PlayernearVehicle car for my alarm system.
#4

It was so easy to get PlayerToPoint and do some transformations. By the way. This script is not tested.

pawn Код:
forward PlayerToVehicle(Float:radi, playerid, carid);

public PlayerToVehicle(Float:radi, playerid, carid)
{
  if(IsPlayerConnected(playerid))
    {
        new Float:x, Float:y, Float:z;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        GetVehiclePos(carid, x, y, z);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)