Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <YSI\y_ini>
#define PATH "/Users/%s.ini" //Users Path
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" SetWeather & Time V1 Loaded");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pVip,
pDJ,
pBanned
}
new PlayerInfo[MAX_PLAYERS][pInfo];
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Vip",PlayerInfo[playerid][pVip]);
INI_Int("DJ",PlayerInfo[playerid][pDJ]);
INI_Int("Banned",PlayerInfo[playerid][pBanned]);
return 1;
}
main()
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
}
#endif
CMD:setmytime(playerid, params[])
{
new time;
if(PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, 0x0, "lol");
if(sscanf(params, "d", time))
{
SendClientMessage(playerid, 0x0, "lol");
}
return 1;
}
Код:
main()
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); <--- the line
}
There is no such variable in function main(). You should probably write this line in public OnPlayerConnect:
PHP код:
public OnPlayerConnect(playerid)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
return 1;
}
I haven't actually work with YSI ini, but here is an official wiki page link to the description of INI_ParseFile function: