Need some tips on how to convert my commands to YCMD
#1

At the moment, all my commands are STRCMP or whatever it's called. I'm really want to convert them, because I have LOADS of commands, and well, you could say you notice that they process slow.

The thing is, I've never worked with YCMD or ZCMD before. I was thinking of converting to YCMD, searched a bit around, but couldn't find any decent tutorials, so I figured I should ask here for some help. If someone could just give me an example?

pawn Код:
if(strcmp(cmd, "/askq", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_INFO, "* Usage: /askq [text]");
                return 1;
            }
            format(string, sizeof(string), "Question from %s: %s", sendername, (result));
            ABroadCast(COLOR_ASKQ, string, 1);
            SendClientMessage(playerid, COLOR_ASKQ, "Your Question Message was sent to the Admins.");
        }
        return 1;
    }
This was the command which was at the top, so if you could please use this as an example. And please explain what you are doing, because I really want to learn how to do this myself, but if you do it for me, I'll never learn it.

Thanks in advance for all answers
Reply
#2

No help to get here I guess...
Reply
#3

Read this, maybe you'll understand : link
Reply
#4

I read a little bit, but really can't understand it. Especially that sccanf thing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)