Zcmd / Strcmp
#1

Well, I started a whole new script.. and I cant decide which one to use.. I'm trying now to understand that Zcmd.. and its a bit complicated for me.. and Strcmp I find very easy..

Can you give me pros and cons of each? and why everyone suggest to use Zcmd?
Reply
#2

https://sampwiki.blast.hk/wiki/Fast_Commands
Reply
#3

I'll read it, but what you people suggest?... for some reason I cant make myself use Zcmd ;/ dunno why
Reply
#4

Most people suggest ZCMD , because it is easier?
pawn Код:
if( strcmp( cmdtext, "/test", true, 5 ) == 0 )
{
    new id;
    id = strval( cmdtext );
    return SendClientMessage( id, 0xAAAAAA, "Test" );
}
Basically , you just have to replace "cmdtext" to "params"
like :
pawn Код:
CMD:test( playerid, params[ ] /* Here are the params */ )
{
    new id;
    id = strval( params ); // So, cmdtext here turns into params.
    return SendClientMessage( id, 0xAAAAAA, "Test" );
}
thats how easy it is
Credits to https://sampforum.blast.hk/showthread.php?tid=231496
Reply
#5

I dont find it so hard to right the whole strcmp line, and for some reason commands I made before doesnt working for me with Zcmd..
but I read its faster commands.. what does it mean? that you script them faster? or they responde faster?
Reply
#6

With strcmp() you need to put it inside the callback OnPlayerCommandText.
ZCMD is a whole 'new callback'. It is faster and easier to use.
pawn Код:
public OnplayerCommandText(playerid, cmdtext[])
{
    if( strcmp( cmdtext, "/test", true, 5 ) == 0 )
    {
        new id;
        id = strval( cmdtext );
        return SendClientMessage( id, 0xAAAAAA, "Test" );
    }
    return 0;
}

CMD:test( playerid, params[ ] /* Here are the params */ )
{
    new id;
    id = strval( params ); // So, cmdtext here turns into params.
    return SendClientMessage( id, 0xAAAAAA, "Test" );
}
Reply
#7

Well both of you said same things, and same examples :P
Well I guess I'll just stick to what I like.. which is Strcmp.. I find it easier to use (dunno why) and I'm too used to it..
if the only pros that its to script faster so.. Its fine by me.. thanks
Reply
#8

zcmd is faster to process not just to type and imo a lot neater looking
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)