SA-MP Forums Archive
login/logout message - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: login/logout message (/showthread.php?tid=124290)



login/logout message - marine - 29.01.2010

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.


Re: login/logout message - LuxurioN™ - 29.01.2010

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


Re: login/logout message - Gappy - 29.01.2010

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

Might help you get started.


Re: login/logout message - marine - 29.01.2010

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.


Re: login/logout message - LuxurioN™ - 29.01.2010

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


Re: login/logout message - marine - 29.01.2010

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


Re: login/logout message - fsnameless - 29.01.2010

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


Re: login/logout message - marine - 30.01.2010

Код:
//-------------------------------[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.