24.10.2015, 05:59
I have a MOTD that is changeable via /motd. However, when players connect - they see it. But when the server reloads, the MOTD is set to "MOTD" and appears as "[MOTD]: MOTD" in-game. It's a bit strange, tbh.
If anyone can spot out the issue as to why this isn't loading correctly, that'd be great. And as I mentioned - when the server gmx's, the MOTD is set to "MOTD" as if some INI_STRING parameters are wrong.
pawn Код:
enum sInfo
{
sMOTD[128]
}
#define SERVERPATH "Server/%s.ini"
new ServerInfo[sInfo];
forward LoadServer_data( name[], value[]);
public LoadServer_data( name[], value[] )
{
INI_String("MOTD", ServerInfo[sMOTD], 128);
return 1;
}
// under ongamemodeinit
//Loading MOTD
INI_ParseFile("Server/server.ini", "LoadServer_data", .bExtra = true, .extra = false);
CMD:motd(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4) return SCM(pid, COLOR_GREY, ERROR);
new string[128], message[128];
if(sscanf(params,"s[128]", message)) return SCM(pid,COLOR_WHITE, "USAGE: /motd [message]");
format(string,sizeof(string), "%s", message);
ServerInfo[sMOTD] = string;
new INI:file = INI_Open("Server/server.ini");
INI_SetTag(file, "data");
INI_WriteString(file, "MOTD", string);
INI_Close(file);
SCM(pid,COLOR_GREEN, "You have successfully set the message of the day.");
return 1;
}