login/logout message
#1

I am looking for a good code that when someone logs in to the server or disconnects, it sends a message to everyone saying "Joe has just logged into blank server" I'd be grateful if someone could help me with this. I tried using the wiki and i didn't work at all.
Reply
#2

This is a very common system. There is in several game modes, filterscripts, and even tutorials. Use "search"...
Reply
#3

https://sampwiki.blast.hk/wiki/Creating_...Leave_Messages

Might help you get started.
Reply
#4

Quote:
Originally Posted by marine
I tried using the wiki and i didn't work at all.
As for the searching option, I've looked in a few other GM's and tried some and they didn't work. not sure why.
Reply
#5

Try download a simple filterscript with this code. Is easy to your understand. And, code is very simple
Reply
#6

I have looked for filterscripts and either they do not work or they include unneeded things.
Reply
#7

are you using a login script and if you are post what on and i and others will be able to help generate a code for you and dont listen to those people that say use search they just like to get posts cause if they really wanted to help they'd post a link to a topic
Reply
#8

Код:
//-------------------------------[Login]--------------------------------------------------------------------------
	if (strcmp(cmd, "/login", true) ==0 || strcmp(cmd, "/l", true) ==0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    new tmppass[64];
			if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: (/l)ogin [password]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			//Encrypt(tmppass);
			OnPlayerLogin(playerid,tmppass);
		}
		return 1;
	}

	//-----------Register---------------
	if (strcmp(cmd, "/register", true) ==0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "users/%s.ini", sendername);
			new File: hFile = fopen(string, io_read);
			if (hFile)
			{
				SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one.");
				fclose(hFile);
				return 1;
			}
	    new tmppass[64];
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /register [password]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			//Encrypt(tmppass);
			OnPlayerRegister(playerid,tmppass);
		}
		return 1;
	}
That's it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)