25.08.2012, 17:30
Hey,
Try this. I use a similar thing for my Property System.
Cheers!
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!");
}
Cheers!