Chat Name Color Help?
#1

Hey there, so I currently am using Vortex Roleplay V1 Gamemode and by default the /N(ewbie) chat is setup to have the one color along the whole line. However i want the name of the character to be a different color just in /N(ewbie) chat. Here's the default command:
pawn Код:
command(newbie, playerid, params[])
{
    new
        string[128];

    if(isnull(params))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /n(ewbie) [message]");
    }
    else
    {
        if(NewbieEnabled == 1)
        {
            if(Player[playerid][CanUseNewbie] == 1 && Player[playerid][Authenticated] >= 1)
            {
                if(Player[playerid][nMuted] >= 1)
                {
                    SendClientMessage(playerid, WHITE, "You have been muted from this channel by an admin.");
                }
                else
                {
                    if(Player[playerid][AdminDuty] == 0)
                    {
                        if(Player[playerid][VipRank] >= 1)
                        {
                            format(string, sizeof(string), "[N] VIP %s: %s", GetName(playerid), params);
                            SendClientMessageToAll(NEWBIE_CHAT, string);
                            OOCChatLog(string);
                        }
                        else
                        {
                            if(Player[playerid][PlayingHours] < 1)
                            {
                                format(string, sizeof(string), "[N] %s %s: %s", OOCRanks[Rank1], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            else if(Player[playerid][PlayingHours] >= 1 && Player[playerid][PlayingHours] < 25)
                            {
                                format(string, sizeof(string), "N] %s %s: %s", OOCRanks[Rank2], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            else if(Player[playerid][PlayingHours] >= 25 && Player[playerid][PlayingHours] < 100)
                            {
                                format(string, sizeof(string), "[N] %s %s: %s", OOCRanks[Rank3], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            else if(Player[playerid][PlayingHours] >= 100 && Player[playerid][PlayingHours] < 300)
                            {
                                format(string, sizeof(string), "[N] %s %s: %s", OOCRanks[Rank4], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            else if(Player[playerid][PlayingHours] >= 300)
                            {
                                format(string, sizeof(string), "[N] %s %s: %s", OOCRanks[Rank5], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            OOCChatLog(string);
                        }
                    }
                    else
                    {
                        format(string, sizeof(string), "[N] Admin %s: %s", Player[playerid][AdminName], params);
                        SendClientMessageToAll(NEWBIE_CHAT, string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Please wait 30 seconds before submitting another message.");
            }
        }
        else
        {
            SendClientMessage(playerid, WHITE, "Newbie Chat is currently unavailable.");
        }
    }
    return 1;
}
The color I want to change the name to is: #00efad
If somebody is able to help me do that, it'd be greatly appreciated, as I'm a beginner at this stuff, thanks a bunch in advance!
Reply
#2

here you go

pawn Код:
#define chatColor   "{00efad}" // just define this

command(newbie, playerid, params[])
{
    new
        string[128];

    if(isnull(params))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /n(ewbie) [message]");
    }
    else
    {
        if(NewbieEnabled == 1)
        {
            if(Player[playerid][CanUseNewbie] == 1 && Player[playerid][Authenticated] >= 1)
            {
                if(Player[playerid][nMuted] >= 1)
                {
                    SendClientMessage(playerid, WHITE, "You have been muted from this channel by an admin.");
                }
                else
                {
                    if(Player[playerid][AdminDuty] == 0)
                    {
                        if(Player[playerid][VipRank] >= 1)
                        {
                            format(string, sizeof(string), "[N] VIP %s: "chatColor"%s", GetName(playerid), params);
                            SendClientMessageToAll(NEWBIE_CHAT, string);
                            OOCChatLog(string);
                        }
                        else
                        {
                            if(Player[playerid][PlayingHours] < 1)
                            {
                                format(string, sizeof(string), "[N] %s %s:"chatColor" %s", OOCRanks[Rank1], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            else if(Player[playerid][PlayingHours] >= 1 && Player[playerid][PlayingHours] < 25)
                            {
                                format(string, sizeof(string), "N] %s %s: "chatColor"%s", OOCRanks[Rank2], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            else if(Player[playerid][PlayingHours] >= 25 && Player[playerid][PlayingHours] < 100)
                            {
                                format(string, sizeof(string), "[N] %s %s:"chatColor" %s", OOCRanks[Rank3], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            else if(Player[playerid][PlayingHours] >= 100 && Player[playerid][PlayingHours] < 300)
                            {
                                format(string, sizeof(string), "[N] %s %s:"chatColor" %s", OOCRanks[Rank4], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            else if(Player[playerid][PlayingHours] >= 300)
                            {
                                format(string, sizeof(string), "[N] %s %s:"chatColor" %s", OOCRanks[Rank5], GetName(playerid), params);
                                SendClientMessageToAll(NEWBIE_CHAT, string);
                                Player[playerid][CanUseNewbie] = 0;
                                SetTimerEx("RefreshNewbieChatForPlayer", 30000, false, "d", playerid);
                            }
                            OOCChatLog(string);
                        }
                    }
                    else
                    {
                        format(string, sizeof(string), "[N] Admin %s: "chatColor"%s", Player[playerid][AdminName], params);
                        SendClientMessageToAll(NEWBIE_CHAT, string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Please wait 30 seconds before submitting another message.");
            }
        }
        else
        {
            SendClientMessage(playerid, WHITE, "Newbie Chat is currently unavailable.");
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Namer
Посмотреть сообщение
here you go
Thanks man, really helped me out.
+1
Reply
#4

Quote:
Originally Posted by Namer
Посмотреть сообщение
here you go
Hey, so I was wondering how to do the same thing but for (/b) chat.
So administrator name would be orange and then the text would be grey.
Normal players the whole line would be grey.

Here's the (/b) command:
pawn Код:
//Orange For Admin Name - F6970C
//if(Player[playerid][AdminLevel] >= 1)

command(b, playerid, params[])
{
    new Message[128], string[128];
    if(sscanf(params, "z", Message))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /b [message]");
    }
    else
    {
        if(strlen(Message) < 1 || !IsPlayerConnectedEx(playerid))
        {
            return 1;
        }
        else
        {
            if(Player[playerid][PrisonID] == 1)
            {
                SendClientMessage(playerid, WHITE, "You may not use this channel right now.");
            }
            else
            {
                format(string, sizeof(string), "%s: ((%s)) ", GetName(playerid), Message);
                NearByMessage(playerid, WHITE, string);
            }
        }
    }
    return 1;
}
Reply
#5

And your variable name for being an admin is what?
Reply
#6

Quote:
Originally Posted by Turn
Посмотреть сообщение
And your variable name for being an admin is what?
Yeah I put it in there in the pawn code at the top, maybe you missed it.
Sorry about that, the variable for being an admin is:
pawn Код:
if(Player[playerid][AdminLevel] >= 1)
Reply
#7

here you go again

pawn Код:
//Orange For Admin Name - F6970C ( done )
//so now this is a admin command

#define adminOrange     "{F6970C}"
#define chatGrey        "{00efad}"
command(b, playerid, params[])
{
    new Message[128], string[128];
    if(Player[playerid][AdminLevel] >= 1)
    {
        if(sscanf(params, "z", Message))
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /b [message]");
        }
        else
        {
            if(strlen(Message) < 1 || !IsPlayerConnectedEx(playerid))
            {
                return 1;
            }
            else
            {
                if(Player[playerid][PrisonID] == 1)
                {
                    SendClientMessage(playerid, WHITE, "You may not use this channel right now.");
                }
                else
                {
                    format(string, sizeof(string), ""adminOrange"%s: "chatColor"((%s)) ", GetName(playerid), Message);
                    NearByMessage(playerid, WHITE, string);
                }
            }
        }
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by Namer
Посмотреть сообщение
here you go again
Wow, thanks a ton dude. Greatly appreciate the help!
EDIT: Wait, does this mean the command is for admin only?
What I want is for it to be used for both admin and all other users, however with just administrator names to be orange in the (/b) chat.
Reply
#9

try this one now it will work ! if player is admin then it will send msg like " Admin Kalkor: hey" and if player is not admin then " Kalkor: hey"

pawn Код:
command(b, playerid, params[])
{
    new Message[128], string[128];
    if(Player[playerid][AdminLevel] >= 1)
    {
        if(sscanf(params, "z", Message))
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /b [message]");
        }
        else
        {
            if(strlen(Message) < 1 || !IsPlayerConnectedEx(playerid))
            {
                return 1;
            }
            else
            {
                if(Player[playerid][PrisonID] == 1)
                {
                    SendClientMessage(playerid, WHITE, "You may not use this channel right now.");
                }
                else
                {
                    format(string, sizeof(string), ""adminOrange"%s: "chatColor"((%s)) ", GetName(playerid), Message);
                    NearByMessage(playerid, WHITE, string);
                }
            }
        }
    }
    else
    {
        if(strlen(Message) < 1 || !IsPlayerConnectedEx(playerid))
        {
            return 1;
        }
        else
        {
            if(Player[playerid][PrisonID] == 1)
            {
                SendClientMessage(playerid, WHITE, "You may not use this channel right now.");
            }
            else
            {
                format(string, sizeof(string), "%s: "chatColor"((%s)) ", GetName(playerid), Message);
                NearByMessage(playerid, WHITE, string);
            }
        }
    }
    return 1;
}
Reply
#10

nvm, delete this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)