sscanf read
#1

i'm using sscanf to read from mysql.
and i have this code:
pawn Код:
new
                       var[pInfo];
                   sscanf(line, "p|ssddddddddddddsddddddddddddddddddddddddddddddddddddddffdddddddddddddddddddddddddddddddddddddddddsssssdffffdffffdffffddffffffffdfffffffffffffffdddsssssffffdddddddddddddddddddddddddddddddddddddddddddddddddds", data[0], var); //Splits the line with sscanf
i want to set it to pInfo.
THe problem is if i use sscanf2 include i cant run the server, FIle or function is not found.
But i think its not the problem, i just need a way to load all fields to pInfo enum.
This way, is not working at all.
Reply
#2

You need the plugin + the include.

Edit server.cfg
Add a plugins line if its not there and add it to the server.cfg like this.
Код:
plugins sscanf
and include it in your gamemode.
Код:
#include <sscanf2>
(This is about the sscanf2 not working)
Reply
#3

You can't store to a enum because you need the enum secifier and sizes on the strings.
EDIT: User ****** method.
Reply
#4

i edit that for somthing like this:
pawn Код:
new
                       var[pInfo];
                   sscanf(line, "p<|>e<s[24]s[30]dddddddddddds[30]ddddddddddddddddddddddddddddddddddddddffddddddddddddddddddddddddddddddddddddddddds[30]s[30]s[30]s[30]s[30]dffffdffffdffffddffffffffdfffffffffffffffddds[30]s[30]s[30]s[30]s[30]ffffdddddddddddddddddddddddddddddddddddddddddddddddddds[30]>", data[0], var); //Splits the line with sscanf
i added sizes for "s" .. still doesnt work.

* added the plugin.
Reply
#5

pawn Код:
pInfo:

enum pInfo
{
    pKey[128],
    pLevel,
    pAdmin,
    pDonateRank,
    gPupgrade,
    pConnectTime,
    pReg,
    pSex,
    pAge,
    pBan,
    pReason,
    pOrigin,
    pCK,
    [Continue here..]
};
new PlayerInfo[MAX_PLAYERS][pInfo];

Line code:
new line[750];
if(mysql_fetch_row(line)) //Fetches the line
{
}
Reply
#6

Bump.. :/
Reply
#7

PLEASEEE NEED THAT !@
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)