22.06.2015, 20:50
(
Последний раз редактировалось AHN; 25.06.2015 в 02:09.
Причина: Updating code.
)
I have created a SQL database for vehicles, it's A-okay yet nothing wrong with it.
Vehicles in the database have a unique ID specified in the DB and when it's spawned it gets another ID from the server(vehicleid).
Now what I specifically want is creating a simple command letting me know the vehicleid by writing on the ID on the database.
And I've added a new field on the DB that saves on the server's vehicle ID once spawned.
So basically I want to enter a field from the DB by a command param and get the other field as an output.
I want it somehow by giving it '249' it outputs '24'.
Here's what I've done, not working yet and I don't know why.
What's wrong over there? How can I fix this?
Vehicles in the database have a unique ID specified in the DB and when it's spawned it gets another ID from the server(vehicleid).
Now what I specifically want is creating a simple command letting me know the vehicleid by writing on the ID on the database.
And I've added a new field on the DB that saves on the server's vehicle ID once spawned.
So basically I want to enter a field from the DB by a command param and get the other field as an output.
I want it somehow by giving it '249' it outputs '24'.
Here's what I've done, not working yet and I don't know why.
PHP код:
CMD:getservervehid(playerid, params[])
{
new enteredID;
new string[64];
if (sscanf(params, "d", enteredID)) return SendSyntaxMessage(playerid, "/getservervehid[ID]");
format(string, sizeof(string), "SELECT * FROM `cars` WHERE `carID` = '%d'", enteredID);
mysql_tquery(g_iHandle, string);
static
rows,
fields;
cache_get_data(rows, fields, g_iHandle);
for (new i = 0; i < rows; i ++) {
new gottenid = cache_get_field_int(i, "carSrvID");
SendServerMessage(playerid, "IDgotten > %d.", gottenid);
}
return 1;
}