SA-MP Forums Archive
Problem with /o cmd ... - 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: Problem with /o cmd ... (/showthread.php?tid=110063)



Problem with /o cmd ... - Renn47 - 24.11.2009

This is my FS:
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 0)
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet !");
	      return 1;
	    }
			if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  The OOC channel has been disabled by an Admin !");
				return 1;
			}
			if(PlayerInfo[playerid][pMuted] == 1)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "  You can't speak, you have been silenced !");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
				return 1;
			}
			format(string, sizeof(string), "(( %s: %s ))", sendername, result);
			OOCOff(COLOR_OOC,string);
			printf("%s", string);
		}
		return 1;
	}
	if(strcmp(cmd, "/noooc", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if (PlayerInfo[playerid][pAdmin] >= 3 && (!noooc))
			{
				noooc = 1;
				BroadCast(COLOR_GRAD2, "  OOC chat channel disabled by an Admin !");
			}
			else if (PlayerInfo[playerid][pAdmin] >= 3 && (noooc))
			{
				noooc = 0;
				BroadCast(COLOR_GRAD2, "  OOC chat channel enabled by an Admin !");
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/speedo", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if (gSpeedo[playerid] == 1)
			{
				gSpeedo[playerid] = 2;
				GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~g~on", 5000, 5);
				PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
			}
			else if (gSpeedo[playerid] == 2)
			{
				gSpeedo[playerid] = 1;
				GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~r~off", 5000, 5);
				PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "you dont have a speedometer");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/fuel", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if (gGas[playerid] == 0)
			{
				gGas[playerid] = 1;
				GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~g~Fuel Info on", 5000, 5);
				PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
			}
			else if (gGas[playerid] == 1)
			{
				gGas[playerid] = 0;
				GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~r~Fuel Info off", 5000, 5);
				PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
			}
		}
		return 1;
	}
  return 0;
}
#endif
It compiled away the game but it says that the SERVER: UNKNOW CODE .
I USE TRANSLATOR -.-



Re: Problem with /o cmd ... - Daniel_Truk - 24.11.2009

you have to define the cmd,why just not adding it to your GM Under onplayercommandtext?


Re: Problem with /o cmd ... - WackoX - 24.11.2009

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)

Where did you defined ''cmd''?


Re: Problem with /o cmd ... - Renn47 - 24.11.2009

i edited cmd to cmdtext , same problem...


Re: Problem with /o cmd ... - Paiser - 24.11.2009

Quote:
Originally Posted by Renn47
i edited cmd to cmdtext , same problem...
No, as cmdtext is defined into the system, cmd isn't.


Re: Problem with /o cmd ... - Renn47 - 24.11.2009

butt cmd is not woorkiing :S


Re: Problem with /o cmd ... - Smithy - 24.11.2009

Quote:
Originally Posted by Renn47
butt cmd is not woorkiing :S
Because you need to change the 'cmd' to 'cmdtext'


Re: Problem with /o cmd ... - Renn47 - 26.11.2009

Changed .. still does not work


Re: Problem with /o cmd ... - Abernethy - 26.11.2009

May I suggest asking in your own language in one of the boards at the bottom of the forums.


Re: Problem with /o cmd ... - Renn47 - 26.11.2009

estonians are a few here