How to make a simple /help -
FreddeN - 23.05.2009
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;
}
}
Re: How to make a simple /help -
FreddeN - 23.05.2009
And the lines is from lvdm
Re: How to make a simple /help -
farse - 23.05.2009
post errors, or i can't help you
Re: How to make a simple /help -
Weirdosport - 23.05.2009
What's this?: SendPlayerFormattedText
Re: How to make a simple /help -
FreddeN - 23.05.2009
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
Re: How to make a simple /help -
farse - 23.05.2009
Код:
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;}
Re: How to make a simple /help -
FreddeN - 23.05.2009
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[]){
Re: How to make a simple /help -
FreddeN - 23.05.2009
I have only one error and two warnings:
error 017: undefined symbol "cmd"
warning 217: loose indentation
warning 217: loose indentation
Re: How to make a simple /help -
Ignas1337 - 23.05.2009
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
Re: How to make a simple /help -
.::: Ecko :::. - 23.05.2009
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