ZCMD + Strlen = bug?
#1

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;
}
Reply
#2

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;
}
Reply
#3

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

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.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)