on player login
#1

i'm looking for a filterscript or a code that will send a message to players that are logged in that a player logged in.
Ex. *[Player's name] has just logged in*
Reply
#2

https://sampwiki.blast.hk/wiki/Creating_...Leave_Messages
Reply
#3

-snip-
Reply
#4

Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
}

#endif

public OnPlayerConnect(playerid)
{
  new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(string, sizeof(string), "%s has joined the server", pname);
  SendClientMessageToAll(0x0689ffff, string);
  return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
  new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  switch(reason)
  {
    case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
    case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
    case 2: format(string, sizeof(string), "%s has left the server. (Kicked/banned)", pname);
  }
  SendClientMessageToAll(0x0689ffff, string);
  return 1;
}
Worked good. Try this
Reply
#5

He's not looking for a join/leave message script, he's looking for a script that will send message to other players when someone logs in to his account.
Reply
#6

What register system are you using?
Reply
#7

I go it down to just this now though I still have one error that is the same.

Код:
public OnPlayerConnect(playerid) //Keeps saying error 029: invalid expression, assumed zero
{
  new plname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, plname, sizeof(plname));
  format(string, sizeof(string), "%s has joined the server", plname);
  SendClientMessageToAll(0xAAAAAAAA, string);
  return 1;
}
public OnPlayerDisconnect(playerid) //Keeps saying error 029: invalid expression, assumed zero

{
  new plname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, plname, sizeof(plname));
  {
	format(string, sizeof(string), "%s has left the server. (Leaving)", plname);
  }
  SendClientMessageToAll(0xAAAAAAAA, string);
  return 1;
the login/register system im using is this:

Код:
	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;
	}
Reply
#8

Anyone?
Reply
#9

don't bump within 12 hours. read the forum rules
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)