Dini amIrite?
#1

Okay, so... I've got a script here, and the issue with said script is that it won't read/write files in sub-folders. I'll use the set-president command as an example, but the issue seems to be with each file contained in a folder within another folder:

Код:
CMD:setpres(playerid, params[])
{
	new giveplayerid, giveplayer[25], tmp2[256], string[128], playername[25];
	if (adlvl[playerid] < 5) return 0;
	if (sscanf(params, "u", giveplayerid)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /setpres [playerid]");
	if (!IsPlayerConnected2(giveplayerid)) return SendClientMessage2(playerid, COLOR_RED, "Error: Inactive player id!");
	if (Logged[giveplayerid] == 0) return SendClientMessage2(playerid, COLOR_WHITE, "Error: Player isn't logged in.");
	GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
	if (dini_Isset(AddDirFile(dir_userfiles, giveplayer), "president")) return SendPlayerFormattedText(playerid, COLOR_RED, "%s is already president.", giveplayer, "");
	if (dini_Isset(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "president"))
	{
		SendAllFormattedText(COLOR_YELLOW, "%s has replaced %s as President of San Andreas.", giveplayer, dini_Get(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "presidentname"));
		for (new i = 0, playercount=GetPlayerPoolSize(); i <= playercount; i++)
		{
			if (!IsPlayerConnected(i) || Logged[i] == 0 || i == playerid) continue;
			GetPlayerName(i, tmp2, MAX_PLAYER_NAME);
			if (dini_Isset(AddDirFile(dir_userfiles, tmp2), "president"))
			{
				SendClientMessage2(i, COLOR_RED, "An admin has removed you as President of San Andreas.");
				break;
			}
		}
		dini_Unset(AddDirFile(dir_userfiles, dini_Get(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "presidentname")), "president");
	}
	else SendAllFormattedText(COLOR_YELLOW, "%s has been set as President of San Andreas.", giveplayer, "");
	if (giveplayerid != playerid)
	{
		SendClientMessage2(giveplayerid, COLOR_WHITE, "An admin has set you as President of San Andreas.");
		SendPlayerFormattedText(playerid, COLOR_WHITE, "You have set %s as President of San Andreas.", giveplayer, "");
	}
	else SendClientMessage2(playerid, COLOR_WHITE, "You have set yourself as President of San Andreas.");
	dini_IntSet(AddDirFile(dir_userfiles, giveplayer), "president", 1);
	dini_IntSet(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "president", dini_Int(AddDirFile(dir_userfiles, giveplayer), "account"));
	dini_Set(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "presidentname", giveplayer);
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	format(string, 128, "Admin Log: %s has set %s as a President of San Andreas.", playername, giveplayer);
	SendMessageToAdmins(1, COLOR_ADMIN, string);
	return 1;
}
The defines for FILE_TOTALSTAT and dir_datafiles:

Код:
#define dir_userfiles "userfiles"
#define dir_cellfiles "cellfiles"
#define dir_datafiles "datafiles"
#define dir_propfiles "propfiles"
#define dir_orgfiles "orgfiles"
#define dir_busfiles "busfiles"
#define dir_carfiles "carfiles"
#define dir_enterexit "enterexit"
#define dir_propints "propints"
#define dir_clothesfiles "clothesfiles"

#define FILE_TOTALSTAT "totalstat"
#define FILE_CNUMS "cnums"
#define FILE_ADMINS "admins"
#define FILE_SUPPORTMEMBERS "supportmembers"
#define FILE_LPLATES "lplates"
#define FILE_OSTATS "orgstats"
#define FILE_GZONES "gangzones"
#define FILE_OWAGES "orgwages"
#define FILE_MAYORS "mayors"
#define FILE_TIPS "tips"
#define FILE_RULES "rules"
#define FILE_SONG "songs"
#define FILE_SONG2 "songsnames"
#define FILE_HATS "hatts"
#define FILE_GLASSES "glas"
#define FILE_BANDA "bana"
#define FILE_MASK "masks"
#define FILE_WATCH "watchf"
#define FILE_HELMET "helmets"
#define FILE_CAPS "capss"
#define FILE_ADMINCOL "admincolor"
The files that are unreachable:
[spoiler][/spoiler]

I deeply apologize if I've left any necessary information out, and I appreciate any and all help received. Thank you for your time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)