CMD:tankol(playerid){ if(IsPlayerInRangeOfPoint(playerid, 8.0,-2026.0741,156.0420,28.6122)){ if(NearestCar(playerid) == -1) { SendClientMessage(playerid, -1, \"(( Nincs a közeledben jármű! ))\"); }else if(NearestCar(playerid) == -2) { SendClientMessage(playerid, -1, \"(( Túl sok jármű van a közeledben! ))\"); }else { ShowPlayerDialog(playerid,tankoldialog,DIALOG_STYLE_LIST,\"Tankolás\",\"349 Ft / liter\\t\\tBenzin 95\\n343 Ft / liter\\t\\tBenzin 98\\n352 Ft / liter\\t\\tDiesel\",\"Mehet\",\"Mégse\"); }} else SendClientMessage(playerid,-1,\"(( Nem vagy benzinkúton! ))\");return 1;}
NearestCar(playerid){new Float:Pos[3],eredmeny,mennyinel;for(new carid = 1; carid < MAX_VEHICLES; carid++){GetVehiclePos(carid,Pos[0],Pos[1],Pos[2]);if(IsPlayerInRangeOfPoint(playerid, 3.5,Pos[0],Pos[1],Pos[2])){ eredmeny = carid; mennyinel ++;}}if(eredmeny != 0) { if(mennyinel == 1) { return eredmeny; } else { return -2; } } else { return -1; }}
stock GetClosestVehicle( playerid ){new iMax=INVALID_VEHICLE_ID,Float:dis,Float:dMax = float( 10000 ),Float:VehiclePos[ 3 ];for( new x = 0; x < MAX_VEHICLES; x++ ){GetVehiclePos( x, VehiclePos[ 0 ], VehiclePos[ 1 ], VehiclePos[ 2 ] );dis = GetPlayerDistanceFromPoint(playerid, VehiclePos[ 0 ], VehiclePos[ 1 ], VehiclePos[ 2 ]);if( dis < dMax ){ dMax = dis, iMax = x;}}return iMax;}
stock NearestVehicle(playerid){new carid = -1,Float:pos[3],Float:dis;GetPlayerPos(playerid,pos[0],pos[1],pos[2]);for(new i=0;i<MAX_VEHICLES;i++){dis = GetVehicleDistanceFromPoint(i,pos[0],pos[1],pos[2]);if(dis < 3.5) carid = i;}return carid;}
stock NearestVehicle(playerid){new carid = -1,Float:pos[3],Float:dis,szamolas;GetPlayerPos(playerid,pos[0],pos[1],pos[2]);for(new i=0;i<MAX_VEHICLES;i++){dis = GetVehicleDistanceFromPoint(i,pos[0],pos[1],pos[2]);if(dis < 3.5) { carid = i; szamolas++;}}if(szamolas == 1)return carid;return -1;}