How to make a simple /help
#1

I'm trying to make a /help cmd and display a text, but it gives me some errors.

This is the full OnPlayerCommandText line:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid,0.0);
		return 1;
	}
	
	if(!strcmp(cmdtext, "/ooc", true, 3))
	{
		new str[256], pname[256];
		GetPlayerName(playerid, pname, 256);
		format(str, 256, "(( Ooc: %s:%s ))", pname, cmdtext[4]);
		SendClientMessageToAll(0xFFFFFFAA, str);
 		return 1;
	}
	
		if(strcmp(cmd, "/help", true) == 0) {
		SendPlayerFormattedText(playerid,"Text",0);
		SendPlayerFormattedText(playerid,"Text",0);
		SendPlayerFormattedText(playerid,"Text",0);
		SendPlayerFormattedText(playerid,"Text", 0);
		return 1;
	}
}
Reply
#2

And the lines is from lvdm
Reply
#3

post errors, or i can't help you
Reply
#4

What's this?: SendPlayerFormattedText
Reply
#5

Errors:

error 017 undefined symbol "cmd"
error 017 undefined symbol "SendPlayerFormattedText"
error 017 undefined symbol "SendPlayerFormattedText"
error 017 undefined symbol "SendPlayerFormattedText"
error 017 undefined symbol "SendPlayerFormattedText"

Also a warning:

warning 209: function "OnPlayerCommandText" should return a value

Reply
#6

Код:
public SendPlayerFormattedText(playerid, const str[], define)
{
	new tmpbuf[256];
	format(tmpbuf, sizeof(tmpbuf), str, define);
	SendClientMessage(playerid, 0xFF004040, tmpbuf);
}
Is on lvdm,for not write 3 lines(new string,format(..),Send..)is uses SendPlayerFormattedText
_________________________________________________
put at the end of script ,this code:
Код:
forward SendPlayerFormattedText(playerid, const str[], define);
public SendPlayerFormattedText(playerid, const str[], define)
{
	new tmpbuf[256];
	format(tmpbuf, sizeof(tmpbuf), str, define);
	SendClientMessage(playerid, 0xFF004040, tmpbuf);
}
and put new cmd[256]; and cmd = strtok(cmdtext, idx); after OnPlayerCommandText(playerid,cmdtext[]){
_________________________________________________
for new warning(warning 209: function "OnPlayerCommandText" should return a value) :
Put after all commands return 0;}
Reply
#7

Quote:
Originally Posted by Farse
Код:
public SendPlayerFormattedText(playerid, const str[], define)
{
	new tmpbuf[256];
	format(tmpbuf, sizeof(tmpbuf), str, define);
	SendClientMessage(playerid, 0xFF004040, tmpbuf);
}
Is on lvdm,for not write 3 lines(new string,format(..),Send..)is uses SendPlayerFormattedText
_________________________________________________
put at the end of script ,this code:
Код:
forward SendPlayerFormattedText(playerid, const str[], define);
public SendPlayerFormattedText(playerid, const str[], define)
{
	new tmpbuf[256];
	format(tmpbuf, sizeof(tmpbuf), str, define);
	SendClientMessage(playerid, 0xFF004040, tmpbuf);
}
and put new cmd[256]; and cmd = strtok(cmdtext, idx); after OnPlayerCommandText(playerid,cmdtext[]){
_________________________________________________
for new warning(warning 209: function "OnPlayerCommandText" should return a value) :
Put after all commands return 0;}
That fixed almost all the errors and warning but, I dont get it there you type:

and put new cmd[256]; and cmd = strtok(cmdtext, idx); after OnPlayerCommandText(playerid,cmdtext[]){

Reply
#8

I have only one error and two warnings:

error 017: undefined symbol "cmd"
warning 217: loose indentation
warning 217: loose indentation
Reply
#9

replace cmd on the line with cmdtext and loose identations are... mismatch of column of part of script starting ahh something... you opened and closed with { and } and the functios were not in the same distance from the edge.. yeh that's it
Reply
#10

Quote:
Originally Posted by FreddeN
I have only one error and two warnings:

error 017: undefined symbol "cmd"
warning 217: loose indentation
warning 217: loose indentation
add;
new cmd[256];

Ecko
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)