SA-MP Forums Archive
MySQL | again not working. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL | again not working. (/showthread.php?tid=264338)



MySQL | again not working. - EviLpRo - 25.06.2011

hello!

this stock again not working.
what's the problem ?

here the stock:

pawn Код:
stock GetPlayerLevel(playerid)
{
    new vreturn[256],query[256];
    format(query,256,"SELECT 'Level' FROM 'Users' WHERE Nick='%s'",GetName(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_retrieve_row() == 1)
    {
      new buffer[10];
      mysql_fetch_field_row(buffer, "Level");
      format(vreturn,256,"%d",strval(buffer));
    }
    mysql_free_result();
    return strval(vreturn);
}
thank's for the helper (:


Re: MySQL | again not working. - gimini - 25.06.2011

You forgot SendClientMessage


Re: MySQL | again not working. - EviLpRo - 25.06.2011

but i'm not want send message.
i want return the player level.


Re: MySQL | again not working. - kacper55331 - 25.06.2011

pawn Код:
stock GetPlayerLevel(playerid)
{
    new query[126], lvl;
    format(query,sizeof(query),"SELECT `Level` FROM `Users` WHERE `Nick` = '%s'",GetName(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_retrieve_row()) lvl = mysql_fetch_int();
    mysql_free_result();
    return lvl;
}
256 is too big. https://sampforum.blast.hk/showthread.php?tid=55261


Re: MySQL | again not working. - gimini - 25.06.2011

Ahh, sorry.
pawn Код:
stock GetPlayerLevel(playerid)
{
    new query[100];
    format(query,sizeof(query),"SELECT `Level` FROM `Users` WHERE `Nick`='%s' LIMIT 1",GetName(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_retrieve_row() == 1) mysql_fetch_field_row(query, "Level");
    mysql_free_result();
    return strval(query);
}
Try this


Re: MySQL | again not working. - EviLpRo - 25.06.2011

Thank you gimini.