SA-MP Forums Archive
ZCMD + Strlen = bug? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ZCMD + Strlen = bug? (/showthread.php?tid=203664)



ZCMD + Strlen = bug? - DVDK - 27.12.2010

Hello, trying to make a cmd here but when i type /test it just skips the "USAGE: /test [param]" part, why?

pawn Код:
CMD:test(playerid, params[])
{
    if(!strlen(params))
        return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /test [param]");

    SendClientMessage(playerid, 0x123456FF, "This is a test message!");
    return 1;
}



Re: ZCMD + Strlen = bug? - Scenario - 27.12.2010

Why are you using "strlen"? Just do:

pawn Код:
CMD:test(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /test [param]");

    SendClientMessage(playerid, 0x123456FF, "This is a test message!");
    return 1;
}



Re: ZCMD + Strlen = bug? - FreshKilla - 27.12.2010

Use ******'s sscanf its more efficient and easy to use


Re: ZCMD + Strlen = bug? - DVDK - 27.12.2010

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Why are you using "strlen"? Just do:

pawn Код:
CMD:test(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /test [param]");

    SendClientMessage(playerid, 0x123456FF, "This is a test message!");
    return 1;
}
Thanks didn't know that function existed :P

Quote:
Originally Posted by FreshKilla
Посмотреть сообщение
Use ******'s sscanf its more efficient and easy to use
Nah, i don't want to use a plugin, just want a simple include.


Re: ZCMD + Strlen = bug? - Scenario - 27.12.2010

Quote:
Originally Posted by DVDK
Посмотреть сообщение
Nah, i don't want to use a plugin, just want a simple include.
Actually, sscanf has a stock function you could use, instead of the plugin. The sscanf include, actually consists of only two native functions. It's overall a better system, especially for coding commands in zcmd.