SetVehicleNumberPlate - mySQL Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetVehicleNumberPlate - mySQL Help (
/showthread.php?tid=276492)
mySQL Vehicle Help -
Moglizorz. - 14.08.2011
I'm having a problem, where by my numberplate is not showing correctly, hoping you guys can help.
The vPlate value in my database is: YME 161
(That's the plate, that should be shown)
Here is the code that does all the work..
Код:
new result[24], index = 0;
mysql_query("SELECT * FROM `server_vehicles`");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_get_field("vPlate", Vehicles[index][vPlate]);
printf("Plate1: %s", Vehicles[index][vPlate]);
mysql_get_field("vModelID", result);
Vehicles[index][vModelID] = strval(result);
mysql_get_field("vPositionX", result);
Vehicles[index][vPositionX] = floatstr(result);
mysql_get_field("vPositionY", result);
Vehicles[index][vPositionY] = floatstr(result);
mysql_get_field("vPositionZ", result);
Vehicles[index][vPositionZ] = floatstr(result);
mysql_get_field("vAngleZ", result);
Vehicles[index][vAngleZ] = floatstr(result);
mysql_get_field("Color1", result);
Vehicles[index][vColor1] = strval(result);
mysql_get_field("Color2", result);
Vehicles[index][vColor2] = strval(result);
SetVehicleNumberPlate(CreateVehicle(Vehicles[index][vModelID], Vehicles[index][vPositionX], Vehicles[index][vPositionY], Vehicles[index][vPositionZ], Vehicles[index][vAngleZ], Vehicles[index][vColor1], Vehicles[index][vColor2], -1), Vehicles[index][vPlate]);
}
printf on the server log displays the plate is should: "Plate1: YME 161"
Although, when I go onto the server the numberplate shows as:
http://s4.postimage.org/nc9l9d4j2/sa_mp_005.png
Any help? This is driving me crazy.
Re: SetVehicleNumberPlate - mySQL Help -
Kar - 14.08.2011
pawn Код:
new result[24], index = 0;
mysql_query("SELECT * FROM `server_vehicles`");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_get_field("vPlate", Vehicles[index][vPlate]);
printf("Plate1: %s", Vehicles[index][vPlate]);
mysql_get_field("vModelID", result);
Vehicles[index][vModelID] = strval(result);
mysql_get_field("vPositionX", result);
Vehicles[index][vPositionX] = floatstr(result);
mysql_get_field("vPositionY", result);
Vehicles[index][vPositionY] = floatstr(result);
mysql_get_field("vPositionZ", result);
Vehicles[index][vPositionZ] = floatstr(result);
mysql_get_field("vAngleZ", result);
Vehicles[index][vAngleZ] = floatstr(result);
mysql_get_field("Color1", result);
Vehicles[index][vColor1] = strval(result);
mysql_get_field("Color2", result);
Vehicles[index][vColor2] = strval(result);
new vehicleid = CreateVehicle(Vehicles[index][vModelID], Vehicles[index][vPositionX], Vehicles[index][vPositionY], Vehicles[index][vPositionZ], Vehicles[index][vAngleZ], Vehicles[index][vColor1], Vehicles[index][vColor2], -1);
SetVehicleNumberPlate(vehicleid, Vehicles[index][vPlate]);
index++;
}
Re: SetVehicleNumberPlate - mySQL Help -
Moglizorz. - 14.08.2011
The issue is unfortunately still persisting.
Re: SetVehicleNumberPlate - mySQL Help -
Raimis_R - 14.08.2011
Use sscanf to split query.
Re: SetVehicleNumberPlate - mySQL Help -
Moglizorz. - 14.08.2011
Not sure how to use sscanf, could you help me write it for the Vehicle System, like I posted above?