Making a command seperate
#1

How do i make a command like this:

[/command 1] in zcmd if i make it separate i get errors

Errors:

[/command 1]

No Errors:

[/command1]

How do i make it seperate?
Reply
#2

Quote:
Originally Posted by Immortal99
Посмотреть сообщение
How do i make a command like this:

[/command 1] in zcmd if i make it separate i get errors

Errors:

[/command 1]

No Errors:

[/command1]

How do i make it seperate?
Hello, You cant do it like this, but i think you are trying to make something like this:
Код:
CMD:gotobusiness(playerid, params[])
{
        new idx;
	if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotobiz [bizid]");
        //your action here
	return 1;
}
describe more if it didn`t helped you..
Reply
#3

Quote:
Originally Posted by burhanjaved
Посмотреть сообщение
Hello, You cant do it like this, but i think you are trying to make something like this:
Код:
CMD:gotobusiness(playerid, params[])
{
        new idx;
	if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotobiz [bizid]");
        //your action here
	return 1;
}
describe more if it didn`t helped you..
You wrong!

I am asking how do i make a command like

CMD:command 1(playerid, params[])
{
SendClientMessage(playerid, COLOR_WHITE, "Server Commands");
return 1;
}

When i do compile it i get errors cause i cant make CMD:command 1 Seperate the 1 so it should be CMD:command1
Reply
#4

Quote:
Originally Posted by Immortal99
Посмотреть сообщение
You wrong!

I am asking how do i make a command like

CMD:command 1(playerid, params[])
{
SendClientMessage(playerid, COLOR_WHITE, "Server Commands");
return 1;
}

When i do compile it i get errors cause i cant make CMD:command 1 Seperate the 1 so it should be CMD:command1
You wrong...

PHP код:
CMD:command(playeridparams[])
{
        new 
idx;
    if(
sscanf(params"i"idx)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /comand number");
        switch(
idx)
        {
             case 
1:
             {
                 
//Have wrote /command 1
             
}
             
//ect....
        
}
    return 
1;

Reply
#5

You can't with ZCMD, you'll have to edit it, but that's not really needed. You could do:

pawn Код:
#include <sscanf2>

CMD:command(playerid, params[])
{
    if(IsNumeric(params) && strval(params) == 1)
    {
        // Code here
        return 1;
    }
    return 0;
}

stock IsNumeric(const string[])
{
    return !sscanf(string, "{d}");
}
If you enter /command 2, /command or anything else that isn't /command 1, you'll get the unknown command message. So it's practically like having a command with a space.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)