SA-MP Forums

SA-MP Forums (
-   Scripting Help (
-   -   /wantedcars list Command is bugging (

ImTobi 06/11/2019 01:45 PM

/wantedcars list Command is bugging

i have a command that shows all wanted cars that pd can save into a database, but the command shows the only car that is in the database like 10000 times, and the others but the first are bugged, i changed some things in my script an it only shows "sultan" now at the very bottom, without licenseplate and wanted reason

My Loading Function

new query2[128];
format(query2,sizeof(query2),"SELECT * FROM wantedcars");

My Command

        new string[1024];
        for(new w=0; w<sizeof(wInfo); w++)
        ShowPlayerDialog(playerid, WANTEDCARSDIALOG, DIALOG_STYLE_TABLIST,"Gesuchte Fahrzeuge", string, "Okay", "");
        return 1;

My Loading Function public:


forward LoadWantedCars(playerid);
public LoadWantedCars(playerid)
        new num_rows,num_fields;
        if(!num_rows)return 1;
        new tmp_wantedkennzeichen[128];
        new tmp_wantedgrund[1024];
        new tmp_carmodel[128];
        for(new i=0; i<num_rows; i++)
                new wID = getFreeWantedCarID();
                wInfo[wID][db_id] = cache_get_field_content_int(0,"id",dbhandle);
        return 1;

thats two of the bugs:

Markski 06/11/2019 01:52 PM

Re: /wantedcars list Command is bugging

You should be fetching the row number i, not 0. You're fetching the same first row, num_row amount of times.

ImTobi 06/11/2019 01:53 PM

Re: /wantedcars list Command is bugging
i tried i before, did the same thing, it put the thing at the very bottom, without the wanted reason and license plate

Markski 06/11/2019 01:59 PM

Re: /wantedcars list Command is bugging
By the way, you don't need all those tmp_ strings and copy from them, you can just fetch the data straight into the main strings.


Originally Posted by ImTobi (Post 4120807)
i tried i before, did the same thing, it put the thing at the very bottom, without the wanted reason and license plate

Try running that query on your sql client and see what the result looks like from there.

ImTobi 06/11/2019 02:09 PM

Re: /wantedcars list Command is bugging
What query? If i copy it and paste it in the sql thing, it says syntax error

ImTobi 06/11/2019 02:53 PM

Re: /wantedcars list Command is bugging
idk how that works, and why my command buggs

ImTobi 06/11/2019 04:22 PM

Re: /wantedcars list Command is bugging

Now, i made a command to add wanted cars, it works, but the command still doesn't it displays nothing, just empty fields

ImTobi 06/11/2019 05:18 PM

Re: /wantedcars list Command is bugging

for(new i=0; i<sizeof(wInfo); i++)
ShowPlayerDialog(playerid, WANTEDCARSDIALOG, DIALOG_STYLE_TABLIST,"Gesuchte Fahrzeuge - SFPD | LSPD", string, "Okay", "");

it works if i break the loop, then it shows the first car in the database and the lcense plate and the reason, but if i dont break the loop, it buggs

ImTobi 07/11/2019 01:41 PM

Re: /wantedcars list Command is bugging

RoboN1X 07/11/2019 04:21 PM

Re: /wantedcars list Command is bugging
You shouldn't put all your array in the dialog, not all of them have the records.
Is there any reason you are appending the string of formatted dialog instead of prepending it?
Also watch your buffer and array size, you should set it to the necessary amount, same to the MySQL field column size +1.

How is one item with 128 + 1024 + 128 line gonna fit into 1024 characters dialog capacity?

Can you post the wInfo enum and declaration?

All times are GMT. The time now is 12:33 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.