#1

What's the problem with this code, it dosen't show the carid, always 0, car model always sential.
This code at stats.

PHP код:
new vehicleee[24], vehicleidd GetPlayerVehicleID(playerid);
     if(
PlayerInfo[playerid][pOwnedVehicle1] == 1)
      {
     new 
carkey1 PlayerInfo[playerid][pOwnedVehicle1];
     
GetVehicleName(carkey1vehicleeesizeof(vehicleee));
     
format(stringsizeof(string), " CarID: %d | Model: %s (%d) | VehColor1: %d | VehColor2: %d "vehicleiddvehicleeeVehicleInfo[carkey1][vehModel], VehicleInfo[carkey1][vehC1], VehicleInfo[carkey1][vehC2]);
     
SendClientMessage(playeridCOLOR_GREYstring);
     }
     if(
PlayerInfo[playerid][pOwnedVehicle2] == 1)
      {
     new 
carkey2 PlayerInfo[playerid][pOwnedVehicle2];
     
GetVehicleName(carkey2vehicleeesizeof(vehicleee));
     
format(stringsizeof(string), " CarID: %d | Model: %s (%d) | VehColor1: %d | VehColor2: %d "vehicleiddvehicleeeVehicleInfo[carkey2][vehModel], VehicleInfo[carkey2][vehC1], VehicleInfo[carkey2][vehC2]);
     
SendClientMessage(playeridCOLOR_GREYstring);
     }
     if(
PlayerInfo[playerid][pOwnedVehicle3] == 1)
      {
     new 
carkey3 PlayerInfo[playerid][pOwnedVehicle3];
     
GetVehicleName(carkey3vehicleeesizeof(vehicleee));
     
format(stringsizeof(string), " CarID: %d | Model: %s (%d) | VehColor1: %d | VehColor2: %d "vehicleiddvehicleeeVehicleInfo[carkey3][vehModel], VehicleInfo[carkey3][vehC1], VehicleInfo[carkey3][vehC2]);
     
SendClientMessage(playeridCOLOR_GREYstring);
     } 
Reply
#2

"vehicleidd" is assigned with the player's vehicle ID which in your case the player is not in any vehicle so GetPlayerVehicleID function returns 0.

carkey1, carkey2 and carkey3 hold the vehicleid so replace "vehicleidd" with those.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)