mysql bug cars
#1

hello I have a car system what happens to me is that the car of the first cell did not charge me only loads the second

help!!!!!


Quote:

forward OnPlayerCarsLoad(playerid);
public OnPlayerCarsLoad(playerid)
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,TuberiasMySQL);
if(!num_rows)return 1;
for(new i=0; i<num_rows; i++)
{
if(i >= MAX_VEH_PER_PLAYER)
{
print("Se ha alcanzado el mбximo de vehiculos para cargar");
break;
}
SCM(playerid, -1, "HOLA");
new f[50];
new id=getFreeCarID();
//cache_get_field_content(i,"vid", f);VehicleInfo[id][vvid] = strval(f);
cache_get_field_content(i,"vkey", f);VehicleInfo[id][VKEY] = strval(f);
cache_get_field_content(i,"dueno",VehicleInfo[id][VD]);
cache_get_field_content(i,"slot", f);VehicleInfo[id][slot] = strval(f);
cache_get_field_content(i,"posx", f);VehicleInfo[id][vposx] = floatstr(f);
cache_get_field_content(i,"posy", f);VehicleInfo[id][vposy] = floatstr(f);
cache_get_field_content(i,"posa", f);VehicleInfo[id][vposz] = floatstr(f);
cache_get_field_content(i,"vangle", f);VehicleInfo[id][vangle] = floatstr(f);
cache_get_field_content(i,"vmodelid", f);VehicleInfo[id][vmodelid] = strval(f);
cache_get_field_content(i,"vcolor1", f);VehicleInfo[id][vcolor1] = strval(f);
cache_get_field_content(i,"vcolor2", f);VehicleInfo[id][vcolor2] = strval(f);
cache_get_field_content(i,"vpaintjob", f);VehicleInfo[id][vpaintjob] = strval(f);
cache_get_field_content(i,"vm1", f);VehicleInfo[id][mod1] = strval(f);
cache_get_field_content(i,"vm2", f);VehicleInfo[id][mod2] = strval(f);
cache_get_field_content(i,"vm3", f);VehicleInfo[id][mod3] = strval(f);
cache_get_field_content(i,"vm4", f);VehicleInfo[id][mod4] = strval(f);
cache_get_field_content(i,"vm5", f);VehicleInfo[id][mod5] = strval(f);
cache_get_field_content(i,"vm6", f);VehicleInfo[id][mod6] = strval(f);
cache_get_field_content(i,"vm7", f);VehicleInfo[id][mod7] = strval(f);
cache_get_field_content(i,"vm8", f);VehicleInfo[id][mod8] = strval(f);
cache_get_field_content(i,"vm9", f);VehicleInfo[id][mod9] = strval(f);
cache_get_field_content(i,"vm10", f);VehicleInfo[id][mod10] = strval(f);
cache_get_field_content(i,"vm11", f);VehicleInfo[id][mod11] = strval(f);
cache_get_field_content(i,"vm12", f);VehicleInfo[id][mod12] = strval(f);
cache_get_field_content(i,"vm13", f);VehicleInfo[id][mod13] = strval(f);
cache_get_field_content(i,"vm14", f);VehicleInfo[id][mod14] = strval(f);
cache_get_field_content(i,"vm15", f);VehicleInfo[id][mod15] = strval(f);
cache_get_field_content(i,"vm16", f);VehicleInfo[id][mod16] = strval(f);
cache_get_field_content(i,"vm17", f);VehicleInfo[id][mod17] = strval(f);
cache_get_field_content(i,"vstatus", f);VehicleInfo[id][VSTATUS] = strval(f);
cache_get_field_content(i,"vhealth", f);VehicleInfo[id][VehicleHealth] = floatstr(f);
cache_get_field_content(i,"vpanels", f);VehicleInfo[id][VPanels] = strval(f);
cache_get_field_content(i,"vdoors", f);VehicleInfo[id][VDoors] = strval(f);
cache_get_field_content(i,"vlights", f);VehicleInfo[id][VLights] = strval(f);
cache_get_field_content(i,"vtires", f);VehicleInfo[id][VTires] = strval(f);
ChangeVehiclePaintjob(i, VehicleInfo[id][vpaintjob]);
VehicleInfo[id][vvid] = CreateVehicle(VehicleInfo[id][vmodelid], VehicleInfo[id][vposx],VehicleInfo[id][vposy], VehicleInfo[id][vposz],VehicleInfo[id][vangle], VehicleInfo[id][vcolor1], VehicleInfo[id][vcolor2], 200000);
SetVehicleToRespawn(VehicleInfo[id][vvid]);

Reply
#2

I don't quite understand what you mean. The first vehicle is not loaded at all?

I have a question though, do you use R7 version and you use strval because there were added functions later that return integers/floats directly. Consider updating to latest (R41 or R39-6 if you can't run the latest).

Saving/loading in-game vehicle IDs is not a good way, people tend to use bad ways because of bad habits of others (yes, those who initially wrote it like that). Adding/Removing a vehicle will mess everything up.

If a vehicle doesn't have a single component, you are wasting 17 columns (there are only 14 slots by the way) to be empty. Here's a good tutorial about how to properly save components: https://sampforum.blast.hk/showthread.php?tid=420363
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I don't quite understand what you mean. The first vehicle is not loaded at all?

I have a question though, do you use R7 version and you use strval because there were added functions later that return integers/floats directly. Consider updating to latest (R41 or R39-6 if you can't run the latest).

Saving/loading in-game vehicle IDs is not a good way, people tend to use bad ways because of bad habits of others (yes, those who initially wrote it like that). Adding/Removing a vehicle will mess everything up.

If a vehicle doesn't have a single component, you are wasting 17 columns (there are only 14 slots by the way) to be empty. Here's a good tutorial about how to properly save components: https://sampforum.blast.hk/showthread.php?tid=420363
sorry for my bad English is to use the translator the problem is that if I buy a car to power cycle the server does not charge me now if I buy another car and turn off and turn on the server there if I load
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)