SA-MP Forums Archive
[HELP]Please help loading leader name - 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)
+--- Thread: [HELP]Please help loading leader name (/showthread.php?tid=499376)



[HELP]Please help loading leader name - Luca12 - 07.03.2014

So I was make when I give myself leader then it update's fine I mean it save fine and I type /allmembers and on Leader 1: and then it show my name which is fine know is the problem on loading. I reset or shutdown server then turn on and go to server and type /allmembers and it says Leader 1: and here is empty but it should be my name. Thanks

this is in ongamemodeinit:


pawn Код:
mysql_format(mysql,query,sizeof(query),"SELECT * FROM `fbiclanovi`");
    mysql_tquery(mysql,query,"LoadFBI","");
and here is callback LoadFBI

pawn Код:
forward LoadFBI();
public LoadFBI()
{
    new rows,fields;
    cache_get_data(rows,fields,mysql);
    if(rows)
    {
        cache_get_field_content(0,"Leader1",FBIInfo[1][Leader]);
    }
    return 1;
}



Re: [HELP]Please help loading leader name - Luca12 - 08.03.2014

Please anyone? Please. Thanks


Re: [HELP]Please help loading leader name - Knappen - 08.03.2014

Do you want to load ALL the members or just the leader?

If you only want the leader, it should be something like this
pawn Код:
mysql_format(mysql,query,sizeof(query),"SELECT * FROM `fbiclanovi` WHERE Leader1=?"); // Edit the question mark accordingly.
If you want to load all the members, you have to create a loop.
pawn Код:
forward LoadFBI();
public LoadFBI()
{
    new rows,fields, idx;
    cache_get_data(rows,fields,mysql);
    if(rows)
    {
        while(idx < rows)
        {
            // Fetch all the data on current row.
            idx++;
        }
    }
    return 1;
}



Re: [HELP]Please help loading leader name - Luca12 - 08.03.2014

how you mean fetch all the data is like cache_get_contect here or? Thanks


Re: [HELP]Please help loading leader name - Knappen - 08.03.2014

Show me your enum or all the variables you want to load, and I'll explain further.