PDA

View Full Version : help with this please


AndrewRussett
17/07/2018, 12:27 AM
hello, I want to load and spawn the player's car when he spawn that he looks in the table 'autos' the car with the key and the name that the user has, I did it in this way but he does not do anything and I get the following errors in the sql record.

In OnPlayerSpawn.

LoadPlayerCar(playerid);

CallBack

stock LoadPlayerCar(playerid)
{
new Result_Autos;
if(PlayerInfo[playerid][PlayerVehicle][0] == -1)
{
mysql_tquery(Database, "SELECT * FROM `Autos` WHERE `vLlave` = '%d' AND `vProp` = '%e'", PlayerInfo[playerid][PlayerVehicleKey][0], PlayerNameNormal(playerid));
cache_get_row_count(Result_Autos);
Loop_2(i, Result_Autos)
{
new veh;
new V_VKEY, V_VD[24], Float:V_VPOSX, Float:V_VPOSY, Float:V_VPOSZ, Float:V_VANGLE,
V_MODEL, VCOL1, VCOL2, VPAINTJOB, VM1,VM2,VM3,VM4,VM5,VM6,VM7,VM8,VM9,VM10,VM11,VM12 ,VM13,VM14,VM15,VM16,VM17,VVSTATUS,Float:VVHEALTH, VVPANELS,VVDOORS,VVLIGHTS,VVTIRES;

cache_get_value_int(i, "vLlave", V_VKEY);

cache_get_value(i, "vProp", V_VD, MAX_PLAYER_NAME);

cache_get_value_float(i, "vPosX", V_VPOSX);
cache_get_value_float(i, "vPosY", V_VPOSY);
cache_get_value_float(i, "vPosZ", V_VPOSZ);
cache_get_value_float(i, "vAngle", V_VANGLE);

cache_get_value_int(i, "vModelo", V_MODEL);
cache_get_value_int(i, "vColor1", VCOL1);
cache_get_value_int(i, "vColor2", VCOL2);
cache_get_value_int(i, "vPaintjob", VPAINTJOB);

cache_get_value_int(i, "vModel_1", VM1);
cache_get_value_int(i, "vModel_2", VM2);
cache_get_value_int(i, "vModel_3", VM3);
cache_get_value_int(i, "vModel_4", VM4);
cache_get_value_int(i, "vModel_5", VM5);
cache_get_value_int(i, "vModel_6", VM6);
cache_get_value_int(i, "vModel_7", VM7);
cache_get_value_int(i, "vModel_8", VM8);
cache_get_value_int(i, "vModel_9", VM9);
cache_get_value_int(i, "vModel_10", VM10);
cache_get_value_int(i, "vModel_11", VM11);
cache_get_value_int(i, "vModel_12", VM12);
cache_get_value_int(i, "vModel_13", VM13);

cache_get_value_float(i, "vVida", VVHEALTH);

cache_get_value_int(i, "vEstado", VVSTATUS);
cache_get_value_int(i, "vPanels", VVPANELS);
cache_get_value_int(i, "vDoors", VVDOORS);
cache_get_value_int(i, "vLights", VVLIGHTS);
cache_get_value_int(i, "vTires", VVTIRES);

new str[20];
format(str, 20, "XRP%04d", V_VKEY);

veh = CreateVehicle(V_MODEL, V_VPOSX, V_VPOSY, V_VPOSZ, V_VANGLE, VCOL1, VCOL2, -1);
SetVehicleNumberPlate(veh, str);
SetVehicleToRespawn(veh);

format(VehicleInfo[veh][VD], 24, "%s", V_VD);
VehicleInfo[veh][VKEY] = V_VKEY;
VehicleInfo[veh][vposx] = V_VPOSX;
VehicleInfo[veh][vposy] = V_VPOSY;
VehicleInfo[veh][vposz] = V_VPOSZ;
VehicleInfo[veh][vangle] = V_VANGLE;
VehicleInfo[veh][vmodelid] = V_MODEL;
VehicleInfo[veh][vcolor1] = VCOL1;
VehicleInfo[veh][vcolor2] = VCOL2;
VehicleInfo[veh][vpaintjob] = VPAINTJOB;
VehicleInfo[veh][mod1] = VM1;
VehicleInfo[veh][mod2] = VM2;
VehicleInfo[veh][mod3] = VM3;
VehicleInfo[veh][mod4] = VM4;
VehicleInfo[veh][mod5] = VM5;
VehicleInfo[veh][mod6] = VM6;
VehicleInfo[veh][mod7] = VM7;
VehicleInfo[veh][mod8] = VM8;
VehicleInfo[veh][mod9] = VM9;
VehicleInfo[veh][mod10] = VM10;
VehicleInfo[veh][mod11] = VM11;
VehicleInfo[veh][mod12] = VM12;
VehicleInfo[veh][mod13] = VM13;
VehicleInfo[veh][mod14] = VM14;
VehicleInfo[veh][mod15] = VM15;
VehicleInfo[veh][mod16] = VM16;
VehicleInfo[veh][mod17] = VM17;
VehicleInfo[veh][slot] = 0;
VehicleInfo[veh][VSTATUS] = VVSTATUS;
VehicleInfo[veh][VehicleHealth] = VVHEALTH;
VehicleInfo[veh][VPanels] = VVPANELS;
VehicleInfo[veh][VDoors] = VVDOORS;
VehicleInfo[veh][VLights] = VVLIGHTS;
VehicleInfo[veh][VTires] = VVTIRES;
SetVehicleHealth(veh, VVHEALTH);
ChangeVehiclePaintjob(veh, VehicleInfo[veh][vpaintjob]);
ModVehicle(veh);
UpdateVehicleDamageStatus(veh, VVPANELS,VVDOORS,VVLIGHTS,VVTIRES);

}
}
}

Errors in SQL LOG

[20:10:05] [plugins/mysql] mysql_tquery: callback error: parameter count does not match format specifier length
[20:10:05] [plugins/mysql] cache_get_row_count: no active cache