SA-MP Forums Archive
Can't add mutiple 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: Can't add mutiple commands (/showthread.php?tid=167770)



Can't add mutiple commands - Anotniomontana - 13.08.2010

Hi, i'm really new to pawno and i would like your advice(s) about this issue i'm having:
I Add my own command using the blank spot in the "New code", everything goes right:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 10) == 0)
	{
	SendClientMessage(playerid, 0x336600, "[OBJECTIVE]");
	SendClientMessage(playerid, 0xCCCC00, "Your goal is to kill other players. Enjoy!");

	return 1;
	}
	return 0;
}
but, when i add another command like that:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 10) == 0)
	{
	SendClientMessage(playerid, 0x336600, "[OBJECTIVE]");
	SendClientMessage(playerid, 0xCCCC00, "Your goal is to kill other players. Enjoy!");

	return 1;
	}
if (strcmp("/cmd2", cmdtext, true, 10) == 0)
	{
	SendClientMessage(playerid, 0x336600, "[CMD2]");
	SendClientMessage(playerid, 0xCCCC00, "This is the second Comamand!");

	return 1;
	return 0;
}
I Get this eror:
Код:
C:\Documents and Settings\Zohar\Desktop\HOST\Server\gamemodes\k.pwn(110) : warning 209: function "OnPlayerCommandText" should return a value
Can anyone give me a proper example for a right usage of
Код:
OnPlayerCommandText
?

Thanks anyway,
Zohar.


Re: Can't add mutiple commands - Ihsan_Cingisiz - 13.08.2010

Quote:
Originally Posted by Anotniomontana
Посмотреть сообщение
Hi, i'm really new to pawno and i would like your advice(s) about this issue i'm having:
I Add my own command using the blank spot in the "New code", everything goes right:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 10) == 0)
	{
	SendClientMessage(playerid, 0x336600, "[OBJECTIVE]");
	SendClientMessage(playerid, 0xCCCC00, "Your goal is to kill other players. Enjoy!");

	return 1;
	}
	return 0;
}
but, when i add another command like that:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 10) == 0)
	{
	SendClientMessage(playerid, 0x336600, "[OBJECTIVE]");
	SendClientMessage(playerid, 0xCCCC00, "Your goal is to kill other players. Enjoy!");

	return 1;
	}
if (strcmp("/cmd2", cmdtext, true, 10) == 0)
	{
	SendClientMessage(playerid, 0x336600, "[CMD2]");
	SendClientMessage(playerid, 0xCCCC00, "This is the second Comamand!");

	return 1;
	return 0;
}
I Get this eror:
Код:
C:\Documents and Settings\Zohar\Desktop\HOST\Server\gamemodes\k.pwn(110) : warning 209: function "OnPlayerCommandText" should return a value
Can anyone give me a proper example for a right usage of
Код:
OnPlayerCommandText
?

Thanks anyway,
Zohar.
Here you go:

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/help", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, 0x336600, "[OBJECTIVE]");
SendClientMessage(playerid, 0xCCCC00, "Your goal is to kill other players. Enjoy!");
return 1;
}
if (strcmp("/cmd2", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, 0x336600, "[CMD2]");
SendClientMessage(playerid, 0xCCCC00, "This is the second Comamand!");
return 1;
}
return 0;
}

You forgot one bracked my friend.


Re: Can't add mutiple commands - Double-O-Seven - 13.08.2010

Remove ", 10".


Re: Can't add mutiple commands - Anotniomontana - 13.08.2010

Thanks a lot guys, this is another step towards my own script and maybe server.

May be locked.