Newbie channel problem.
#1

Hello everyone !

I have a little problem by creating a newbie channel for admins/vip (lvl 4)/ and obviously, newbie (age under 1.
So I have this :


pawn Код:
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
    {
        //if(PlayerVip[playerid][VipLevel] != 4)
        if(PlayerVip[playerid][VipLevel] != 4 && PlayerInfo[playerid][pLevel] > 18 && PlayerInfo[playerid][pAdmin] != 1 && PlayerInfo[playerid][pAdmin] != 2 && PlayerInfo[playerid][pAdmin] != 3 && PlayerInfo[playerid][pAdmin] != 4)
            {SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] You can't access this chat.");return 1;}
                    //{SendClientMessage(playerid, COLOR_SERVER, noAcces); return 1;}
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMuted] == 1)
            {
                SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] You are muted and can't speak.");
                return 1;
            }
            if(nonewbie == 1)
            {
                SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] This channel was desactivated by an admin.");
                return 1;
            }
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_USAGE, "{FF6600}[Action]{99EEFF} (/n)ewbie <Texte>");
                return 1;
            }
                //new paral;
            new sendername[MAX_PLAYER_NAME];
            if(PlayerInfo[playerid][pLevel] < 18) format(string, sizeof(string), "[NewbieChat] Newbie %s: %s", sendername, result);
            else if(PlayerVip[playerid][VipLevel] == 4) format(string, sizeof(string), "[NewbieChat] Helper %s: %s", sendername, result);
            else if(PlayerInfo[playerid][pAdmin] == 1) format(string, sizeof(string), "[NewbieChat] Moderator lv1 %s: %s", sendername, result);
            else if(PlayerInfo[playerid][pAdmin] == 2) format(string, sizeof(string), "[NewbieChat] Moderator lv2 %s: %s", sendername, result);
            else if(PlayerInfo[playerid][pAdmin] == 3) format(string, sizeof(string), "[NewbieChat] Administrator %s: %s", sendername, result);
            else if(PlayerInfo[playerid][pAdmin] == 4) format(string, sizeof(string), "[NewbieChat] Fondator %s: %s", sendername, result);
                //else format(string, sizeof(string), "[NewbieChat] Newbie %s: %s", sendername, result);

            //{
            //  SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] You're 18 years old or more, you can't access this chat anymore.");
            //  return 1;
            //}
            //SendClientMessageToAll(COLOR_BLUE, string);
            printf("[NewbieChat] %s : %s", playername,result);
            }
        return 1;
    }


But it's not working, when I do /n, it say that I can't access this chat.
What is wrong here ?

Thank you.
Reply
#2

What's your admin and VIP level?
Reply
#3

VIP lvl 3, and Admin level 4.
Vip lvl 4 is a Helper level, they can pm players etc...
Reply
#4

Strcmp? Ugh, I suggest using ZCMD
Also.. You have formatted strings but not supplied any action?
I have cleaned up the code a bit, this should work now, haven't used strcmp for years though so mail me if this doesn't work and no one gets back to you because I am popping into town for a couple hours.

pawn Код:
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
    //if(PlayerVip[playerid][VipLevel] != 4)
        if(PlayerVip[playerid][VipLevel] < 4)
        {
            if(PlayerInfo[playerid][pLevel] > 18)
            {
                if(PlayerInfo[playerid][pAdmin] < 1)
                {
                    SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] You can't access this chat.");
                    return 1;
                }
            }
        }                 //{SendClientMessage(playerid, COLOR_SERVER, noAcces); return 1;}
        if(PlayerInfo[playerid][pMuted] == 1)
        {
            SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] You are muted and can't speak.");
            return 1;
        }
        if(nonewbie == 1)
        {
            SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] This channel was desactivated by an admin.");
            return 1;
        }
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
              result[idx - offset] = cmdtext[idx];
            idx++;
        }
              result[idx - offset] = EOS;
        if(!strlen(result))
        {
            SendClientMessage(playerid, COLOR_USAGE, "{FF6600}[Action]{99EEFF} (/n)ewbie <Texte>");
            return 1;
        }
        //new paral;
        new sendername[MAX_PLAYER_NAME];
        if(PlayerInfo[playerid][pLevel] < 18)
        {
            format(string, sizeof(string), "[NewbieChat] Newbie %s: %s", sendername, result);
            SendClientMessage(playerid, COLOR_NEWBIE, string);
            return 1;
        }
        else if(PlayerVip[playerid][VipLevel] == 4)
        {
            format(string, sizeof(string), "[NewbieChat] Helper %s: %s", sendername, result);
            SendClientMessage(playerid, COLOR_NEWBIE, string);
            return 1;
        }
        else if(PlayerInfo[playerid][pAdmin] == 1)
        {
            format(string, sizeof(string), "[NewbieChat] Moderator lv1 %s: %s", sendername, result);
            SendClientMessage(playerid, COLOR_NEWBIE, string);
            return 1;
        }
        else if(PlayerInfo[playerid][pAdmin] == 2)
        {
            format(string, sizeof(string), "[NewbieChat] Moderator lv2 %s: %s", sendername, result);
            SendClientMessage(playerid, COLOR_NEWBIE, string);
            return 1;
        }
        else if(PlayerInfo[playerid][pAdmin] == 3)
        {
            format(string, sizeof(string), "[NewbieChat] Administrator %s: %s", sendername, result);
            SendClientMessage(playerid, COLOR_NEWBIE, string);
            return 1;
        }
        else if(PlayerInfo[playerid][pAdmin] == 4)
        {
            format(string, sizeof(string), "[NewbieChat] Fondator %s: %s", sendername, result);
            SendClientMessage(playerid, COLOR_NEWBIE, string);
            return 1;
        }
        printf("[NewbieChat] %s : %s", playername,result);
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "Error: Please login before using this command.");
        return 1;
    }
    return 1;
}
Reply
#5

pawn Код:
if(PlayerVip[playerid][VipLevel] != 4)
This means if VIP doesn't equal to 4 you cannot use the channel. I have used

pawn Код:
if(PlayerVip[playerid][VipLevel] < 4)
Which is the same thing, I hate != for some reason.

Make your VIP level 4 to use the chat. If that's not how you want it edit the VipLevel
Reply
#6

Actually I tried your code, here is what I noticed :
When I'm lvl4 vip (with lvl 4 admin, always), I can /n , and I have [Newbie] Helper, but when I got lvl3 vip, I can't /n, I don't have any errors, I just can't.
Reply
#7

Crap, I done a bit of it wrong, im on mobile now and can only see the top part of the code I posted, can you post the parts where theres format string please, sorry
Reply
#8

Here you go, I don't use [PAWN] because you'll have to scroll


if(PlayerInfo[playerid][pLevel] < 1
{
format(string, sizeof(string), "[NewbieChat] Newbie %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerVip[playerid][VipLevel] == 4)
{
format(string, sizeof(string), "[NewbieChat] Helper %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] == 1)
{
format(string, sizeof(string), "[NewbieChat] Moderator lv1 %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] == 2)
{
format(string, sizeof(string), "[NewbieChat] Moderator lv2 %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] == 3)
{
format(string, sizeof(string), "[NewbieChat] Administrator %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] == 4)
{
format(string, sizeof(string), "[NewbieChat] Fondator %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
Reply
#9

Gimme a while to do it cause mobile sucks with code editing
Reply
#10

Damn I can't copy and paste with this Phone If no one has answered by the time I'm home ill fix it sorry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)