SA-MP Forums Archive
Several Commands? - 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: Several Commands? (/showthread.php?tid=97812)



Several Commands? - DeltaAirlines12 - 16.09.2009

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;
}



Re: Several Commands? - Calgon - 16.09.2009

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;
}



Re: Several Commands? - Adil - 16.09.2009

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.


Re: Several Commands? - DeltaAirlines12 - 16.09.2009

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!


Re: Several Commands? - Adil - 16.09.2009

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.


Re: Several Commands? - DeltaAirlines12 - 16.09.2009

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!


Re: Several Commands? - DeltaAirlines12 - 16.09.2009

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.