/makeclan (this drives me crazy)
#9

I've never used strtok but use sscanf, but i think i've realised a problem.

Here you have:

pawn Код:
if(strcmp(cmd, "/setclan", true) == 0)
Then a few lines later you have:
pawn Код:
new clanname, clantag;
            tmp = strtok(cmdtext, idx); /// "cmdtext" should be "cmd"
Shouldn't "cmdtext" should be "cmd" or vice versa?

So your whole command should look like this:

pawn Код:
if(strcmp(cmd, "/setclan", true) == 0)
    {
        if(AccountInfo[playerid][AdminLevel] >= 4)
        {
            new clanname, clantag;
            tmp = strtok(cmd, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
                return 1;
            }

            clanname = strval(tmp);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");

            tmp = strtok(cmd, idx);
            clantag = strval(tmp);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");

            format(string, sizeof(string), "clans/%s.ini", clanname);
            if(dini_Exists(string)) return SendClientMessage(playerid,COLOR_RED, "Clan exists already");
            if(!dini_Exists(string))
            {
                    dini_Create(string);
            }

            dini_Set(string, "clantag", clantag);
            format(string, sizeof(string), "Clan %s using clantag %s was successfully created", clanname, clantag);
            SendClientMessage(playerid, COLOR_GREEN, string);
            SendClientMessage(playerid, COLOR_GREEN, "Use /setclanmember [clan name] [player ID] to add a clanmember");
            return 1;
        }
        else return SendClientMessage(playerid,COLOR_RED, "You're not authorized to use that command");
    }
or ( i think the one above is the one you need)

pawn Код:
if(strcmp(cmdtext, "/setclan", true) == 0)
    {
        if(AccountInfo[playerid][AdminLevel] >= 4)
        {
            new clanname, clantag;
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
                return 1;
            }

            clanname = strval(tmp);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");

            tmp = strtok(cmdtext, idx);
            clantag = strval(tmp);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");

            format(string, sizeof(string), "clans/%s.ini", clanname);
            if(dini_Exists(string)) return SendClientMessage(playerid,COLOR_RED, "Clan exists already");
            if(!dini_Exists(string))
            {
                    dini_Create(string);
            }

            dini_Set(string, "clantag", clantag);
            format(string, sizeof(string), "Clan %s using clantag %s was successfully created", clanname, clantag);
            SendClientMessage(playerid, COLOR_GREEN, string);
            SendClientMessage(playerid, COLOR_GREEN, "Use /setclanmember [clan name] [player ID] to add a clanmember");
            return 1;
        }
        else return SendClientMessage(playerid,COLOR_RED, "You're not authorized to use that command");
    }
Reply


Messages In This Thread
/makeclan (this drives me crazy) - by [WS]Hyper - 06.11.2009, 18:06
Re: /makeclan (this drives me crazy) - by Redgie - 06.11.2009, 18:10
Re: /makeclan (this drives me crazy) - by [WS]Hyper - 06.11.2009, 18:16
Re: /makeclan (this drives me crazy) - by Benne - 06.11.2009, 18:38
Re: /makeclan (this drives me crazy) - by [WS]Hyper - 06.11.2009, 20:14
Re: /makeclan (this drives me crazy) - by miokie - 06.11.2009, 20:49
Re: /makeclan (this drives me crazy) - by [WS]Hyper - 06.11.2009, 20:59
Re: /makeclan (this drives me crazy) - by MadeMan - 06.11.2009, 21:06
Re: /makeclan (this drives me crazy) - by member - 06.11.2009, 21:09
Re: /makeclan (this drives me crazy) - by MadeMan - 06.11.2009, 21:12

Forum Jump:


Users browsing this thread: 1 Guest(s)