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;
}
I deeply apologize if I've left any necessary information out, and I appreciate any and all help received. Thank you for your time.