MySQL | again not working.
#1

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 (:
Reply
#2

You forgot SendClientMessage
Reply
#3

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

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
Reply
#5

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
Reply
#6

Thank you gimini.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)