Several Commands?
#1

Ok, I wanna add several commands, but Im confused,

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}
How would I make it like another commands under it so I can have multiple commands in a single game mode? Thanks!

Kinda like this? but the code below has an error?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	return 0;
}
Reply
#2

Like above, with a trialling } bracket. You missed a bracket out.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}
Reply
#3

You just needed to add one bracket, everything was fine, but change the 2nd "/mycommand".
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)//you must replace the "10" with the lenght of letters, including "/"
	{
		// Do something here
		return 1;
    }
	return 0;
}
Regards, Adil.
Reply
#4

Quote:
Originally Posted by Adil_Rahoo
You just needed to add one bracket, everything was fine, but change the 2nd "/mycommand".
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)//you must replace the "10" with the lenght of letters, including "/"
	{
		// Do something here
		return 1;
    }
	return 0;
}
Regards, Adil.
LOL, this is the second time you helped me. I appreciate it much! THANKS!
Reply
#5

Quote:
Originally Posted by DeltaAirlines12
LOL, this is the second time you helped me. I appreciate it much! THANKS!
Your welcome Delta, i come here to help SA-MP users, though its 3:15 AM here, lol.

Regards, Adil.
Reply
#6

Quote:
Originally Posted by Calgon
Like above, with a trialling } bracket. You missed a bracket out.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}
THANKS!
Reply
#7

Quote:
Originally Posted by Adil_Rahoo
Quote:
Originally Posted by DeltaAirlines12
LOL, this is the second time you helped me. I appreciate it much! THANKS!
Your welcome Delta, i come here to help SA-MP users, though its 3:15 AM here, lol.

Regards, Adil.
XD, its 4:17 P.M. where I am.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)