Vehicle ID bug
#1

Help fix please

Load all normal...


Value ID 0 - vehicle.When use this function (Screen):

Код:
Vehicle[GetPlayerVehicleID(playerid)][ID][3]
Код:
public OnLoadVehicle();
public OnLoadVehicle()
{
	new count = GetTickCount();
	print("------------------------");
	for(new r = 0; r < cache_num_rows(); ++r)
	{
		Vehicle[r][ID][0] = cache_get_field_content_int(r, "vehicle_id", MySQL); 
        Vehicle[r][ID][1] = cache_get_field_content_int(r, "fraction_id", MySQL); 
        Vehicle[r][ID][2] = cache_get_field_content_int(r, "vehicle_carid", MySQL);

        Vehicle[r][Pos][0] = cache_get_field_content_float(r, "vehicle_pos1", MySQL);
        Vehicle[r][Pos][1] = cache_get_field_content_float(r, "vehicle_pos2", MySQL);
        Vehicle[r][Pos][2] = cache_get_field_content_float(r, "vehicle_pos3", MySQL);
        Vehicle[r][Pos][3] = cache_get_field_content_float(r, "vehicle_pos4", MySQL);

        Vehicle[r][Color][0] = cache_get_field_content_int(r, "vehicle_color1", MySQL);
        Vehicle[r][Color][1] = cache_get_field_content_int(r, "vehicle_color2", MySQL);

		cache_get_field_content(r, "vehicle_plate", Vehicle[r][Plate] ,MySQL, 32);

        
		Vehicle[r][ID][3] = AddStaticVehicleEx(Vehicle[r][ID][2], Vehicle[r][Pos][0],Vehicle[r][Pos][1],Vehicle[r][Pos][2],Vehicle[r][Pos][3], Vehicle[r][Color][0], Vehicle[r][Color][1],600);
		Vehicle[r][label] = CreateDynamic3DTextLabel(Vehicle[r][Plate], -1, 0.0, 0.0, 1.0, 50.0, INVALID_PLAYER_ID, Vehicle[r][ID][3]);

        printf("| VehicleID: %i | Fraction: %i | Vehicle Car: %i | Vehicle Global: %i |", Vehicle[r][ID][0],Vehicle[r][ID][1],Vehicle[r][ID][2],Vehicle[r][ID][3]);
        SetVehicleNumberPlate(Vehicle[r][ID][3], Vehicle[r][Plate]);

        ++ exMAX_VEHICLES;
 	}
 	printf("[Rows: %d (%d), Time: %d ms]",cache_num_rows(),exMAX_VEHICLES, GetTickCount() - count);
 	print("------------------------");
    return 1;
}
Reply
#2

Show your code that shows that sendclientmessage in your screenshot.
Reply
#3

Quote:
Originally Posted by Admigo
Посмотреть сообщение
Show your code that shows that sendclientmessage in your screenshot.
Код:
	if(!strcmp(cmd, "/test", true))
	{
		new string[64];
  	    format(string, sizeof string, "Real ID: %d | ID vehicle: %d",GetPlayerVehicleID(playerid), Vehicle[GetPlayerVehicleID(playerid)][ID][3]);
	    return SendClientMessage(playerid, -1, string);
	}
Reply
#4

Quote:
Originally Posted by F1re
Посмотреть сообщение
Код:
	if(!strcmp(cmd, "/test", true))
	{
		new string[64];
  	    format(string, sizeof string, "Real ID: %d | ID vehicle: %d",GetPlayerVehicleID(playerid), Vehicle[GetPlayerVehicleID(playerid)][ID][3]);
	    return SendClientMessage(playerid, -1, string);
	}
What you did wrong was you are detecting the VehicleID in this code :Vehicle[GetPlayerVehicleID(playerid)][ID][3]
But you have set the rowid in that variable so it will return 0.
Reply
#5

problem was solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)