A little MySQL Help Here Please.
#9

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
This should work sscanf version.

pawn Код:
stock MySQL_Login(playerid)
{
    new query[300], string[256];

    format( query, sizeof( query ), "SELECT * FROM `Accounts` WHERE `Nick` = '%s'", GetName( playerid ) );
    mysql_query( query );

    mysql_store_result( );

    if( mysql_num_rows( ) )
    {
        if(mysql_fetch_row_format(query, "|"))
        {
            sscanf(query, "p<|>iiiiii", PlayerInfo[playerid][Admin], PlayerInfo[playerid][Score], PlayerInfo[playerid][Money], PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Muted]);
        }
    }
    mysql_free_result( );

    GivePlayerMoney( playerid, PlayerInfo[playerid][Money] ), SetPlayerScore( playerid, PlayerInfo[playerid][Score] );

    PlayerInfo[ playerid ][ Login ] = 1;

    if(PlayerInfo[playerid][Admin] >= 1)
    {
        format(string, sizeof(string), "[ACCOUNT] "cwhite"Successfully Logged in. Welcome Admin. Your Level is %d",PlayerInfo[playerid][Admin]);
        SCM(playerid, xgreen, string);
    }
    else
    {
        format(string, sizeof(string), "[ACCOUNT] "cwhite"Successfully Logged in.");
        SCM(playerid, xgreen, string);
    }
    return 1;
}
PDS2k12 thanks man now i have also learnt how to use Sscanf with MYSQL

+REP Your Yea

EDIT: Sorry man i cant give rep Error: You Must Spread Some Reputation around before giving it back to PDS2k12
Reply


Messages In This Thread
A little MySQL Help Here Please. - by iBeast - 04.01.2014, 16:15
Re: A little MySQL Help Here Please. - by Wizzy951 - 04.01.2014, 16:23
Re: A little MySQL Help Here Please. - by iBeast - 04.01.2014, 16:31
Re: A little MySQL Help Here Please. - by Wizzy951 - 04.01.2014, 16:37
Re: A little MySQL Help Here Please. - by Patrick - 04.01.2014, 16:54
Re: A little MySQL Help Here Please. - by iBeast - 04.01.2014, 17:09
Re: A little MySQL Help Here Please. - by Danyal - 04.01.2014, 17:15
Re: A little MySQL Help Here Please. - by Patrick - 04.01.2014, 17:19
Re: A little MySQL Help Here Please. - by Danyal - 04.01.2014, 17:23
Re: A little MySQL Help Here Please. - by iBeast - 04.01.2014, 17:45

Forum Jump:


Users browsing this thread: 6 Guest(s)