09.04.2015, 14:31
Can someone please tell me what I am doing wrong with my code? Basically I have a check when the player gets into a vehicle:
if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER)
That runs a bunch of stuff and near the end I run this code:
This runs after all the other checks and what it’s supposed to do is if the player isn’t in a dealership vehicle then it will show the speedo, vehicle health etc. This all works perfectly. The problem I am having is that the hud is not only hiding when you get inside of my dealership vehicles but cars that I have defined for jobs aswell such as trucks & delivery vans. (They're the only two tested but I'm sure it would be all) Some code related to them:
if(IsCourierVeh(vehicleid))//Checks whether a vehicle is a courier veh
if(IsTruckerVehicle(vehicleid))//Checks whether a vehicle is a trucker veh
DshipCar[0] = CreateVehicle(560, 528.4337, -1287.7441, 16.9385, 283.0397, 1, 1, 60);//dealership veh 1
JobInfo[JOB_COURIER][jCourier][0] = CreateVehicle(413, 1788,-2060,13,0, 25, 25, 60);//courier
JobInfo[JOB_TRUCKER][jCars][0] = CreateVehicle(515,-475,-487,26,180,0,0,60); // Truck
I hope you guys understand what I’m trying to say and if so have an idea of what may be the issue? Thanks.
EDIT: I'm not entirely sure what the issue is. A way I have overcome it is by adding (return 1
beneath the code when you're inside a dealership vehicle which ends the code there and doesn't continue on to showing the hud etc. It seems to have worked. I wouldnt still mind knowing if anyone knows what may have been the issue though? Cheers.
if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER)
That runs a bunch of stuff and near the end I run this code:
pawn Код:
else if(!IsDshipCar(vehicleid))//Disable info inside certain vehicles
{
PlayerTextDrawShow(playerid, SpeedoText[playerid]);//Show Speed
VehHealthBar[playerid] = CreateProgressBar(548.00, 357.00, 58.50, 5.19, -16776961, 100.0);//show vehicle HP bar
SetProgressBarMaxValue(VehHealthBar[playerid], 1000);
SetProgressBarColor(VehHealthBar[playerid], COLOR_LIME);
if(PlayerInfo[playerid][pSpeedo] == 1) ShowProgressBarForPlayer(playerid, VehHealthBar[playerid]);
if(!engine) PlayerTextDrawShow(playerid,EngineInfo[playerid]);//EngineInfo
format(string, sizeof(string), "~w~%s",RVN(vehmd));//set text as vehicle name
PlayerTextDrawSetString(playerid,VehicleName[playerid], string);
if(PlayerInfo[playerid][pSpeedo] == 1) PlayerTextDrawShow(playerid, VehicleName[playerid]);//show vehicle name
}
if(IsCourierVeh(vehicleid))//Checks whether a vehicle is a courier veh
if(IsTruckerVehicle(vehicleid))//Checks whether a vehicle is a trucker veh
DshipCar[0] = CreateVehicle(560, 528.4337, -1287.7441, 16.9385, 283.0397, 1, 1, 60);//dealership veh 1
JobInfo[JOB_COURIER][jCourier][0] = CreateVehicle(413, 1788,-2060,13,0, 25, 25, 60);//courier
JobInfo[JOB_TRUCKER][jCars][0] = CreateVehicle(515,-475,-487,26,180,0,0,60); // Truck
I hope you guys understand what I’m trying to say and if so have an idea of what may be the issue? Thanks.
EDIT: I'm not entirely sure what the issue is. A way I have overcome it is by adding (return 1
