SA-MP Forums Archive
[MySQL] Need help, calling all MySQL gurus. WILL +REP :D - 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: [MySQL] Need help, calling all MySQL gurus. WILL +REP :D (/showthread.php?tid=334858)



nevermind. - xxxDunecatxxx - 16.04.2012

Close thread, thanks.


Re: [MySQL] Need help, calling all MySQL gurus. WILL +REP :D - [HiC]TheKiller - 16.04.2012

I'm not quite sure what you mean by returning a playerid but here is what I think you mean:
pawn Код:
stock ListAllCops()
{
    mysql_query("SELECT name FROM players WHERE faction = 1");
    mysql_store_result();
    new massivestr[2000], name[30];
    while(mysql_retrieve_row())
    {
        mysql_get_field("name", name);
        format(massivestr, sizeof(massivestr), "%s, %s", massivestr, name)
    }
    mysql_free_result();
    return massivestr[1];
}
Usage could be:

pawn Код:
new string[2050];
format(string, sizeof(string), "Cops: %s", ListAllCops());