A missing bracket ?
#1

pawn Код:
else if(strcmp(x_nr,"lock",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc lock [channelnr]");
                    return 1;
                }
                new channel = strval(tmp);
                if(channel < 1 || channel > SCRIPT_MAXIRC) { SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !"); return 1; }
                channel -= 1;
                new wstring[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s", sendername);
                strmid(wstring, string, 0, strlen(string), 255);
                if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
                {
                    if(IRCInfo[channel][iLock] != 0)
                    {
                        IRCInfo[channel][iLock] = 0;
                        SendClientMessage(playerid, COLOR_YELLOW, "You've unlocked the IRC Channel.");
                    }
                    else
                    {
                        IRCInfo[channel][iLock] = 1;
                        SendClientMessage(playerid, COLOR_YELLOW, "You've locked the IRC Channel.");
                    }
                    SaveIRC();
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
                    return 1;
                }
            }
Tells me last bracket has no pair...any way to fix it ?
Reply
#2

Programmers notepad is saying that it's correct (brackets). Can you show me the bracket what is wrong in your eyes?
Reply
#3

Not sure if this will work but give it a try atleast mate?

pawn Код:
else if(strcmp(x_nr,"lock",true) == 0)
{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc lock [channelnr]");
        return 1;
    }
    new channel = strval(tmp);
    if(channel < 1 || channel > SCRIPT_MAXIRC) { SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !"); return 1; }
    channel -= 1;
    new wstring[128];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "%s", sendername);
    strmid(wstring, string, 0, strlen(string), 255);
    if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
    {
        if(IRCInfo[channel][iLock] != 0)
        {
            IRCInfo[channel][iLock] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You've unlocked the IRC Channel.");
        }
        else
        {
            IRCInfo[channel][iLock] = 1;
            SendClientMessage(playerid, COLOR_YELLOW, "You've locked the IRC Channel.");
        }
            SaveIRC();
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
            return 1;
        }
    }
    return 1;
}
Reply
#4

@PhoenixB,, Crashing when adding return 1;.
@ Kingunit , I have no idea.
EDIT:
When tring to compile, telling me that it cannot define loadshit of symbols that I defined.
Reply
#5

pawn Код:
else if(strcmp(x_nr,"lock",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc lock [channelnr]");
                    return 1;
                }
                new channel = strval(tmp);
                if(channel < 1 || channel > SCRIPT_MAXIRC) { SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !"); return 1; }
                channel -= 1;
                new wstring[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s", sendername);
                strmid(wstring, string, 0, strlen(string), 255);
                if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
                {
                    if(IRCInfo[channel][iLock] != 0)
                    {
                        IRCInfo[channel][iLock] = 0;
                        SendClientMessage(playerid, COLOR_YELLOW, "You've unlocked the IRC Channel.");
                    }
                    else
                    {
                        IRCInfo[channel][iLock] = 1;
                        SendClientMessage(playerid, COLOR_YELLOW, "You've locked the IRC Channel.");
                    }
                    SaveIRC();
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
                    return 1;
                }
            }
This should work
Reply
#6

Try this, not sure.
pawn Код:
else if(strcmp(x_nr,"lock",true) == 0)
{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc lock [channelnr]");
    }
    new channel = strval(tmp);
    if(channel < 1 || channel > SCRIPT_MAXIRC) SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !");
    channel -= 1;
    new wstring[128];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "%s", sendername);
    strmid(wstring, string, 0, strlen(string), 255);
    if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
    {
        if(IRCInfo[channel][iLock] != 0)
        {
            IRCInfo[channel][iLock] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You've unlocked the IRC Channel.");
        }
        else
        {
            IRCInfo[channel][iLock] = 1;
            SendClientMessage(playerid, COLOR_YELLOW, "You've locked the IRC Channel.");
        }
            SaveIRC();
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
        }
    }
    return 1;
}
Reply
#7

@King, similar to what I've told him to do : )
Reply
#8

@King You stole this from my post :P -.-
Reply
#9

Quote:
Originally Posted by PhoenixB
Посмотреть сообщение
@King, similar to what I've told him to do : )
Quote:
Originally Posted by BATAD
Посмотреть сообщение
@King You stole this from my post :P -.-
No I didn't watch good please.
Reply
#10

Okay, where is the code placed? Whats underit im presuming more as it is "else if" perhaps show us furthur more coding ?
Reply
#11

It's an /irc command.
http://pastebin.com/YveBekrZ
Reply
#12

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
No I didn't watch good please.
Then why the hell is it the same as mine ?-.-
Reply
#13

Don't fight and try to help me, thanks.
Reply
#14

pawn Код:
if(strcmp(cmd,"/irc",true)==0)
{
    if(IsPlayerConnected(playerid))
    {
        new x_nr[256];
        x_nr = strtok(cmdtext, idx);
        if(!strlen(x_nr))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/irc join [channelnr] or /irc join [channelnr] [password])  (/irc Leave)  (/irc Admins)");
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc [name] [channelnr]");
            SendClientMessage(playerid, COLOR_WHITE, "Available names: MOTD, Password, NeedPass, Lock, Kick, Status");
            return 1;
        }
        if(strcmp(x_nr,"join",true) == 0)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc join [channelnr] or /irc join [channelnr] [password]");
                return 1;
            }
            new channel = strval(tmp);
            if(channel < 1 || channel > SCRIPT_MAXIRC) { SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !"); return 1; }
            channel -= 1;
            if(IRCInfo[channel][iLock] == 0)
            {
                if(IRCInfo[channel][iNeedPass] == 0)
                {
                    JoinChannelNr(playerid, channel);
                }
                else
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "There's a password required to join this Channel.");
                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc join [channelnr] [password]");
                        return 1;
                    }
                        JoinChannel(playerid,channel,tmp);
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   That Channel is Locked, please choose a different one !");
                    return 1;
                }
            }
            else if(strcmp(x_nr,"status",true) == 0)
            {
                for(new i = 0; i < sizeof(IRCInfo); i++)
                {
                    format(string, sizeof(string), "Channel %d: %d Players Connected.",i + 1, IRCInfo[i][iPlayers]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                }
                return 1;
            }
            else if(strcmp(x_nr,"password",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc password [channelnr] [password]");
                    return 1;
                }
                new channel = strval(tmp);
                if(channel < 1 || channel > SCRIPT_MAXIRC) { SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !"); return 1; }
                channel -= 1;
                new wstring[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s", sendername);
                strmid(wstring, string, 0, strlen(string), 255);
                if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc password [channelnr] [password]");
                        return 1;
                    }
                    strmid(IRCInfo[channel][iPassword], tmp, 0, strlen(tmp), 255);
                    format(string, sizeof(string), "You've changed the IRC Channel's Password to: %s.",IRCInfo[channel][iPassword]);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    SaveIRC();
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
                    return 1;
                }
            }
            else if(strcmp(x_nr,"needpass",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc needpass [channelnr]");
                    return 1;
                }
                new channel = strval(tmp);
                if(channel < 1 || channel > SCRIPT_MAXIRC) { SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !"); return 1; }
                channel -= 1;
                new wstring[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s", sendername);
                strmid(wstring, string, 0, strlen(string), 255);
                if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
                {
                    if(IRCInfo[channel][iNeedPass] != 0)
                    {
                        IRCInfo[channel][iNeedPass] = 0;
                        SendClientMessage(playerid, COLOR_YELLOW, "Players won't have to fill in a password in order to join the IRC Channel now.");
                    }
                    else
                    {
                        IRCInfo[channel][iNeedPass] = 1;
                        SendClientMessage(playerid, COLOR_YELLOW, "Players must fill in a password in order to join the IRC Channel now.");
                    }
                    SaveIRC();
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
                    return 1;
                }
            }
            else if(strcmp(x_nr,"lock",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc lock [channelnr]");
                    return 1;
                }
                new channel = strval(tmp);
                if(channel < 1 || channel > SCRIPT_MAXIRC) { SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !"); return 1; }
                channel -= 1;
                new wstring[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s", sendername);
                strmid(wstring, string, 0, strlen(string), 255);
                if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
                {
                    if(IRCInfo[channel][iLock] != 0)
                    {
                        IRCInfo[channel][iLock] = 0;
                        SendClientMessage(playerid, COLOR_YELLOW, "You've unlocked the IRC Channel.");
                    }
                    else
                    {
                        IRCInfo[channel][iLock] = 1;
                        SendClientMessage(playerid, COLOR_YELLOW, "You've locked the IRC Channel.");
                    }
                    SaveIRC();
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
                    return 1;
                }
            }
            else if(strcmp(x_nr,"lock",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc lock [channelnr]");
                }
                new channel = strval(tmp);
                if(channel < 1 || channel > SCRIPT_MAXIRC) SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !");
                channel -= 1;
                new wstring[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s", sendername);
                strmid(wstring, string, 0, strlen(string), 255);
                if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
                {
                    if(IRCInfo[channel][iLock] != 0)
                    {
                        IRCInfo[channel][iLock] = 0;
                        SendClientMessage(playerid, COLOR_YELLOW, "You've unlocked the IRC Channel.");
                    }
                    else
                    {
                        IRCInfo[channel][iLock] = 1;
                        SendClientMessage(playerid, COLOR_YELLOW, "You've locked the IRC Channel.");
                        SaveIRC();
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
                        return 1;
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not the admin of that Channel !");
                return 1;
            }
            else if(strcmp(x_nr,"leave",true) == 0)
            {
                if(PlayersChannel[playerid] < 999)
                {
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "* %s has left the Channel.", sendername);
                    SendIRCMessage(PlayersChannel[playerid], COLOR_GREEN, string);
                    IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
                    PlayersChannel[playerid] = 999;
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not in an IRC Channel !");
                    return 1;
                }
            }
            else if(strcmp(x_nr,"admins",true) == 0)
            {
                for(new i = 0; i < sizeof(IRCInfo); i++)
                {
                    format(string, sizeof(string), "Channel %d: %s.", i + 1, IRCInfo[i][iAdmin]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                }
                return 1;
            }
            else if(strcmp(x_nr,"kick",true) == 0)
            {
                if(PlayersChannel[playerid] == 999)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not in an IRC Channel !");
                    return 1;
                }
                new wstring[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s", sendername);
                strmid(wstring, string, 0, strlen(string), 255);
                if(strcmp(IRCInfo[PlayersChannel[playerid]][iAdmin],wstring, true ) == 0 )
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc kick [playerid/PartOfName]");
                        return 1;
                    }
                    giveplayerid = ReturnUser(tmp);
                    if(IsPlayerConnected(giveplayerid))
                    {
                        if(giveplayerid != INVALID_PLAYER_ID)
                        {
                            if(PlayersChannel[giveplayerid] == PlayersChannel[playerid])
                            {
                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                format(string, sizeof(string), "* You've kicked %s out of your IRC Channel.",giveplayer);
                                SendClientMessage(playerid, COLOR_YELLOW, string);
                                format(string, sizeof(string), "* You've been kicked out of the IRC Channel by Channel Admin: %s.",sendername);
                                SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                                format(string, sizeof(string), "* %s has left the Channel (Kicked).", sendername);
                                SendIRCMessage(PlayersChannel[playerid], COLOR_GREEN, string);
                                IRCInfo[PlayersChannel[giveplayerid]][iPlayers] -= 1;
                                PlayersChannel[giveplayerid] = 999;
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GREY, "   That player is not in your IRC Channel !");
                                return 1;
                            }
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of the Channel !");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   Invalid IRC Channel Number ! ");
                return 1;
            }
        }
    }
    return 1;
}
There, give that a go, hopefully it will work
Reply
#15

pawn Код:
else if(strcmp(x_nr,"lock",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /irc lock [channelnr]");
                    return 1;
                }
                new channel = strval(tmp);
                if(channel < 1 || channel > SCRIPT_MAXIRC) { SendClientMessage(playerid, COLOR_GREY, "   Channel Number can't be below 1 or above the amount !"); return 1; }
                channel -= 1;
                new wstring[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "%s", sendername);
                strmid(wstring, string, 0, strlen(string), 255);
                if(strcmp(IRCInfo[channel][iAdmin],wstring, true ) == 0 )
                {
                    if(IRCInfo[channel][iLock] != 0)
                    {
                        if(IRCInfo[channel][iLock] = 0) return SendClientMessage(playerid, COLOR_YELLOW, "You've unlocked the IRC Channel.");
                    }
                    else
                    {
                        if (IRCInfo[channel][iLock] = 1) return SendClientMessage(playerid, COLOR_YELLOW, "You've locked the IRC Channel.");
                       
                    }
                    SaveIRC();
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not the Admin of that Channel !");
                    return 1;
                }
            }
Try it like this
Reply
#16

Quote:
Originally Posted by BATAD
Посмотреть сообщение
Then why the hell is it the same as mine ?-.-
Open your eyes and check what I did. I won't even discuss with you anymore if you are still sleeping.
Reply
#17

Guys, stop arguing now and help Darnell.. and Darnell try that entire code i posted, Hopefully will work
Reply
#18

Quote:
Originally Posted by PhoenixB
Посмотреть сообщение
Guys, stop arguing now and help Darnell.. and Darnell try that entire code i posted, Hopefully will work
I'm not arguing with him.. just Nvm what happened,

@Darnell Try mine, if it didn't work, Do what PhoenixB said, One of em should work
Reply
#19

It's a problem with my other code; If I still have problem, I'll edit.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)