Posts: 383
Threads: 70
Joined: Feb 2016
Hello there.
In the database of vehicleinfo i have stored the vehicle plate now im trying to make a command which will read the vehicle place and show up the Vehicle informations like owner/ vehicle type etc etc.
The problem is that i dont know how to start the command, to get if the pressed text is an valid vehicle plate or it is not.Someone can give me an fast example pls i really need this.
Posts: 383
Threads: 70
Joined: Feb 2016
Im using version R39-6
Okay so now that will get if the plate exists and if it doesnt but how can i show the vehicle owner/vehicle model from the plate that player has typed, everything is stored in same place as the "plate"? [Repped ++]
Posts: 383
Threads: 70
Joined: Feb 2016
Thanks to you both , it worked but there is an little issue (might be because of string testing now) vehicle model shows 52 and not 411(infernus) - ill let you know if is really an issue or was string length.
Posts: 484
Threads: 11
Joined: Oct 2012
Reputation:
0
You know that GetVehicleModel is the right function to return vehicle model?
Some people are using GetPlayerVehicleID which is not correct.
Posts: 383
Threads: 70
Joined: Feb 2016
There is something wrong with this, when press to get the infos, plate works, owner works but the vehicle model shows 52 and the format isnt gettin really like it should be, i used \n but still shows in line
codes
Код:
COMMAND:checkplate(playerid, params[])
{
new plate[128]; // MAX_PLATE_NUMBER
if (sscanf(params, "s", plate)) return SendClientMessage(playerid, -1, "USAGE: /checkplate (platenumber)");
new query[128];
mysql_format(MySQLPipeline, query, sizeof(query),"SELECT Owner,Model FROM VehicleInfo WHERE Plate='%e' LIMIT 1", plate);
new Cache:result = mysql_query(MySQLPipeline, query);
new vehowner[80],vmodel[80];
cache_get_field_content(0, "Owner", vehowner);
cache_get_field_content(0, "Model", vmodel);
if (cache_num_rows() > 0)
{
new string[200];
format(string,sizeof(string),"Vehicle Owner: %s\nVehicle Model :%d",vehowner,vmodel);
SendClientMessage(playerid, -1,string);
SendClientMessage(playerid, -1, query);
// The plate number does exist
}
else
{
SendClientMessage(playerid, -1, "Plate doesnt Exists");
}
cache_delete(result);
return 1;
}
by the way in database the model is like vehicles id example - Infernus = 411.
Posts: 383
Threads: 70
Joined: Feb 2016
Thanks , ill test it now
by the way is there a faster way of loading i mean when i use the command and there is no plate it freezes the chat for like 2-3 seconds or less , or it is because it has to loop thought all plates etc etc.