Zcmd / Strcmp - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Zcmd / Strcmp (
/showthread.php?tid=300585)
Zcmd / Strcmp -
Qur - 01.12.2011
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?
Re: Zcmd / Strcmp -
[C]ave[M]an - 01.12.2011
https://sampwiki.blast.hk/wiki/Fast_Commands
Re: Zcmd / Strcmp -
Qur - 01.12.2011
I'll read it, but what you people suggest?... for some reason I cant make myself use Zcmd ;/ dunno why
Re: Zcmd / Strcmp -
[C]ave[M]an - 01.12.2011
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
Re: Zcmd / Strcmp -
Qur - 01.12.2011
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?
Re: Zcmd / Strcmp -
Wesley221 - 01.12.2011
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" );
}
Re: Zcmd / Strcmp -
Qur - 01.12.2011
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
Re: Zcmd / Strcmp -
cessil - 01.12.2011
zcmd is faster to process not just to type and imo a lot neater looking