26.09.2016, 07:40
if your vehicleModel is 0 and you minus it with 400 result will be -400 so it will crash, check if vehiclemodel is valid before doing the label like how I've did below codes:
PHP код:
new labelstring[300];
new vehicleModel = hVehicleData[playerid][i][ModelID];
if(vehicleModel) // checks if vehicleModel value isn't 0
{
format(labelstring, sizeof(labelstring), "{58D3F7}[House Car] \n Name: %s \n Owner: %s", vehicleNames[vehicleModel - 400], pname);
hVehicleData[playerid][i][hvLabel] = CreateDynamic3DTextLabel(labelstring, COLOR_WHITE, 0.0, 0.0, 1.2, 15.0, INVALID_PLAYER_ID, hVehicleData[playerid][i][hVehicleID], 0, 0, -1, -1);
}
else
{
format(labelstring, sizeof(labelstring), "{58D3F7}[House Car] \n Name: Null \n Owner: Null");
hVehicleData[playerid][i][hvLabel] = CreateDynamic3DTextLabel(labelstring, COLOR_WHITE, 0.0, 0.0, 1.2, 15.0, INVALID_PLAYER_ID, hVehicleData[playerid][i][hVehicleID], 0, 0, -1, -1);
}
