How o fix this error
#1

I keep doing this and everytime the same error

Код:
  if(!strcmp(cmdtext, "/help", true))
  {
  SendClientMessage(playerid, LightBlue, "Checking");
  
	return 1;
I dont know whats the problem but these erros show up

Код:
C:\Documents and Settings\Admin\My Documents\My Received Files\CES.pwn(202) : error 010: invalid function or declaration
C:\Documents and Settings\Admin\My Documents\My Received Files\CES.pwn(206) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

No closing bracket? you have { but are missing the } somewhere before retern1;
Reply
#3

That didnt fix it sorry
Reply
#4

show more of the script?
Reply
#5

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/kill", true))
  {
  SetPlayerHealth(playerid, 0.0);
  SendClientMessage(playerid, 0xFF8282AA, "SERVER: You have killed yourself!");
  return true;  
  }
  return false;   
}
  if(!strcmp(cmdtext, "/help", true))
  {
  SendClientMessage(playerid, LightBlue, "Checking");
  }
  
	return 1;
}
the /kill command is working but /help is not
Reply
#6

You have a closing bracket after return false; which means your /help is not being reached
Reply
#7

Alright i changed it to

Код:
  if(!strcmp(cmdtext, "/kill", true))
  {
  SetPlayerHealth(playerid, 0.0);
  SendClientMessage(playerid, 0xFF8282AA, "SERVER: You have killed yourself!");
  return true; 
  }
  return false;   


	if(!strcmp(cmdtext, "/help", true))
  {
  SendClientMessage(playerid, Lightblue, "Checking");
  }
  
	return 1;
}
Now it compiles with a warning

Код:
C:\Documents and Settings\Admin\My Documents\My Received Files\CES.pwn(203) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
ANd also it is not working IG
Reply
#8

No reason for the return false; there. It does nothing

Код:
  if(!strcmp(cmdtext, "/kill", true))
  {
  SetPlayerHealth(playerid, 0.0);
  SendClientMessage(playerid, 0xFF8282AA, "SERVER: You have killed yourself!");
  return true;
  }


  if(!strcmp(cmdtext, "/help", true))
  {
  SendClientMessage(playerid, Lightblue, "Checking");
  }

  return 1;
Reply
#9

The above poster is wrong.

You need to either return 1 or 0 under OnPlayerCommandText. 1 Passes it on to another script, 0 says "Server: Unknown command".

Put this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/kill", true))
  {
    SetPlayerHealth(playerid, 0.0);
    SendClientMessage(playerid, 0xFF8282AA, "SERVER: You have killed yourself!");
    return 1;  
  }
  if(!strcmp(cmdtext, "/help", true))
  {
    SendClientMessage(playerid, LightBlue, "Checking");
    return 1;
  }
  return 0;
}
If you want your own Wrong command message, replace return 0 with:
pawn Код:
return SendClientMessage(playerid,RED,"That command doesn't exist!");
Reply
#10

Thankyou all for your help , i really appreciate it . Keep helping people like this
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)