Admin joining message
#1

Hi all,

I wanna to make a script that defines if an Administrator is connected

I have made one for players :

PHP Code:
GetPlayerName(playerid,pname,sizeof(pname));
    
format(string,sizeof(string),"* %s(%d) vient de rejoindre {KFX} Survivants vs Zombies.",pname,playerid);
    
SendClientMessageToAll(COLOR_DEADCONNECT,string); 
But i wan't an other one for admins, for exemple if an administrator is connected they show up

PHP Code:
Administrator KillerDVX has joined the server 
Thanks.
Reply
#2

Quote:
Originally Posted by KillerDVX
View Post
Hi all,

I wanna to make a script that defines if an Administrator is connected

I have made one for players :

PHP Code:
GetPlayerName(playerid,pname,sizeof(pname));
    
format(string,sizeof(string),"* %s(%d) vient de rejoindre {KFX} Survivants vs Zombies.",pname,playerid);
    
SendClientMessageToAll(COLOR_DEADCONNECT,string); 
But i wan't an other one for admins, for exemple if an administrator is connected they show up

PHP Code:
Administrator KillerDVX has joined the server 
Thanks.
have you tried:
Code:
if(PlayerInfo[i][pAdmin] >= 1)
{
format(string,sizeof(string),"* Administrator KillerDVX has joined the server");
	SendClientMessageToAll(COLOR_DEADCONNECT,string);
}
EDIT: here's what i use in my server Dont forget to rep++ me if i helped!
Code:
if (PlayerInfo[playerid][pAdmin] > 0)
		{
		    if(PlayerInfo[playerid][pAdmin] == 1)
		    {
				SendClientMessageEx(playerid, COLOR_WHITE,"You are logged in as a Server Moderator.");
		    }
		    else
		    {
				format(string2, sizeof(string2), "You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
				SendClientMessageEx(playerid, COLOR_WHITE,string2);
			}

   			if(PlayerInfo[playerid][pAdmin] == 1)
		    {
  				format( string2, sizeof( string2 ), "%s has logged in as a Server Moderator.", GetPlayerNameEx( playerid ));
		    }
		    else
		    {
				format( string2, sizeof( string2 ), "%s has logged in as a Level %d Admin.", GetPlayerNameEx( playerid ), PlayerInfo[playerid][pAdmin] );
			}

			foreach(Player, i)
			{
			    if( PlayerInfo[i][pAdmin] >= 1337 )
			    {
			        if(PlayerInfo[i][pAdmin] >= PlayerInfo[playerid][pAdmin]) SendClientMessageEx(i, COLOR_WHITE, string2);
			    }
			}

		}
Reply
#3

Code:
public OnPlayerConnect(playerid)
{
	new astr[120], aname[MAX_PLAYER_NAME];
	if(pInfo[playerid][pAdmin] > 0) // Change with own var
	{
		GetPlayerName(playerid,aname,sizeof(aname));
		format(astr, sizeof(astr), "* Administrator %s has joined the server", aname);
		SendClientMessageToAll(COLOR_DEADCONNECT, astr);
	}
	return 1;
}
Reply
#4

Quote:
Originally Posted by JaydenJason
View Post
Code:
public OnPlayerConnect(playerid)
{
	new astr[120], aname[MAX_PLAYER_NAME];
	if(pInfo[playerid][pAdmin] > 0) // Change with own var
	{
		GetPlayerName(playerid,aname,sizeof(aname));
		format(astr, sizeof(astr), "* Administrator %s has joined the server", aname);
		SendClientMessageToAll(COLOR_DEADCONNECT, astr);
	}
	return 1;
}
Yea, Thats what i told him to do! KillerDVX try any one of this both works!
Reply
#5

Quote:
Originally Posted by GTLS
View Post
have you tried:
Code:
if(PlayerInfo[i][pAdmin] >= 1)
{
format(string,sizeof(string),"* Administrator KillerDVX has joined the server");
	SendClientMessageToAll(COLOR_DEADCONNECT,string);
}
EDIT: here's what i use in my server Dont forget to rep++ me if i helped!
Code:
if (PlayerInfo[playerid][pAdmin] > 0)
		{
		    if(PlayerInfo[playerid][pAdmin] == 1)
		    {
				SendClientMessageEx(playerid, COLOR_WHITE,"You are logged in as a Server Moderator.");
		    }
		    else
		    {
				format(string2, sizeof(string2), "You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
				SendClientMessageEx(playerid, COLOR_WHITE,string2);
			}

   			if(PlayerInfo[playerid][pAdmin] == 1)
		    {
  				format( string2, sizeof( string2 ), "%s has logged in as a Server Moderator.", GetPlayerNameEx( playerid ));
		    }
		    else
		    {
				format( string2, sizeof( string2 ), "%s has logged in as a Level %d Admin.", GetPlayerNameEx( playerid ), PlayerInfo[playerid][pAdmin] );
			}

			foreach(Player, i)
			{
			    if( PlayerInfo[i][pAdmin] >= 1337 )
			    {
			        if(PlayerInfo[i][pAdmin] >= PlayerInfo[playerid][pAdmin]) SendClientMessageEx(i, COLOR_WHITE, string2);
			    }
			}

		}
Ye an NGG Edit
Reply
#6

Quote:
Originally Posted by dionisak0s
View Post
Ye an NGG Edit
nope! i got this thing learned from FeaR's LARP!
Reply
#7

PHP Code:
public OnPlayerConnect(playerid)
{
    new 
AdminName[MAX_PLAYER_NAME],message[128];
    
GetPlayerName(playerid,AdminName,sizeof(AdminName)); 
    if(
PlayerInfo[playerid][pAdmin] >= 1// If your var is e.g. pAdministrator change pAdmin to pAdministrator...
    
{
        
format(message,128,"%s[%d] joined the game.",AdminName,playerid); // e.g. "Mirko[1] joined the game". %s means string,%d integer.
        
SendClientMessageToAll(-1,message); // Sending message to all.
    
}

Reply
#8

PHP Code:
error 017undefined symbol "pInfo" 
It gives me that error,

I tried

enum pInfo
{
pAdmin,
};
new PlayerInfo[MAX_PLAYERS][pInfo];

But it gives me :

PHP Code:
error 028invalid subscript (not an array or too many subscripts): "pInfo" 
Reply
#9

Quote:
Originally Posted by GTLS
View Post
have you tried:
Code:
if(PlayerInfo[i][pAdmin] >= 1)
{
format(string,sizeof(string),"* Administrator KillerDVX has joined the server");
	SendClientMessageToAll(COLOR_DEADCONNECT,string);
}
EDIT: here's what i use in my server Dont forget to rep++ me if i helped!
Code:
if (PlayerInfo[playerid][pAdmin] > 0)
		{
		    if(PlayerInfo[playerid][pAdmin] == 1)
		    {
				SendClientMessageEx(playerid, COLOR_WHITE,"You are logged in as a Server Moderator.");
		    }
		    else
		    {
				format(string2, sizeof(string2), "You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
				SendClientMessageEx(playerid, COLOR_WHITE,string2);
			}

   			if(PlayerInfo[playerid][pAdmin] == 1)
		    {
  				format( string2, sizeof( string2 ), "%s has logged in as a Server Moderator.", GetPlayerNameEx( playerid ));
		    }
		    else
		    {
				format( string2, sizeof( string2 ), "%s has logged in as a Level %d Admin.", GetPlayerNameEx( playerid ), PlayerInfo[playerid][pAdmin] );
			}

			foreach(Player, i)
			{
			    if( PlayerInfo[i][pAdmin] >= 1337 )
			    {
			        if(PlayerInfo[i][pAdmin] >= PlayerInfo[playerid][pAdmin]) SendClientMessageEx(i, COLOR_WHITE, string2);
			    }
			}

		}
pawn Code:
if(code to check if the player is an admin)
{
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "* %s(%d) vient de rejoindre {KFX} Survivants vs Zombies.", pname, playerid);
    SendClientMessageToAll(COLOR_DEADCONNECT, string);
}
else
{
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "* %s(%d) vient de rejoindre {KFX} Survivants vs Zombies.", pname, playerid);
    SendClientMessageToAll(COLOR_DEADCONNECT, string);
}
Reply
#10

Quote:
Originally Posted by KillerDVX
View Post
PHP Code:
error 017undefined symbol "pInfo" 
It gives me that error,

I tried

enum pInfo
{
pAdmin,
};
new PlayerInfo[MAX_PLAYERS][pInfo];

But it gives me :

PHP Code:
error 028invalid subscript (not an array or too many subscripts): "pInfo" 
try https://sampforum.blast.hk/showthread.php?tid=359274
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)