Seeking for help in a simple command
#1

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.
PHP код:
CMD:getservervehid(playeridparams[])
{
    new 
enteredID;
    new 
string[64];
    if (
sscanf(params"d"enteredID)) return SendSyntaxMessage(playerid"/getservervehid[ID]");
    
format(stringsizeof(string), "SELECT * FROM `cars` WHERE `carID` = '%d'"enteredID);
    
mysql_tquery(g_iHandlestring);
    
    static
        
rows,
        
fields;
    
cache_get_data(rowsfieldsg_iHandle);
    for (new 
0rows++) {
        new 
gottenid cache_get_field_int(i"carSrvID");
        
SendServerMessage(playerid"IDgotten > %d."gottenid);
    }
    return 
1;

What's wrong over there? How can I fix this?
Reply


Messages In This Thread
Seeking for help in a simple command - by AHN - 22.06.2015, 20:50
Re: Seeking for help in a simple command - by Prokill911 - 22.06.2015, 21:00
Re: Seeking for help in a simple command - by AHN - 22.06.2015, 21:53
Re: Seeking for help in a simple command - by AHN - 23.06.2015, 22:14
Re: Seeking for help in a simple command - by AHN - 25.06.2015, 16:51

Forum Jump:


Users browsing this thread: 1 Guest(s)