#1

Seems to be alot of questions regarding it lately.. but uh.. What's wrong with this?

pawn Код:
CMD:openfile(playerid, params[])
{
    new
        FileName[50],
        string[128];

    if(sscanf(params, "s", FileName))
        return SendClientMessage(playerid, -1, "{FFFFFF}Usage: /OpenFile [file name]");

    format(string, sizeof(string), "Accounts/%s.ini", FileName);
    new
        INI:file = INI_Open(string);
       
    new
        pPW[128],
        pAuthLvl,
        pVIP,
        pCash,
        pSkin,
        pScore,
        pKills,
        pDeaths,
        pCustomCarID,
        pCustomCarC1,
        pCustomCarC2,
        pCustomCarPlate[32];
       
    INI_String("Password", pPW, 128);
    INI_Int("Authorization", pAuthLvl);
    INI_Int("VIP", pVIP);
    INI_Int("Cash", pCash);
    INI_Int("Skin", pSkin);
    INI_Int("Score", pScore);
    INI_Int("Kills", pKills);
    INI_Int("Deaths", pDeaths);
    INI_Int("CustomCarID", pCustomCarID);
    INI_Int("CustomCarC1", pCustomCarC1);
    INI_Int("CustomCarC2", pCustomCarC2);
    INI_String("CustomCarPlate", pCustomCarPlate, 32);

    new string2[128];
    format(string2, sizeof(string2), "Filename: %s.ini | Password: %s | Auth. Lvl: %d | V.I.P Lvl: %d", FileName, pPW, pAuthLvl, pVIP);
    SendClientMessage(playerid, -1, string2);
    format(string2, sizeof(string2), "Cash: $%d | Skin: %d | Score: %d | Kills: %d | Deaths: %d", pCash, pSkin, pScore, pKills, pDeaths);
    SendClientMessage(playerid, -1, string2);
    format(string2, sizeof(string2), "Custom Car ID: %d | Custom Car C1: %d | Custom Car C2: %d | Custom Plate: %s", pCustomCarID, pCustomCarC1, pCustomCarC2, pCustomCarPlate);
    SendClientMessage(playerid, -1, string2);
    INI_Close(file);
    return 1;
}
I'm receiving the error:

Quote:

C:\Users\Sky\Documents\Local FunZone\gamemodes\new.pwn(53 : error 017: undefined symbol "name"
C:\Users\Sky\Documents\Local FunZone\gamemodes\new.pwn(53 : error 017: undefined symbol "value"

The error is on every single line with INI_String, and INI_Int.
Reply
#2

Bump.
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
Did you read the tutorial?
Yeah, I did. I don't quite understand the part about ParseFile, and that's what i'm assuming is wrong. Although, I very well could be wrong.
Reply
#4

Try making two new variables name and value?
Reply
#5

Quote:
Originally Posted by Dr
Посмотреть сообщение
Try making two new variables name and value?
..........No.
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
It is, yes. y_ini works on a callback system, not a direct call system. Instead of you requesting data from a file, the system pushes all loaded data but calling a callback function once for each line in the file. In that function you use "INI_Int" etc.
Hmm, okay. So, could you perhaps write up an example on how this would work real quick?

I'm assuming like:

pawn Код:
INI_ParseFile(string, "GetData", .bExtra = true, .extra = playerid);
?

Ugh, and apparently my loading system isn't even working, so I'm gonna need help on that too.. Once I get this system down it'll be great, it's just trying to learn the darn thing.

pawn Код:
OnPlayerLogin(playerid, inputtext);
pawn Код:
new
                    uFile[35],
                    player_Name[MAX_PLAYER_NAME];

                GetPlayerName(playerid, player_Name, sizeof(player_Name));
                format(uFile, 35, USER_DIRECTORY, player_Name);

                INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
pawn Код:
OnPlayerLogin(playerid, password[])
{
    new
        uFile[35],
        player_Name[MAX_PLAYER_NAME];

    GetPlayerName(playerid, player_Name, sizeof(player_Name));
    format(uFile, 35, USER_DIRECTORY, player_Name);

    INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);

    if(strcmp(SInfo[playerid][Password], password, true))
    {
        new
            string2[128];
           
        SetPVarInt(playerid, "Logged", 1);
        SendClientMessage(playerid, -1, "{FFFFFF}You have logged into Sky's Local Fun Zone!");
        format(string2, sizeof(string2), "Password: %s | Auth. Lvl: %d | V.I.P Lvl: %d", SInfo[playerid][Password], SInfo[playerid][AuthLvl], SInfo[playerid][VIP]);
        printf(string2);
        format(string2, sizeof(string2), "Cash: $%d | Skin: %d | Score: %d | Kills: %d | Deaths: %d", SInfo[playerid][Cash], SInfo[playerid][CustomSkin], SInfo[playerid][Score], SInfo[playerid][Kills], SInfo[playerid][Deaths]);
        printf(string2);
        format(string2, sizeof(string2), "Custom Car ID: %d | Custom Car C1: %d | Custom Car C2: %d | Custom Plate: %s", SInfo[playerid][CustomCarID], SInfo[playerid][CustomCarC1], SInfo[playerid][CustomCarC2], SInfo[playerid][CustomCarPlate]);
        printf(string2);
    }
    return 1;
}
pawn Код:
public LoadUserData(playerid, name[], value[])
{
    INI_String("Password", SInfo[playerid][Password], 128);
    INI_Int("Authorization", SInfo[playerid][AuthLvl]);
    INI_Int("VIP", SInfo[playerid][VIP]);
    INI_Int("Cash", SInfo[playerid][Cash]);
    INI_Int("Skin", SInfo[playerid][CustomSkin]);
    INI_Int("Score", SInfo[playerid][Score]);
    INI_Int("Kills", SInfo[playerid][Kills]);
    INI_Int("Deaths", SInfo[playerid][Deaths]);
    INI_Int("CustomCarID", SInfo[playerid][CustomCarID]);
    INI_Int("CustomCarC1", SInfo[playerid][CustomCarC1]);
    INI_Int("CustomCarC2", SInfo[playerid][CustomCarC2]);
    INI_String("CustomCarPlate", SInfo[playerid][CustomCarPlate], 32);
    return 1;
}
What's wrong with that? It doesn't even call the function. I'm not getting the whole "ParseFile" thing.
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
How do you know it's not calling it? There's no print statements anywhere!
pawn Код:
OnPlayerLogin(playerid, password[])
{
    new
        uFile[50],
        player_Name[MAX_PLAYER_NAME];

    GetPlayerName(playerid, player_Name, sizeof(player_Name));
    format(uFile, 50, USER_DIRECTORY, player_Name);

    INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);

    if(strcmp(SInfo[playerid][Password], password, true))
    {
        new
            string2[128];
           
        SetPVarInt(playerid, "Logged", 1);
        SendClientMessage(playerid, -1, "{FFFFFF}You have logged into Sky's Local Fun Zone!");
        [B]format(string2, sizeof(string2), "Password: %s | Auth. Lvl: %d | V.I.P Lvl: %d", SInfo[playerid][Password], SInfo[playerid][AuthLvl], SInfo[playerid][VIP]);
        printf(string2);
        format(string2, sizeof(string2), "Cash: $%d | Skin: %d | Score: %d | Kills: %d | Deaths: %d", SInfo[playerid][Cash], SInfo[playerid][CustomSkin], SInfo[playerid][Score], SInfo[playerid][Kills], SInfo[playerid][Deaths]);
        printf(string2);
        format(string2, sizeof(string2), "Custom Car ID: %d | Custom Car C1: %d | Custom Car C2: %d | Custom Plate: %s", SInfo[playerid][CustomCarID], SInfo[playerid][CustomCarC1], SInfo[playerid][CustomCarC2], SInfo[playerid][CustomCarPlate]);
        printf(string2);[/B]
    }
    return 1;
}
None of those prints get called. That print is called directly when that function is called.. Nor do I get the client message.
Reply
#8

I added a print under LoadUserData, and uhhh.. Interesting.

pawn Код:
[13:25:20] loaduserdata calleds
[13:25:20] loaduserdata calleds
[13:25:20] loaduserdata calleds
[13:25:20] uFile: Sky
[13:25:20] loaduserdata calleds
[13:25:20] loaduserdata calleds
[13:25:20] loaduserdata calleds
[13:25:20] inputtext: lolol1
[13:25:20] <User:Sky> Logged in. [7/25/2011 @ 13:25]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)