2021-02-14, 08:30 PM
(2021-02-14, 08:01 PM)mems Wrote: btw, is there any way to make those if statements ? i've tried myself but it wouldn't work:
Code:CMD:osetallgsf(playerid, params[])
{
? ? new File: handle = fopen("allusers.txt", io_read), nick[MAX_PLAYER_NAME], INI: file;
? ? new string[192], fstring[46], pname[MAX_PLAYER_NAME], gsflevel;
? ? if((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][AdminLevel] == 3) {
? ? ? ? if(sscanf(params, "i", gsflevel)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /osetallgsf <level>");
? ? ? ? if(gsflevel > 13) return SendClientMessage(playerid, COLOR_RED, "ERROR: Max GSF level is 13");
? ? ? ? if(gsflevel < 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Cannot set lower than 0");
? ? ? ? if(handle)
? ? ? ? {
? ? ? ? ? ? while(fread(handle, nick))
? ? ? ? ? ? {
? ? ? ? ? ? ? ? format(fstring, 46, "Users/%s.ini", nick);
? ? ? ? ? ? if(INI_ParseFile(fstring, "LoadGSFLevel", .bPassTag = true)) {
? ? ? ? ? ? if(GSFLevelInfo >= 1) {
GetPlayerName(playerid, pname, sizeof(pname));
? ? ? ? ? ? ? ? format(string, sizeof(string), "[STAFF]: \"%s\" has issued the command: {FF0000}OSETALLGSF{00FFFF}.", pname);
? ? ? ? ? ? ? ? SendToRCON(COLOR_AQUA, string);
? ? ? ? ? ? ? ? format(string, sizeof(string), "[{FF0000}GSF{FFFFFF}]: Successfully offline set {FF0000}%s's{FFFFFF} GSF level to: %i.", nick, gsflevel);
? ? ? ? ? ? ? ? SendClientMessage(playerid, COLOR_WHITE, string);
? ? ? ? ? ? ? ? StripNewLine(nick);
? ? ? ? ? ? ? ? file = INI_Open(fstring);
? ? ? ? ? ? ? ? INI_SetTag(file, "=|PlayerData|=");
? ? ? ? ? ? ? ? INI_WriteInt(file, "GSFLevel", gsflevel);
? ? ? ? ? ? ? ? INI_Close(file);
? ? ? ? ? ? } else return SendClientMessage(playerid, COLOR_RED, "ERROR: No account was found having a GSF level.");
}
? ? ? ? ? ? }
? ? ? ? ? ? fclose(handle);
? ? ? ? } else return SendClientMessage(playerid, COLOR_RED, "ERROR: The file \"allusers.txt\" does not exist, therefore canceling the process.");
? ? ? ? return 1;
? ? } else return SendClientMessage(playerid, COLOR_RED, "ERROR: Authorization revoked.");
}
and the function that i used:
Code:forward LoadGSFLevel(tag[], name[], value[]);
public LoadGSFLevel(tag[], name[], value[])
{
? ? if(!strcmp("=|PlayerData|=", tag))
? ? INI_Int("GSFLevel", GSFLevelInfo);
? ? return 1;
}
Sorry I didn't understand what you want to do. Explain more