Detecting nearby Andromadas
#2

Hey,

pawn Код:
if(newkeys == KEY_JUMP)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new Float:ax,Float:ay,Float:az,Float:px,Float:py,Float:pz, ID=-1, Float:Distance = 20.0; //Max. Distamce to the Adnromada. (Set to 20.0)
        GetPlayerPos(playerid,px,py,pz);
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            if(GetVehicleModel(i) == 592)
            {
                GetVehiclePos(i, Float:ax, Float:ay, Float:az);
                new Float:tmp=floatsqroot( ( (ax-px)*(ax-px) ) + ( (ay-py)*(ay-py) ) + ( (az-pz)*(az-pz) ) );
                if(Distance>tmp)
                {
                    Distance=tmp;
                    ID=i;
                }
            }
        }
        if(ID != -1) SendClientMessage(playerid, COLOR_GREEN, "IT WORKS!!");
        else SendClientMessage(playerid, COLOR_RED, "You are not near an Andromada!");
        }
    }
    else SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle!");
}
Try this. I use a similar thing for my Property System.

Cheers!
Reply


Messages In This Thread
Detecting nearby Andromadas - by Prostilov - 25.08.2012, 16:03
Re: Detecting nearby Andromadas - by Jeffry - 25.08.2012, 17:30
Re: Detecting nearby Andromadas - by Prostilov - 25.08.2012, 18:54
Re: Detecting nearby Andromadas - by Prostilov - 25.08.2012, 19:33

Forum Jump:


Users browsing this thread: 1 Guest(s)