SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/03/2020, 10:01 AM   #1
mems
Big Clucker
 
Join Date: Oct 2019
Posts: 142
Reputation: 0
Default messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

hello,

it's been almost 1 week since i modified joining/leaving/dm chating messages (from default messages to some kind of admin rank messages if player's an admin, etc.) and the problem is that the "RCON" one doesn't show up in any joining/leaving/dm chating messages. I've tried simpler ways to fix it, it still stays the same no matter what. here are the 3 codes i've made, joining/leaving/dm chating:

this is on OnPlayerConnect:

pawn Code:
if(PlayerInfo[playerid][AdminLevel] > 0)
        {
            if(IsPlayerAdmin(playerid))
            {
                admrank = "{FF0000}[RCON Admin]";
            }
            else
            {
                switch(PlayerInfo[playerid][AdminLevel])
                {
                    case 1: admrank = "{FFFF00}[Moderator]";
                    case 2: admrank = "{008000}[Administrator]";
                    case 3: admrank = "{3366FF}[Manager]";
                }
            }
            format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} %s {FFFFFF}%s (%d) {00FF00}has joined the server!", admrank, pname, playerid);
            SendClientMessageToAll(COLOR_LIME, string);
        }
        else
        {
            format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{FFFFFF} %s (%d) {00FF00}has joined the server!", pname, playerid);
            SendClientMessageToAll(COLOR_LIME, string);
        }
    }
    else
    {
        format(string, sizeof(string), "{FFFFFF}Welcome, the account \"{FF0000}%s{FFFFFF}\" is not registered.\nIn order to play, you must register by typing a password below.", pname);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FF0000}Registration", string, "Okay", "Quit");
        format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} \"{FFFFFF}%s{00FF00}\" (%d) has joined the server for the first time!", pname, playerid);
    }
    return 1;
}

this one is on OnPlayerDisconnect:

pawn Code:
if(PlayerInfo[playerid][AdminLevel] > 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            admrank = "{FF0000}[RCON Admin]";
        }
        else
        {
            switch(PlayerInfo[playerid][AdminLevel])
            {
                case 1: admrank = "{FFFF00}[Moderator]";
                case 2: admrank = "{008000}[Administrator]";
                case 3: admrank = "{3366FF}[Manager]";
            }
        }
        switch(reason)
        {
            case 0: format(string,sizeof(string),"{A9A9A9}[{FF0000}-{A9A9A9}] %s{FFFFFF} %s (%d) {FF0000}has left the server. (Timeout/Crash)",admrank, pname, playerid);
            case 1: format(string,sizeof(string),"{A9A9A9}[{FF0000}-{A9A9A9}] %s{FFFFFF} %s (%d) {FF0000}has left the server. (Leaving)",admrank, pname, playerid);
            case 2: format(string,sizeof(string),"{A9A9A9}[{FF0000}-{A9A9A9}] %s{FFFFFF} %s (%d) {FF0000}has left the server. (Kicked/Banned)",admrank, pname, playerid);
        }
    }
    else
    {
        switch(reason)
        {
            case 0: format(string,sizeof(string),"{A9A9A9}[{FF0000}-{A9A9A9}]{FFFFFF} %s (%d) {FF0000}has left the server. (Timeout/Crash)",pname, playerid);
            case 1: format(string,sizeof(string),"{A9A9A9}[{FF0000}-{A9A9A9}]{FFFFFF} %s (%d) {FF0000}has left the server. (Leaving)",pname, playerid);
            case 2: format(string,sizeof(string),"{A9A9A9}[{FF0000}-{A9A9A9}]{FFFFFF} %s (%d) {FF0000}has left the server. (Kicked/Banned)",pname, playerid);
        }
    }
    SendClientMessageToAll(COLOR_LIME, string);

and this one is on OnPlayerText but it gets triggered only when a player's on a deathmatch arena:

pawn Code:
if(dm[playerid] == 1)
    {
        if(PlayerInfo[playerid][AdminLevel] > 0)
        {
            if(IsPlayerAdmin(playerid))
            {
                switch(dm[playerid])
                {
                    case 0:
                    {
                        format(string,sizeof(string),"{800080}[DDM] [RCON] %s(%d): %s", pname, playerid, text);
                        SendClientMessageToAll(COLOR_PURPLE, string);
                        return 0;
                    }
                    case 1:
                    {
                        format(string,sizeof(string),"{800080}[SDM] [RCON] %s(%d): %s",pname, playerid, text);
                        SendClientMessageToAll(COLOR_PURPLE, string);
                        return 0;
                    }
                    case 2:
                    {
                        format(string,sizeof(string),"{800080}[SOSDM] [RCON] %s(%d): %s",pname, playerid, text);
                        SendClientMessageToAll(COLOR_PURPLE, string);
                        return 0;
                    }
                }
            }
            else
            {
                switch(PlayerInfo[playerid][AdminLevel])
                {
                    case 1: admrank = "[Moderator]";
                    case 2: admrank = "[Administrator]";
                    case 3: admrank = "[Manager]";
                }
            }
            switch(dm[playerid])
            {
                case 0:
                {
                    format(string,sizeof(string),"{800080}[DDM] %s %s(%d): %s",admrank, pname, playerid, text);
                    SendClientMessageToAll(COLOR_PURPLE, string);
                    return 0;
                }
                case 1:
                {
                    format(string,sizeof(string),"{800080}[SDM] %s %s(%d): %s",admrank, pname, playerid, text);
                    SendClientMessageToAll(COLOR_PURPLE, string);
                    return 0;
                }
                case 2:
                {
                    format(string,sizeof(string),"{800080}[SOSDM] %s %s(%d): %s",admrank, pname, playerid, text);
                    SendClientMessageToAll(COLOR_PURPLE, string);
                    return 0;
                }
            }
        }
        else
        {
            switch(dm[playerid])
            {
                case 0:
                {
                    format(string,sizeof(string),"%s(%d): %s",pname, playerid, text);
                    SendClientMessageToAll(COLOR_PURPLE, string);
                    return 0;
                }
                case 1:
                {
                    format(string,sizeof(string),"%s(%d): %s",pname, playerid, text);
                    SendClientMessageToAll(COLOR_PURPLE, string);
                    return 0;
                }
                case 2:
                {
                    format(string,sizeof(string),"%s(%d): %s",pname, playerid, text);
                    SendClientMessageToAll(COLOR_PURPLE, string);
                    return 0;
                }
            }
        }
    }

and in case you want to know the default messaging: (also on OnPlayerText)

pawn Code:
if(IsPlayerAdmin(playerid))
    {
        format(string, sizeof(string), "[RCON] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_RCON, string);
        return 0;
    }
    if(PlayerInfo[playerid][AdminLevel] < 1)
    {
        format(string, sizeof(string), "%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_WHITE, string);
        return 0;
    }
    if(PlayerInfo[playerid][AdminLevel] == 1)
    {
        format(string, sizeof(string), "[Moderator] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_YELLOW, string);
        return 0;
    }
    if(PlayerInfo[playerid][AdminLevel] == 2)
    {
        format(string, sizeof(string), "[Administrator] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_ADMINISTRATOR, string);
        return 0;
    }
    if(PlayerInfo[playerid][AdminLevel] == 3)
    {
        format(string, sizeof(string), "[Manager] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_MANAGER, string);
        return 0;
    }
    return 1;
}

any help's appreciated, i don't know if 1 of these can fix all the other 2 (except from the default texting)

p.s: the default messaging is below the dm chating one, just to let you know
mems is offline   Reply With Quote
Old 28/03/2020, 05:15 PM   #2
ChuckyBabe
Huge Clucker
 
ChuckyBabe's Avatar
 
Join Date: Aug 2013
Location: C:\Program Files\Rockstar Games\GTA San Andreas
Posts: 463
Reputation: 11
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

Code:
if(PlayerInfo[playerid][AdminLevel] > 0)
        {
            else if(IsPlayerAdmin(playerid))
            {
                admrank = "{FF0000}[RCON Admin]";
            }
            else
            {
                switch(PlayerInfo[playerid][AdminLevel])
                {
                    case 1: admrank = "{FFFF00}[Moderator]";
                    case 2: admrank = "{008000}[Administrator]";
                    case 3: admrank = "{3366FF}[Manager]";
                }
            }
            format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} %s {FFFFFF}%s (%d) {00FF00}has joined the server!", admrank, pname, playerid);
            SendClientMessageToAll(COLOR_LIME, string);
        }
        else
        {
            format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{FFFFFF} %s (%d) {00FF00}has joined the server!", pname, playerid);
            SendClientMessageToAll(COLOR_LIME, string);
        }
    }
    else
    {
        format(string, sizeof(string), "{FFFFFF}Welcome, the account \"{FF0000}%s{FFFFFF}\" is not registered.\nIn order to play, you must register by typing a password below.", pname);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FF0000}Registration", string, "Okay", "Quit");
        format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} \"{FFFFFF}%s{00FF00}\" (%d) has joined the server for the first time!", pname, playerid);
    }
    return 1;
}
just give it a shot
__________________
ChuckyBabe is offline   Reply With Quote
Old 28/03/2020, 07:39 PM   #3
mems
Big Clucker
 
Join Date: Oct 2019
Posts: 142
Reputation: 0
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

Quote:
Originally Posted by ChuckyBabe View Post
Code:
if(PlayerInfo[playerid][AdminLevel] > 0)
        {
            else if(IsPlayerAdmin(playerid))
            {
                admrank = "{FF0000}[RCON Admin]";
            }
            else
            {
                switch(PlayerInfo[playerid][AdminLevel])
                {
                    case 1: admrank = "{FFFF00}[Moderator]";
                    case 2: admrank = "{008000}[Administrator]";
                    case 3: admrank = "{3366FF}[Manager]";
                }
            }
            format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} %s {FFFFFF}%s (%d) {00FF00}has joined the server!", admrank, pname, playerid);
            SendClientMessageToAll(COLOR_LIME, string);
        }
        else
        {
            format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{FFFFFF} %s (%d) {00FF00}has joined the server!", pname, playerid);
            SendClientMessageToAll(COLOR_LIME, string);
        }
    }
    else
    {
        format(string, sizeof(string), "{FFFFFF}Welcome, the account \"{FF0000}%s{FFFFFF}\" is not registered.\nIn order to play, you must register by typing a password below.", pname);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FF0000}Registration", string, "Okay", "Quit");
        format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} \"{FFFFFF}%s{00FF00}\" (%d) has joined the server for the first time!", pname, playerid);
    }
    return 1;
}
just give it a shot
sorry for late response,

it has errors, here they are:

pawn Code:
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "if"
mems is offline   Reply With Quote
Old 29/03/2020, 05:46 AM   #4
SiaReyes
Gangsta
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 618
Reputation: 57
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

Code:
else if(IsPlayerAdmin(playerid))
remove else
SiaReyes is offline   Reply With Quote
Old 30/03/2020, 03:00 PM   #5
mems
Big Clucker
 
Join Date: Oct 2019
Posts: 142
Reputation: 0
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

Quote:
Originally Posted by SiaReyes View Post
Code:
else if(IsPlayerAdmin(playerid))
remove else
it persists.. still doesn't show [RCON]
mems is offline   Reply With Quote
Old 31/03/2020, 02:33 PM   #6
mems
Big Clucker
 
Join Date: Oct 2019
Posts: 142
Reputation: 0
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

bump
mems is offline   Reply With Quote
Old 31/03/2020, 03:59 PM   #7
SiaReyes
Gangsta
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 618
Reputation: 57
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

Dude, when you connect to server, you are not logged into rcon, so it returns false. That's why it doesn't show [RCON Admin].
SiaReyes is offline   Reply With Quote
Old 31/03/2020, 04:58 PM   #8
mems
Big Clucker
 
Join Date: Oct 2019
Posts: 142
Reputation: 0
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

Quote:
Originally Posted by SiaReyes View Post
Dude, when you connect to server, you are not logged into rcon, so it returns false. That's why it doesn't show [RCON Admin].
i even tried when i was in game, set my self to rcon by typing /rcon login and it still doesn't do anything. but if i set my level to 1, it will appear in those 3 type of messages (join/leave/dm)
mems is offline   Reply With Quote
Old 31/03/2020, 08:23 PM   #9
Tass007
Gangsta
 
Tass007's Avatar
 
Join Date: May 2011
Location: Somewhere not near you
Posts: 733
Reputation: 31
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

When you say it doesn't do anything? Which bit? The OnPlayerConnect, won't work as someone already stated above, because you have to login as rcon after you've connected.

Code:
	if(PlayerInfo[playerid][AdminLevel] > 0)
	{
		if(IsPlayerAdmin(playerid))
		{
			admrank = "{FF0000}[RCON Admin]";
		}
		else
		{
			switch(PlayerInfo[playerid][AdminLevel])
			{
				case 1: admrank = "{FFFF00}[Moderator]";
				case 2: admrank = "{008000}[Administrator]";
				case 3: admrank = "{3366FF}[Manager]";
			}
		}
		format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} %s {FFFFFF}%s (%d) {00FF00}has joined the server!", admrank, pname, playerid);
		SendClientMessageToAll(COLOR_LIME, string);
	}
	else
	{
		format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{FFFFFF} %s (%d) {00FF00}has joined the server!", pname, playerid);
		SendClientMessageToAll(COLOR_LIME, string);
	}
	else
	{
		format(string, sizeof(string), "{FFFFFF}Welcome, the account \"{FF0000}%s{FFFFFF}\" is not registered.\nIn order to play, you must register by typing a password below.", pname);
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FF0000}Registration", string, "Okay", "Quit");
		format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} \"{FFFFFF}%s{00FF00}\" (%d) has joined the server for the first time!", pname, playerid);
	}
    return 1;
}
Code:
	if(IsPlayerAdmin(playerid))
    {
        format(string, sizeof(string), "[RCON] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_RCON, string);
        return 0;
    }
    else if(PlayerInfo[playerid][AdminLevel] < 1)
    {
        format(string, sizeof(string), "%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_WHITE, string);
        return 0;
    }
    else if(PlayerInfo[playerid][AdminLevel] == 1)
    {
        format(string, sizeof(string), "[Moderator] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_YELLOW, string);
        return 0;
    }
    else if(PlayerInfo[playerid][AdminLevel] == 2)
    {
        format(string, sizeof(string), "[Administrator] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_ADMINISTRATOR, string);
        return 0;
    }
    else if(PlayerInfo[playerid][AdminLevel] == 3)
    {
        format(string, sizeof(string), "[Manager] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_MANAGER, string);
        return 0;
    }
    return 1;
}
__________________
Copyright 2016 vR Studios
Currently working with vR Studios
Copying and pasting doesn't allow you to learn the things that reading and understanding will.
Tass007 is offline   Reply With Quote
Old 31/03/2020, 08:43 PM   #10
mems
Big Clucker
 
Join Date: Oct 2019
Posts: 142
Reputation: 0
Default Re: messages related to joining/leaving/dm chating shows the admin ranks, but doesn't show the RCON one.

Quote:
Originally Posted by Tass007 View Post
When you say it doesn't do anything? Which bit? The OnPlayerConnect, won't work as someone already stated above, because you have to login as rcon after you've connected.

Code:
	if(PlayerInfo[playerid][AdminLevel] > 0)
	{
		if(IsPlayerAdmin(playerid))
		{
			admrank = "{FF0000}[RCON Admin]";
		}
		else
		{
			switch(PlayerInfo[playerid][AdminLevel])
			{
				case 1: admrank = "{FFFF00}[Moderator]";
				case 2: admrank = "{008000}[Administrator]";
				case 3: admrank = "{3366FF}[Manager]";
			}
		}
		format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} %s {FFFFFF}%s (%d) {00FF00}has joined the server!", admrank, pname, playerid);
		SendClientMessageToAll(COLOR_LIME, string);
	}
	else
	{
		format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{FFFFFF} %s (%d) {00FF00}has joined the server!", pname, playerid);
		SendClientMessageToAll(COLOR_LIME, string);
	}
	else
	{
		format(string, sizeof(string), "{FFFFFF}Welcome, the account \"{FF0000}%s{FFFFFF}\" is not registered.\nIn order to play, you must register by typing a password below.", pname);
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FF0000}Registration", string, "Okay", "Quit");
		format(string, sizeof(string), "{A9A9A9}[{00FF00}+{A9A9A9}]{00FF00} \"{FFFFFF}%s{00FF00}\" (%d) has joined the server for the first time!", pname, playerid);
	}
    return 1;
}
Code:
	if(IsPlayerAdmin(playerid))
    {
        format(string, sizeof(string), "[RCON] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_RCON, string);
        return 0;
    }
    else if(PlayerInfo[playerid][AdminLevel] < 1)
    {
        format(string, sizeof(string), "%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_WHITE, string);
        return 0;
    }
    else if(PlayerInfo[playerid][AdminLevel] == 1)
    {
        format(string, sizeof(string), "[Moderator] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_YELLOW, string);
        return 0;
    }
    else if(PlayerInfo[playerid][AdminLevel] == 2)
    {
        format(string, sizeof(string), "[Administrator] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_ADMINISTRATOR, string);
        return 0;
    }
    else if(PlayerInfo[playerid][AdminLevel] == 3)
    {
        format(string, sizeof(string), "[Manager] {FFFFFF}%s(%d): %s", pname, playerid, text);
        SendClientMessageToAll(COLOR_MANAGER, string);
        return 0;
    }
    return 1;
}
i'm sorry because this is getting a bit weird. when you have rcon access which means you're also RCON and then type /rcon gmx, isn't the OnPlayerConnect going to be triggered ? neither of these 3 work when i'm in game set RCON. the only one which works is the last one (default formatted messaging)
mems is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer messages doesn't show [REP] Youssef221 Scripting Help 1 26/12/2014 06:27 PM
Can't spawn, and it doesn't show my classes, it only shows CJ. Rabbayazza Scripting Help 18 15/08/2012 12:23 PM
Show messages for RCON Admins Gantzyo Help Archive 4 12/09/2010 10:44 AM
Joining/Leaving jesuschristlordandsavior Help Archive 7 06/02/2010 03:45 PM
Players that keep joining and leaving and joing and leaving...... hipy Server Support 2 26/12/2008 07:38 PM


All times are GMT. The time now is 05:54 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.