#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;
}
INI_String("Accent",PlayerInfo[playerid][pAccent][28]);
INI_String("Accent",PlayerInfo[playerid][pAccent], 28);
|
You need to add the size of the variable.
pawn Код:
pawn Код:
|