17.10.2015, 21:15
I created a /motd you can set, and it will display when players connect. But some some reason, it writes to the server file correctly - but doesn't show for players. Only "MOTD" shows, and not the saved string. I'm not sure if I need to parse the file, or what. And if I do - would it go under onplayerconnect, and what would the .extra parameter be?
pawn Код:
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), "[Server MOTD]: {FFFFFF}%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;
}
//Sending MOTD under onplayerconnect
if(strlen(ServerInfo[sMOTD]) == 0) return SCM(pid,COLOR_GREY, "No MOTD has been set.");
SCM(pid,COLOR_LIGHTGREEN, ServerInfo[sMOTD]);