INI String problem.
#1

Hello,

Could someone explain to me why I get the following error?
“(39) : error 017: undefined symbol "INI_String"”

Code:
pawn Код:
#include <a_samp>
#include <sscanf2>
#include <ZCMD>
#include <YSI\y_ini>

#define PATH "/Users/%s.ini"
#define COLOR_RED 0xAA3333AA
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"


enum pInfo
{
    pAdmin,
    pAccent[28]
}

new PlayerInfo[MAX_PLAYERS][pInfo];

stock user_ini_file(playerid)
{
    new
        string[ 128 ],
        user_name[ MAX_PLAYER_NAME ]
    ;

    GetPlayerName( playerid, user_name, MAX_PLAYER_NAME );
    format( string, sizeof ( string ), "%s.ini", user_name );
    return
        string;
}



forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_String("Accent",PlayerInfo[playerid][pAccent][28]); // line 39
   

    return 1;
}


stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        // ...
    }
    else
    {
        // ...
    }
    return 1;

}


public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));

    INI_SetTag(File,"data");
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteString(File, "Accent", PlayerInfo[playerid][pAccent]);
    INI_Close(File);
    return 1;
}


CMD:accent(playerid,params[])
{
    new accent[28];
    if(sscanf(params,"s[28]",accent)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /accent [custom accent]");

    PlayerInfo[playerid][pAccent] = accent;

    return 1;
}
NOTE: I have read the YINI thread, but I still do not understand the basis of the error.


Many thanks.
Reply
#2

You need to add the size of the variable.

pawn Код:
INI_String("Accent",PlayerInfo[playerid][pAccent][28]);
Should be:

pawn Код:
INI_String("Accent",PlayerInfo[playerid][pAccent], 28);
Also, I don't get why you're adding "[28]" in there.
Reply
#3

Alright; thank you for the help.
Reply
#4

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
You need to add the size of the variable.

pawn Код:
INI_String("Accent",PlayerInfo[playerid][pAccent][28]);
Should be:

pawn Код:
INI_String("Accent",PlayerInfo[playerid][pAccent], 28);
Also, I don't get why you're adding "[28]" in there.
This is
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)