I added an updates system which I can add updates to the server and every player can browse them using /updates
I wanted to ask that how can I edit the updates.cfg to change GMX Needed updates to Bug Fixes and Updates to Implemented whenever the server stats (OnGameModeInit)
PHP код:
CMD:addupdate(playerid, params[])
{
new type;
if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
if(PlayerInfo[playerid][pAdmin] >= 7)
{
if(sscanf(params, "is[128]", type, params))
{
SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /addupdate [type] [text]");
SendClientMessage(playerid, COLOR_WHITE, "** [Types]: 1 = Implemented / 2 = BugFix / 3 = Need GMX / 4 = Update");
return 1;
}
if(AntiAdv(playerid, params)) return 1;
if(type < 1 || type > 4) return SendClientMessage(playerid, COLOR_WHITE, "You've entered an inavlid update type.");
if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_WHITE, "Maximum characters limit is 128.");
new File: file = fopen("updates.cfg", io_append), string[128];
if(type == 1)
{
format(string, sizeof(string), "{088A08}[Implemented]{FFFFFF}: %s\r\n", params);
fwrite(file, string);
fclose(file);
}
else if(type == 2)
{
format(string, sizeof(string), "{B40404}[BugFix]{FFFFFF}: %s\r\n", params);
fwrite(file, string);
fclose(file);
}
else if(type == 3)
{
format(string, sizeof(string), "{FFFF00}[GMX Needed]{FFFFFF}: %s\r\n", params);
fwrite(file, string);
fclose(file);
}
else if(type == 4)
{
format(string, sizeof(string), "{DBA901}[Updated]{FFFFFF}: %s\r\n", params);
fwrite(file, string);
fclose(file);
}
format(string, sizeof(string), "Attention: %s has added a new update, check it out using /updates.", RPN(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, string);
Log("logs/updates.log", string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
}
return 1;
}