Difference in speed between zcmd and strcmp -
ADY26 - 27.11.2012
I know that zcmd is faster than strcmp but the thing is.. i want to make my commands in strcmp and not zcmd because it's easier for me...
Is it a considerable speed difference between those two ? Will be the player affected somehow or the server ? ( Not RP script so it's not gonna have a super amount of commands )
Thanks.
Re: Difference in speed between zcmd and strcmp -
[HK]Ryder[AN] - 27.11.2012
strcmp is really slow
the way strcmp works is that when you type a command it searches the script, if a match is found it executes the cmd.
zcmd calls a callback when command is typed..it is way faster.
see this graph (made by ******)
/imageshack/img195/43/fourcommands.png
Re: Difference in speed between zcmd and strcmp -
park4bmx - 27.11.2012
zcmd is good, but use sscanf two to make it even more easier.
i will show u and example
pawn Код:
COMMAND:sethp(playerid, params[])
{
if(sscanf(params,"ii",params[0],params[1])) return //return something if the player types it wrong
SetPlayerHealth(params[0],params[1]);
}
params[0] would be the
playerid
parmas[1] would be the
Amount of health
Re: Difference in speed between zcmd and strcmp -
ADY26 - 27.11.2012
Oh.. ok then
Thanks.
I guess i'm gonna use zcmd .
Re: Difference in speed between zcmd and strcmp -
[HK]Ryder[AN] - 27.11.2012
Quote:
Originally Posted by park4bmx
zcmd is good, but use sscanf two to make it even more easier.
i will show u and example
pawn Код:
COMMAND:sethp(playerid, params[]) { if(sscanf(params,"ii",params[0],params[1])) return //return something if the player types it wrong SetPlayerHealth(params[0],params[1]); }
params[0] would be the playerid
parmas[1] would be the Amount of health
|
he is asking bout the speed..
OT - if you have a huge gamemode with 100+ commands you will notice lagg if using strcmp..
using zcmd its instant
and strcmp is case sensitive AFAIK
Re: Difference in speed between zcmd and strcmp -
[HK]Ryder[AN] - 27.11.2012
Quote:
Originally Posted by ******
There is a case-insensitive parameter for strcmp.
|
:O..didnt know..you can remove this post
Re: Difference in speed between zcmd and strcmp -
park4bmx - 27.11.2012
he not only asked about the speed but he said
"i want to make my commands in strcmp and not zcmd because it's easier for me..."
so I was think of the long method of using the strcmp and showed the method of sscanf becouse what else would be hard about strcmp9well yes there are other things).