#define TWO_TIRE_VEHICLE GetVehicleModel(GetPlayerVehicleID(playerid)) == 468
#define SIX_TIRE_VEHICLE GetVehicleModel(GetPlayerVehicleID(playerid)) == 431 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 455 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 433 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 544
#define NO_TIRE_VEHICLE GetVehicleModel(GetPlayerVehicleID(playerid)) == 509 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 510
#define ENGINE_ONLY_VEHICLE GetVehicleModel(GetPlayerVehicleID(playerid)) == 487 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 453 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 473 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 484 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 511 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 417 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 497 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 592
#define TWO_TIRE_VEHICLE_ADD GetVehicleModel(GetVehicleNearID(playerid)) == 468
#define SIX_TIRE_VEHICLE_ADD GetVehicleModel(GetVehicleNearID(playerid)) == 431 || GetVehicleModel(GetVehicleNearID(playerid)) == 455 || GetVehicleModel(GetVehicleNearID(playerid)) == 433 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 544
#define NO_TIRE_VEHICLE_ADD GetVehicleModel(GetVehicleNearID(playerid)) == 509 || GetVehicleModel(GetVehicleNearID(playerid)) == 510
#define ENGINE_ONLY_VEHICLE_ADD GetVehicleModel(GetVehicleNearID(playerid)) == 487 || GetVehicleModel(GetVehicleNearID(playerid)) == 453 || GetVehicleModel(GetVehicleNearID(playerid)) == 473 || GetVehicleModel(GetVehicleNearID(playerid)) == 484 || GetVehicleModel(GetVehicleNearID(playerid)) == 511 || GetVehicleModel(GetVehicleNearID(playerid)) == 417 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 497 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 592
enum vehicleinfo
{
vehicleTires,
vehicleFuel,
vehicleEngine,
vSlot1[64],
vSlot2[64],
vSlot3[64],
vSlot4[64],
vSlot5[64],
vSlot6[64],
Float:vX,
Float:vY,
Float:vZ,
vehicleSlots,
Text3D:vehicleText
}
if(FOUR_TIRE(playerid) || FOUR_TIRE2(playerid))
{
format(str,sizeof(str),"~w~Engine:~r~ %i/1~n~~w~Tires:~r~ %i/4~n~~w~Fuel:~r~ %i/100",
vInfo[GetPlayerVehicleID(playerid)][vehicleEngine],
vInfo[GetPlayerVehicleID(playerid)][vehicleTires],
vInfo[GetPlayerVehicleID(playerid)][vehicleFuel]);
PlayerTextDrawSetString(playerid,vehicleInfo[playerid],str);
PlayerTextDrawShow(playerid, vehicleInfo[playerid]);
}
if(TWO_TIRE_VEHICLE)
{
format(str,sizeof(str),"~w~Engine:~r~ %i/1~n~~w~Tires:~r~ %i/2~n~~w~Fuel:~r~ %i/100",
vInfo[GetPlayerVehicleID(playerid)][vehicleEngine],
vInfo[GetPlayerVehicleID(playerid)][vehicleTires],
vInfo[GetPlayerVehicleID(playerid)][vehicleFuel]);
PlayerTextDrawSetString(playerid,vehicleInfo[playerid],str);
PlayerTextDrawShow(playerid, vehicleInfo[playerid]);
}
if(SIX_TIRE_VEHICLE)
{
format(str,sizeof(str),"~w~Engine:~r~ %i/1~n~~w~Tires:~r~ %i/6~n~~w~Fuel:~r~ %i/100",
vInfo[GetPlayerVehicleID(playerid)][vehicleEngine],
vInfo[GetPlayerVehicleID(playerid)][vehicleTires],
vInfo[GetPlayerVehicleID(playerid)][vehicleFuel]);
PlayerTextDrawSetString(playerid,vehicleInfo[playerid],str);
PlayerTextDrawShow(playerid, vehicleInfo[playerid]);
}
if(NO_TIRE_VEHICLE)
{
format(str,sizeof(str),"~w~Engine:~r~ 0/0~n~~w~Tires:~r~ 0/0~n~~w~Fuel:~r~ 0/0");
PlayerTextDrawSetString(playerid,vehicleInfo[playerid],str);
PlayerTextDrawShow(playerid, vehicleInfo[playerid]);
}
if(ENGINE_ONLY_VEHICLE)
{
format(str,sizeof(str),"~w~Engine:~r~ %i/1~n~~w~Tires:~r~ 0/0~n~~w~Fuel:~r~ %i/100",
vInfo[GetPlayerVehicleID(playerid)][vehicleEngine],
vInfo[GetPlayerVehicleID(playerid)][vehicleFuel]);
PlayerTextDrawSetString(playerid,vehicleInfo[playerid],str);
PlayerTextDrawShow(playerid, vehicleInfo[playerid]);
}
}
CreateVehicle(522,818.0776,-1643.5748,13.3828,8.7501,0,0,0); //NRG
CreateVehicle(544,1268.1787,-1525.3687,13.5606,260.9624,0,0,0);//FIRETRUCK
CreateVehicle(552,1555.7581,-1626.7670,13.3828,81.1073,0,0,0);//Utility Van
CreateVehicle(556,1987.5231,-1382.4735,23.6055,240.1862,0,0,0);//Monster Truck
CreateVehicle(568,2262.4360,-1056.5121,49.6946,9.6666,0,0,0);//Bandito
CreateVehicle(578,2641.6079,-1446.6810,30.2758,271.9059,0,0,0);//DFT-30
CreateVehicle(579,2795.2151,-1544.0227,10.9219,201.0919,0,0,0);//Huntley
CreateVehicle(588,2856.8699,-1646.5342,10.8750,200.1518,0,0,0);//Hotdog
CreateVehicle(487,1716.9417,-2648.7917,13.5469,193.6419,0,0,0); //Maverick
CreateVehicle(592,1444.7480,-2593.4758,13.5469,271.6626,0,0,0); //Andromeda
CreateVehicle(497,1492.4017,-2416.5955,13.5547,149.9198,0,0,0); //Maverick
CreateVehicle(470,2284.8784,-2351.3674,13.5469,50.4473,0,0,0); //Patriot
CreateVehicle(430,3043.9883,-1631.1265,-0.6923,67.6806,0,0,0); //Predator
CreateVehicle(446,838.0151,-2155.6077,-0.5905,120.6344,0,0,0); //Squallo
CreateVehicle(454,544.7344,-2132.8005,-0.4374,319.2429,0,0,0); //Tropic
#define TWO_TIRE_VEHICLE 1 #define SIX_TIRE_VEHICLE 2 #define NO_TIRE_VEHICLE 3 #define ENGINE_ONLY_VEHICLE 4 GetVehicleType(vehicleid) { switch (vehicleid) { case 468: return TWO_TIRE_VEHICLE; case 431, 455, 433, 544: return SIX_TIRE_VEHICLE; case 509, 510: return NO_TIRE_VEHICLE; case 417, 453, 473, 484, 487, 497, 511, 592: return ENGINE_ONLY_VEHICLE; default: return 0; } } // Where you want to use it switch (GetVehicleType(GetPlayerVehicleID(playerid))) { case TWO_TIRE_VEHICLE: { } case SIX_TIRE_VEHICLE: { } case NO_TIRE_VEHICLE: { } case ENGINE_ONLY_VEHICLE: { } }
Код:
#define TWO_TIRE_VEHICLE 1 #define SIX_TIRE_VEHICLE 2 #define NO_TIRE_VEHICLE 3 #define ENGINE_ONLY_VEHICLE 4 GetVehicleType(vehicleid) { switch (vehicleid) { case 468: return TWO_TIRE_VEHICLE; case 431, 455, 433, 544: return SIX_TIRE_VEHICLE; case 509, 510: return NO_TIRE_VEHICLE; case 417, 453, 473, 484, 487, 497, 511, 592: return ENGINE_ONLY_VEHICLE; default: return 0; } } // Where you want to use it switch (GetVehicleType(GetPlayerVehicleID(playerid))) { case TWO_TIRE_VEHICLE: { } case SIX_TIRE_VEHICLE: { } case NO_TIRE_VEHICLE: { } case ENGINE_ONLY_VEHICLE: { } } |
GetVehicleType(vehicleid)
{
new model = GetVehicleModel(vehicleid);
switch (model)
{
case 468: return TWO_TIRE_VEHICLE;
case 431, 455, 433, 544: return SIX_TIRE_VEHICLE;
case 509, 510: return NO_TIRE_VEHICLE;
case 417, 453, 473, 484, 487, 497, 511, 592: return ENGINE_ONLY_VEHICLE;
default: return 0;
}
}
#define TWO_TIRE_VEHICLE_ADD 1
#define SIX_TIRE_VEHICLE_ADD 2
#define NO_TIRE_VEHICLE_ADD 3
#define ENGINE_ONLY_VEHICLE_ADD 4
Your code has an issue, you're using vehicleid instead of model id.
PHP код:
|
switch (GetVehicleModel(vehicleid))
Guys, I have TWO_TIRE_VEHICLE_ADD add too. Should I add
PHP код:
|