Global Motivation.
#1

Why in this global motd needs to restart my server before it going to show?

if there a motd saying like "Welcome back"

when you /motd Test i need to restart the server before the "Welcome back" changed to "test" why? whats the problem? I want if /motd test change the motd fast no need to restart the server.

Код:
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++;
Reply
#2

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();.
Reply
#3

Quote:
Originally Posted by admiralspeedy
Посмотреть сообщение
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();.
Yes. You are right it should be load after i update the /motd but how??

I need to load the motd after the motd updates? i wil ltry

Here is my SaveMOTD
Код:
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;
}
Load MOtd
Код:
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;
}
Reply
#4

any helps please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)