Strcmp or ZCMD? -
Giroud12 - 12.05.2013
While everyone saying ZCMD is better than Strcmp?
I think Strcmp is easy to use for newbie likes me....
What do you all think?
Re: Strcmp or ZCMD? -
Windrush - 12.05.2013
zcmd
Re: Strcmp or ZCMD? -
Giroud12 - 12.05.2013
Because?
Re: Strcmp or ZCMD? -
SchurmanCQC - 12.05.2013
ZCMD is a lot simpler than STRCMP. You just have to put in some effort to learn it.
Re: Strcmp or ZCMD? - Riddy - 12.05.2013
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.
Re: Strcmp or ZCMD? -
playbox12 - 12.05.2013
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.
Re: Strcmp or ZCMD? -
Giroud12 - 12.05.2013
DELETED
Re: Strcmp or ZCMD? -
FUNExtreme - 12.05.2013
Quote:
Originally Posted by Giroud12
|
This is not the scripting help section.
Re: Strcmp or ZCMD? -
Giroud12 - 12.05.2013
Sorry my mistakes
Re: Strcmp or ZCMD? -
MP2 - 12.05.2013
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.)