Need help with my /b command. ** +REP **
#1

Well, I want it so that when admins /b it is a different colour, look.

pawn Код:
COMMAND:b(playerid,params[])
{

    if(character_chosen[playerid])
    {
        new result[256];
        FetchParamText(result,params,0);
        if(!strlen(result)) { SendClientMessageA(playerid,COLOR_LIGHTRED,"USAGE: /b [Local OOC]"); return 1; }
        new str[256];
        new name[MAX_PLAYER_NAME];
        if (AccountInfo[playerid][aAdmin] < ADMIN_LVL_TRAIN){
        GetCharacterName(playerid,name);
        format(str,sizeof(str),"(([Local OOC] {00CED1}%s (%d): %s ))",name,playerid,result);
        SendLocalOOCMessage(playerid,str);
        }
        GetCharacterName(playerid,name);
        format(str,sizeof(str),"(([Local OOC] %s (%d): %s ))",name,playerid,result);
        SendLocalOOCMessage(playerid,str);
        return 1;

    }
    else
    {

        SendErrorMsg(playerid,"Please choose a character first.");
        return 1;

    }

}
It's not working - any idea?
Reply
#2

if you want a random color to be chosen, use -1 at SendClientMessage.
Reply
#3

Quote:
Originally Posted by Smileys
Посмотреть сообщение
if you want a random color to be chosen, use -1 at SendClientMessage.
I want one colour to highlight when an admin speaks in /b.
Reply
#4

Explain more, i don't understand what you are trying to do here.
Reply
#5

I think you are fine with this:
pawn Код:
COMMAND:b(playerid,params[])
{

    if(character_chosen[playerid])
    {
        new result[256];
        FetchParamText(result,params,0);
        if(!strlen(result)) { SendClientMessageA(playerid,COLOR_LIGHTRED,"USAGE: /b [Local OOC]"); return 1; }
        new str[256];
        new name[MAX_PLAYER_NAME];
        if (AccountInfo[playerid][aAdmin] < ADMIN_LVL_TRAIN){
        GetCharacterName(playerid,name);
        format(str,sizeof(str),"{FF0000}(([Local OOC] {00CED1}%s (%d): %s ))",name,playerid,result);
        SendLocalOOCMessage(playerid,str);
        return 1; // with this, you won't send 2 messages
        }
        GetCharacterName(playerid,name);
        format(str,sizeof(str),"(([Local OOC] %s (%d): %s ))",name,playerid,result);
        SendLocalOOCMessage(playerid,str);
        return 1;

    }
    else
    {

        SendErrorMsg(playerid,"Please choose a character first.");
        return 1;

    }

}
Reply
#6

So, in /b for a usual player it just says it normally.
But, if an admin types /b their name appears a different colour, so like..

(([Local OOC]Jing Chan: Hi))
^ That's a usual player.
(([Local OOC]Jing Chan: Hi))
^ That's an admin.
Reply
#7

pawn Код:
COMMAND:b(playerid, params[])
    {
        if(character_chosen[playerid])
        {
            new result[256];
           
            FetchParamText(result,params,0);
           
            if(!strlen(result)) { SendClientMessageA(playerid,COLOR_LIGHTRED,"USAGE: /b [Message]"); return 1; }
           
            new str[256];
            new name[MAX_PLAYER_NAME];
           
            if(AccountInfo[playerid][aAdmin] < ADMIN_LVL_TRAIN)
            {
                GetCharacterName(playerid, name);
                format(str, sizeof(str), "{FF0000}(( [L-OOC] %s (%d): %s", name, playerid, result);
                SendLocalOOCMessage(playerid, str);
                return 1;
            }
            else
            {
                format(str, sizeof(str), "{FF0000}(( [L-OOC] {00CED1}%s{FF0000} (%d):%s", name, playerid, result);
                return 1;
            }
        }
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "Please choose a character before using this command.");
        return 1;
    }
Edited it (put if(character_chosen[playerid]) in there.
Reply
#8

Quote:
Originally Posted by sammp
Посмотреть сообщение
pawn Код:
COMMAND:b(playerid, params[])
    {
        if(character_chosen[playerid])
        {
            new result[256];
           
            FetchParamText(result,params,0);
           
            if(!strlen(result)) { SendClientMessageA(playerid,COLOR_LIGHTRED,"USAGE: /b [Message]"); return 1; }
           
            new str[256];
            new name[MAX_PLAYER_NAME];
           
            if(AccountInfo[playerid][aAdmin] < ADMIN_LVL_TRAIN)
            {
                GetCharacterName(playerid, name);
                format(str, sizeof(str), "{FF0000}(( [L-OOC] %s (%d): %s", name, playerid, result);
                SendLocalOOCMessage(playerid, str);
                return 1;
            }
            else
            {
                format(str, sizeof(str), "{FF0000}(( [L-OOC] {00CED1}%s{FF0000} (%d):%s", name, playerid, result);
                return 1;
            }
        }
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "Please choose a character before using this command.");
        return 1;
    }
Edited it (put if(character_chosen[playerid]) in there.
/b doesn't work at all now
Reply
#9

SendLocalOOCMessage(playerid, str);

put that inside the else statement under the format
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)