Strcmp or ZCMD?
#1

While everyone saying ZCMD is better than Strcmp?
I think Strcmp is easy to use for newbie likes me....
What do you all think?
Reply
#2

zcmd
Reply
#3

Because?
Reply
#4

ZCMD is a lot simpler than STRCMP. You just have to put in some effort to learn it.
Reply
#5

Actually, strcmp can be used for several different things, so I wouldn't really compare the function, but when it comes to commands, ZCMD is much for efficient and 10x for easier to type in.
Reply
#6

Strcmp is simply comparing two strings to eachother. In most other programming languages something like that would be

Код:
if("string1" == "string1")
{
    //do something
}
In pawn however this is not possible. Here you work with strcmp, what strcmp does it basically compare every character at X position to another character at X position from the other string. This process by itself is very slow.

ZCMD and most other command processors basically make the command a callback and use CallLocalFunction to call the command when someone types it in. This process by itself is much more effecient as it doesn't have to compare the characters, rather just calls the command directly.

That's why you should use ZCMD for commands and strcmp for other forms of string comparison.
Reply
#7

DELETED
Reply
#8

Quote:
Originally Posted by Giroud12
Посмотреть сообщение
Can anyone here try this script and please inform me what is their bug : http://pastebin.com/JGgBUwj7
This is not the scripting help section.
Reply
#9

Sorry my mistakes
Reply
#10

How is

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/command", true))
    {
        // Code
        return 1;
    }
    else if(!strcmp(cmdtext, "/test", true))
    {
        // Code
        return 1;
    }
    return 0;
}
easier than

pawn Код:
CMD:command(playerid, params[])
{
    // Code
    return 1;
}

CMD:test(playerid, params[])
{
    // Code
    return 1;
}
?

And then you have params to deal with. It's also slower. So let's summarise:

STRCMP:
- Slow
- Worse parameter handling
- More 'complicated' to write (relative)

ZCMD:
- Much faster
- Easy parameter handling
- Extremely easy to write

You decide which is better. It's a tough one! (not.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)