PHP код:
CMD:oban(playerid,params[])
{
new msg[144];
new filestring[80];
new name[24];
if(PlayerInfo[playerid][pAdmin] >= 3)
{
if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, COLORERROR, "AdmCmd: You must be on duty to do this. (/aduty)");
if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLORWHITE, "USAGE: /o(ffline)ban <fullplayername>");
format(filestring,sizeof(filestring),"/Users/%s.ini",name);
if(fexist(filestring))
{
INI_ParseFile(filestring, "LoadOfflineUser_%s", .bExtra = true, .extra = playerid);
if(PlayerInfo[playerid][pCheckingOfflineBan] == 0)
{
new INI:File = INI_Open(filestring);
INI_SetTag(File, "data");
INI_WriteInt(File, "Banned", 1);
INI_Close(File);
format(msg,sizeof(msg),"AdmBan: Player %s (Last IP - %s) was offline banned by %s.", params, PlayerInfo[playerid][pCheckingOfflineIP], GetName(playerid));
ABroadcast(COLORLIGHTRED, msg, 3);
AddBan(PlayerInfo[playerid][pCheckingOfflineIP]);
Log("logs/bans.txt", msg);
} else return SendClientMessage(playerid, COLORERROR, "That account is already banned.");
} else return SendClientMessage(playerid, COLORERROR, "That player was not found in our database.");
} else return SendClientMessage(playerid, COLORERROR, "You must be atleast a Head Admin to use this!");
return 1;
}
The problem is that the file gets saved as Player_Name with no extension at the end, and not in the Users folder, but in the scriptfiles...
PHP код:
format(filestring,sizeof(filestring),"/Users/%s.ini",name);
My other saving code works perfectly except this.
Nevermind, fixed.
I had to use a stock function for this to work but it's literally the same as formatting the string within the command... Oh well.