[ Help ] Spaces in Commands
#1

Hello! I am making a small, one command, test server and I would like to know how to create a space in a command. I use ZCMD to make my commands. However, I tried to input an option but whenever I do /starttest trucker, it loads the command for first option on the list. I didn't feel like coding the command yet, as it is a really long one. So I just made sure that my options work.

Код:
CMD:starttest(playerid, params[])
{
    new option[20];
    if(isnull(params))
    {
                return SendClientMessage(playerid, -1, "USAGE: /starttest [standard/trucker]");
    }
    if(!strcmp(option, "standard", true))
    {
		SendClientMessage(playerid, COLOR_WHITE, "Yes, standard works.");
                return 1;
    }
    if(!strcmp(option, "trucker", true))
    {
		SendClientMessage(playerid, COLOR_WHITE, "Yes, trucker works.");
                return 1;
    }
    return 1;
}
Whenever I type in anything, it will give me the first option's return.

/starttest askghasdofhds = "Yes, standard works."
/starttest trucker = "Yes, standard works."

This shouldn't happen. I would like to know, how to fix this.
Reply
#2

no need for "option" just replace em' with params and it should work fine
Reply
#3

Quote:
Originally Posted by kirollos
Посмотреть сообщение
no need for "option" just replace em' with params and it should work fine
Could you give an example? ( I am noob at scripting )
Reply
#4

pawn Код:
CMD:starttest(playerid, params[])
{
    if(isnull(params))
    {
                return SendClientMessage(playerid, -1, "USAGE: /starttest [standard/trucker]");
    }
    if(!strcmp(params, "standard", true))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Yes, standard works.");
                return 1;
    }
    if(!strcmp(params, "trucker", true))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Yes, trucker works.");
                return 1;
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by kirollos
Посмотреть сообщение
pawn Код:
CMD:starttest(playerid, params[])
{
    if(isnull(params))
    {
                return SendClientMessage(playerid, -1, "USAGE: /starttest [standard/trucker]");
    }
    if(!strcmp(params, "standard", true))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Yes, standard works.");
                return 1;
    }
    if(!strcmp(params, "trucker", true))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Yes, trucker works.");
                return 1;
    }
    return 1;
}
It worked! Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)