sscanf loading.
#1

Hi,


Код:
SELECT Names,Pass,Xp,Money FROM players Where Names='%s'
I want to load with sscanf. But i don't want to load Names and Pass, but i don't want to load just xp and Money
Reply
#2

this ain't sscanf, that's either SQLite, or MySQL, it looks terrible though..

what do you want to load?
Reply
#3

I want to know, how to load, but not to write to variable something with what simbol?
Reply
#4

I don't know if you are using any MySQL plugin but you should take a look at this:
https://sampwiki.blast.hk/wiki/MySQL_Tutorial
https://sampwiki.blast.hk/wiki/MySQL_Plugin

And if you still have questions, try to post a little bit more of your code next time
Reply
#5

Explanation inside.

pawn Код:
stock LoadStats(playerid)
{
    new pName[ MAX_PLAYER_NAME ]; //A new array with the size of MAX_PLAYER_NAME = 24.
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //Stores the player's name into the array we made 'pName'
   
    mysql_query("SELECT * FROM `Your_Table` WHERE Names = '%s'", pName);
    mysql_store_result(); //stores the result after using SELECT, etc..

    new
        _QuerySize[ 180 ] //Creates a new array with the size of 256 or increase the size if needed.
        //Calculation PlayerName = 24 + Password = 129 + EXP = 11, Money = 11 All in all its 175 + 1 = 176, lets put
        //180 to make sure.
    ;

    if( mysql_fetch_row_format( _QuerySize ) )
    {
        //if you're using Whirpool use placeholder s(tring) with the size of 129. (Suggested)
        //if you're using udb_hash use placeholder d(ecimal) or i(nteger). (Not suggested)
        sscanf( _QuerySize, "p<|>s[24]s[129]ii", Your_name_enum, Your_pass_enum, Your_exp_enum, Your_money_enum);
    }
    mysql_free_result();//frees the result after we loaded everything, simple words lets the result go by it self.
}
Reply
#6

Yes this:

Код:
sscanf( _QuerySize, "p<|>s[24]s[129]ii", Your_name_enum, Your_pass_enum, Your_exp_enum, Your_money_enum);
But now if i want to load, for ex: Name, i need to do like that:

Код:
sscanf( _QuerySize, "p<|>{s[24]}s[129]ii", Your_name_enum, Your_pass_enum, Your_exp_enum, Your_money_enum);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)