SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/08/2012, 08:39 AM   #1
Dan.
Huge Clucker
 
Dan.'s Avatar
 
Join Date: Jul 2011
Location: Estonia
Posts: 454
Reputation: 48
Default MySQL "vip" is not loading! (logs)

So I have this problem, everything else is working but the VIP wont load. This is the stock:

pawn Code:
stock Login(playerid)
{
    new query[128], string[64], money, score;
    format(query, sizeof(query), "SELECT * FROM accounts WHERE user = '%s'", Name(playerid));
   
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query))
    {
        mysql_fetch_field_row(string, "admin"); PlayerInfo[playerid][pAdmin] = strval(string);
        mysql_fetch_field_row(string, "vip"); PlayerInfo[playerid][pVIP] = strval(string);
        mysql_fetch_field_row(string, "warnings"); PlayerInfo[playerid][pWarnings] = strval(string);
        mysql_fetch_field_row(string, "score"); score = strval(string);
        mysql_fetch_field_row(string, "money"); money = strval(string);
        mysql_fetch_field_row(string, "kills"); PlayerInfo[playerid][pKills] = strval(string);
        mysql_fetch_field_row(string, "deaths"); PlayerInfo[playerid][pDeaths] = strval(string);
        mysql_fetch_field_row(string, "points"); PlayerInfo[playerid][pPoints] = strval(string);
    }
    mysql_free_result();
   
    GivePlayerMoney(playerid, money);
    SetPlayerScore(playerid, score);
    PlayerInfo[playerid][pLogged] = 1;
    UpdateStatsTextdraw(playerid);
    SendClientMessage(playerid, C_LGREEN, "ACCOUNT: Successfully logged in.");
    return 1;
}

A players' VIP level in the database is 3, but it wont load when he/she logs in.

This is the MySQL log:
pawn Code:
[11:42:52] CMySQLHandler::FetchRow() - Return: Username|c0516d978b6f895d0cf43d086f3d7245|0|3|0|48|29525|127.0.0.1|3|11|0

[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("admin") - 0

[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("vip") -

[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("warnings") - 0

[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("score") - 48

[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("money") - 29525

[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("kills") - 3

[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("deaths") - 11

[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("points") - 0

[11:42:52] >> mysql_fetch_row_format( Connection handle: 1 )

On this line you see, that the VIP level is 3 (the 2nd number)
pawn Code:
[11:42:52] CMySQLHandler::FetchRow() - Return: Username|c0516d978b6f895d0cf43d086f3d7245|0|3|0|48|29525|62.65.63.64|3|11|0

But it wont load the level 3 VIP, and in the mysql_log it says:
pawn Code:
[11:42:52] >> mysql_fetch_field_row( Connection handle: 1 )

[11:42:52] CMySQLHandler::FetchField("vip") -
Dan. is offline   Reply With Quote
Old 02/08/2012, 08:55 AM   #2
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 1,573
Reputation: 201
Default Re: MySQL "vip" is not loading! (logs)

Are you sure the field in db is named `vip`? I suggest to try this:
pawn Code:
//Find
mysql_store_result();
//Add this under
new fname[20];
mysql_fetch_field(3, fname);
printf("The name of field is: %s", fname);
You'll see the result in console
__________________
Misiur is offline   Reply With Quote
Old 02/08/2012, 08:59 AM   #3
Goobiiify
Huge Clucker
 
Goobiiify's Avatar
 
Join Date: Dec 2008
Posts: 342
Reputation: 17
Default Re: MySQL "vip" is not loading! (logs)

It's case sensitive.
__________________

Life is to short for hate, love instead!
Goobiiify is online now   Reply With Quote
Old 02/08/2012, 09:15 AM   #4
Dan.
Huge Clucker
 
Dan.'s Avatar
 
Join Date: Jul 2011
Location: Estonia
Posts: 454
Reputation: 48
Default Re: MySQL "vip" is not loading! (logs)

pawn Code:
The name of field is: VIP

Thanks for the help, I thought about this, but it was saving correctly and there it's not case sensitive. In CREATE TABLE IF NOT EXISTS it really is case sensitive, so thank you both.
Dan. is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
5 Dialog errors - Input line too long, undefined symbol "t","is" and "only" Deal-or-die Scripting Help 6 01/05/2012 12:08 PM
xMovie Entertainment (3 vids): "Like a boss" "The rapist" "Jizz in my pants" xMovie Screenshots and Videos 11 27/03/2012 12:10 PM
[Tutorial] Simple "/kill", "/heal" and "/tp" commands KosmasRego Tutorials 13 29/11/2011 07:08 PM
Admin script requires "ReturnUser", "strtok" and "IsNumeric" Rubennnnn Help Archive 1 02/12/2009 07:08 PM
"Bots", "AI", "NPCs"... Computer-controlled pedestrians and traffic! ssflsnoob General 2 23/11/2008 07:06 PM


All times are GMT. The time now is 11:10 AM.


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