SA-MP Forums Archive
commands not working - 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: commands not working (/showthread.php?tid=20598)



commands not working - GreenHammy - 29.12.2007

My commands in the server is'nt working i do them and it says SERVER:Unknown command
but it compiles fine with no errors,but only 4 warnings which dont mean anything
heres the code

Код:
public OnPlayerCommandText (playerid,cmdtext[])
{
  if strcmp(cmdtext,"/smbase",true, 0) *then
	{
	SetPlayerPos(playerid,-2157.7058,-197.5349,35.3203);
  SendClientMessage(playerid,TEXT_COLOR, "Welcome to the SM Base");
	return 1;
	}
  if strcmp(cmdtext,"/kill",true, 1) *then
	{
	SetPlayerHealth(playerid, 0);
  return 1;
	}
    return 0;

}



Re: commands not working - GreenHammy - 29.12.2007

Sorry 2 errors, im not sure whats wrong

Код:
C:\Users\USER\Documents\Josh's Documents\GTA San Andreas\samp\gamemodes\trest.pwn(90) : warning 217: loose indentation
C:\Users\USER\Documents\Josh's Documents\GTA San Andreas\samp\gamemodes\trest.pwn(96) : warning 217: loose indentation
C:\Users\USER\Documents\Josh's Documents\GTA San Andreas\samp\gamemodes\trest.pwn(139) : error 001: expected token: "*then", but found "{"
C:\Users\USER\Documents\Josh's Documents\GTA San Andreas\samp\gamemodes\trest.pwn(142) : warning 217: loose indentation
C:\Users\USER\Documents\Josh's Documents\GTA San Andreas\samp\gamemodes\trest.pwn(145) : error 001: expected token: "*then", but found "{"
C:\Users\USER\Documents\Josh's Documents\GTA San Andreas\samp\gamemodes\trest.pwn(147) : warning 217: loose indentation
C:\Users\USER\Documents\Josh's Documents\GTA San Andreas\samp\gamemodes\trest.pwn(222) : warning 203: symbol is never used: "gteam"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: commands not working - GreenHammy - 29.12.2007

Oh how do i indent


Re: commands not working - Sandra18[NL] - 29.12.2007

Bad (loose) Indentation:

Код:
public OnPlayerCommandText (playerid,cmdtext[])
{
 if(strcmp(cmdtext, "/smbase", true) == 0)
{
    SetPlayerPos(playerid,-2157.7058,-197.5349,35.3203);
  SendClientMessage(playerid,TEXT_COLOR, "Welcome to the SM Base");
 return 1;
    }
 if(strcmp(cmdtext, "/kill", true) == 0)
  {
SetPlayerHealth(playerid, 0);
        return 1;
    }
   return 0;
 }
Good Indentation

Код:
public OnPlayerCommandText (playerid,cmdtext[])
{
  if(strcmp(cmdtext, "/smbase", true) == 0)
  {
    SetPlayerPos(playerid,-2157.7058,-197.5349,35.3203);
    SendClientMessage(playerid,TEXT_COLOR, "Welcome to the SM Base");
    return 1;
  }
  if(strcmp(cmdtext, "/kill", true) == 0)
  {
    SetPlayerHealth(playerid, 0);
    return 1;
  }
  return 0;
}
@Andre, you're right, its
Код:
#pragma tabsize 0
to let pawno ignore Indentation




Re: commands not working - GreenHammy - 29.12.2007

Ok thanks


Re: commands not working - eXchainZ-FoReVeR - 16.09.2009

Quote:

Default space is 4 " "(space) in PAWNO program...
You can disable the warnings(not recommended by me, for sure) - #pragma tabsize 0 (or was it 1, don't remember)

Indenting it correctly makes it easily readable

Dude... Just press TAB For 4 Spaces.