CMD:motd(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 1337) { if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /motd [message]"); new string[128]; format(string, sizeof(string), "AdmCmd: %s has changed the global motd to: %s.", GetPlayerNameEx(playerid), params); ABroadCast( COLOR_LIGHTRED, string, 4); format(GlobalMOTD, sizeof(GlobalMOTD), "%s", params); SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the Global MOTD."); SaveMOTDs(); } return 1; }
new motdstring[100]; format(motdstring,100,"NEWS: %s", GlobalMOTD); MainMenuTxtdraw[8] = TextDrawCreate(320.000000, 331.520019, motdstring); TextDrawLetterSize(MainMenuTxtdraw[8], 0.476000, 3.201597); TextDrawAlignment(MainMenuTxtdraw[8], 2); TextDrawColor(MainMenuTxtdraw[8], -65281); TextDrawSetShadow(MainMenuTxtdraw[8], 0); TextDrawSetOutline(MainMenuTxtdraw[8], 1); TextDrawBackgroundColor(MainMenuTxtdraw[8], 51); TextDrawFont(MainMenuTxtdraw[8], 1); TextDrawSetProportional(MainMenuTxtdraw[8], 1); textdrawscount++;
That isn't all of the code. If I had to guess, I'd say SaveMOTDs(); save the MOTD to a text document/INI file or something of the sort and then it loads it when the server starts.
You could set the command up to load it right after you update it so you don't need to restart the server, but to show you how to do it, I'd need at least the code for SaveMOTDs();. |
SaveMOTDs() { new coordsstring[512]; format(coordsstring, sizeof(coordsstring), "%s|%s|%s|%s", GlobalMOTD,AdminMOTD,VIPMOTD,CAMOTD); new File: file2 = fopen("motd.ini", io_write); fwrite(file2, coordsstring); fclose(file2); return 1; }
LoadMOTDs() { new arrCoords[4][128]; new strFromFile2[512]; new File: file = fopen("motd.ini", io_read); if (file) { fread(file, strFromFile2); splits(strFromFile2, arrCoords, '|'); strmid(GlobalMOTD, arrCoords[0], 0, strlen(arrCoords[0]), 255); strmid(AdminMOTD, arrCoords[1], 0, strlen(arrCoords[1]), 255); strmid(VIPMOTD, arrCoords[2], 0, strlen(arrCoords[2]), 255); strmid(CAMOTD, arrCoords[3], 0, strlen(arrCoords[3]), 255); fclose(file); } else { fcreate("motd.ini"); print("motd.ini doesn't exit, setting the default MOTDs"); format(GlobalMOTD, sizeof(GlobalMOTD), "Welcome to the Philippine Rolepay Server."); format(AdminMOTD, sizeof(AdminMOTD), "Admin MOTD: None."); format(VIPMOTD, sizeof(VIPMOTD), "VIP MOTD: None."); format(CAMOTD, sizeof(CAMOTD), "Helpers MOTD: None."); SaveMOTDs(); } return 1; }