Two chat lines, how to avoid this ?
#1

Hey guys !

I have a little question about this :

pawn Код:
public newbie_sendMsg(color,const string[])
{
    for(new i = MIN_PLAYERID; i < MAX_PLAYERS_CURRENT+1; i++)
    {
        if(IsPlayerConnected(i))
        {
            if (pack_isAdmin(i,1) || PlayerVip[i][VipLevel] == 4 || PlayerInfo[i][pLevel] <= 18)
                {SendClientMessage(i, color, string);}
        }
    }
    return 1;
}

According to this, players with admin pack 1, vip level 4 and players with a level <=18 will receive the messages from the newbie chat.

The problem is that, if the player is an admin (pack 1 for example) and is under or equal level 18, he'll see 2 messages in the chatbox when he speak, but the others will see only one.
Example :

The admin name is XYZ, he'll see :
[19:38:22] [Admin] XYZ : Hi !
[19:38:22] [Admin] XYZ : Hi !

And the others people who have an access to this chat will see :
[19:38:22] [Admin] XYZ : Hi !

How may I avoid this ?

Thanks.
Reply
#2

pawn Код:
public newbie_sendMsg(color,const string[])
{
    for(new i = MIN_PLAYERID; i < MAX_PLAYERS_CURRENT+1; i++)
    {
        if(IsPlayerConnected(i))
        {
        if (pack_isAdmin(i,1) && PlayerVip[i][VipLevel] == 4 && PlayerInfo[i][pLevel] <= 18)
                return SendClientMessage(i, color, string);
                SendClientMessage(i, color, string);
        if (pack_isAdmin(i,1) && PlayerVip[i][VipLevel] == 4)
                return SendClientMessage(i, color, string);
        if (PlayerVip[i][VipLevel] == 4 && PlayerInfo[i][pLevel] <= 18)
                return SendClientMessage(i, color, string);
        if (pack_isAdmin(i,1) && PlayerInfo[i][pLevel] <= 18)
                return
            if (pack_isAdmin(i,1) || PlayerVip[i][VipLevel] == 4 || PlayerInfo[i][pLevel] <= 18)
                {SendClientMessage(i, color, string);}
        }
    }
    return 1;
}
Reply
#3

Show us how you use it
Reply
#4

@Dark_Rain : Thanks for trying, but it's even worse now o_o the person who'll talk will see 3 messages, and the others will see 2 messages from him.


@LarzI: I use it with this :
http://forum.sa-mp.com/showpost.php?...9&postcount=25
Reply
#5

Yeah okay, you use it "with that", but I want to see how, and where, you've put your function in the OP. I want to see how YOUR command is built up.
Reply
#6

I forgot i piece of code, try now
pawn Код:
public newbie_sendMsg(color,const string[])
{
    for(new i = MIN_PLAYERID; i < MAX_PLAYERS_CURRENT+1; i++)
    {
        if(IsPlayerConnected(i))
        {
        if (pack_isAdmin(i,1) && PlayerVip[i][VipLevel] == 4 && PlayerInfo[i][pLevel] <= 18)
                return SendClientMessage(i, color, string);
                SendClientMessage(i, color, string);
        else if (pack_isAdmin(i,1) && PlayerVip[i][VipLevel] == 4)
                return SendClientMessage(i, color, string);
       else if (PlayerVip[i][VipLevel] == 4 && PlayerInfo[i][pLevel] <= 18)
                return SendClientMessage(i, color, string);
        else if (pack_isAdmin(i,1) && PlayerInfo[i][pLevel] <= 18)
                return SendClientMessage(i, color, string);
            if (pack_isAdmin(i,1) || PlayerVip[i][VipLevel] == 4 || PlayerInfo[i][pLevel] <= 18)
                {SendClientMessage(i, color, string);}
        }
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Yeah okay, you use it "with that", but I want to see how, and where, you've put your function in the OP. I want to see how YOUR command is built up.
Actually the "With that" is my code, which I use for this public ^^
Reply
#8

Quote:
Originally Posted by Kethrios
Посмотреть сообщение
Actually the "With that" is my code, which I use for this public ^^
... *sigh* Okay let me try again: You have a function in the OP, called newbie_sendMsg. This function is not used in the code you linked me to, thus making the function unused. I want to see the command USING the newbie_sendMsg function.
Reply
#9

Oh ok :

pawn Код:
forward newbie_sendMsg(color,const string[]);
Reply
#10

I tried some things, still have the same result, I really don't know what is wrong.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)