/(n)ewbie chat code
#1

Hey i seen theres only a few posts on the /newbie chat. so i decided to edit a code for ooc and switched it so its a newbie chat so if there are new players they type "/n How do i get in a car", "How do i buy a house?", etc.

You will notice that in the code it says [ooc] some places but it doesnt say it anywhere on the server so that doesnt matter its been tested and it works!

I dont really know how to script but im learning. But this works fine! Im thinking about making a /(h)elp one too. But thats out i dont know if its hard to find but if you need it let me know here and ill work on it.

*** Commands ***
"/n How do i get a new gun?" --> *** Newbie *** (NAME): How do i get a new gun?"
"/nonewbie" --> Newbie Chat has been disabled by an Admin"

add this to the top of the script:
Код:
new nonewbie;



Код:
if(strcmp(cmd, "/n", true) == 0 || strcmp(cmd, "/n", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 0)
	    {
	      SendClientMessage(playerid, COLOR_GREEN, "  You havent logged in yet !");
	      return 1;
	    }
			if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
			{
				SendClientMessage(playerid, COLOR_GREEN, "  The Newbie Chat has been disabled by an Admin !");
				return 1;
			}
			if(PlayerInfo[playerid][pMuted] == 1)
			{
				SendClientMessage(playerid, COLOR_GREEN, "  You can't speak, you have been silenced !");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GREEN, "USAGE: (/n)ewbie [Newbie Chat, Ask Questions]");
				return 1;
			}
			format(string, sizeof(string), " *** Newbie *** %s: %s ", sendername, result);
			OOCOff(COLOR_GREEN,string);
			printf("%s", string);
		}
		return 1;
	}
	if(strcmp(cmd, "/nonewbie", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if (PlayerInfo[playerid][pAdmin] >= 3 && (!nonewbie))
			{
				noooc = 1;
				BroadCast(COLOR_GREEN, "  Newbie Chat has been disabled by an Admin !");
			}
			else if (PlayerInfo[playerid][pAdmin] >= 3 && (nonewbie))
			{
				noooc = 0;
				BroadCast(COLOR_GREEN, "  Newbie Chat has been enabled by an Admin !");
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREEN, "  you are not authorized to use that command!");
			}
		}
		return 1;
	}
Reply
#2

If your gonna post code make sure its compatible with every GM, Not just GF/GF edits,
The whole reason people make posts about this is because they attempt to copy code from GF to thier GM and fail
Reply
#3

ok sorry, but yes this is works with gf, and add this to the top of code

Код:
new nonewbie;
Reply
#4

Quote:
Originally Posted by REDRUM
ok sorry, but yes this is works with gf, and add this to the top of code

Код:
new nonewbie;
I wasnt saying it should work with GF, I was saying it should work with GM's that arnt GF
Reply
#5

It's an edit of the / [ o ] o c ... anyway, it is possible to add timer so players wont spam at all?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)