Can't add mutiple commands
#1

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.
Reply
#2

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.
Reply
#3

Remove ", 10".
Reply
#4

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

May be locked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)