SA-MP Forums Archive
Probem on an FilterScript - 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: Probem on an FilterScript (/showthread.php?tid=101630)



Probem on an FilterScript - monster010 - 11.10.2009

I write from filterscript command "/ members" everything is ok, but if I want to write another command such as "/ gotols" I say that not a team and so on all orders

Код:
*
This FilterScript Made By PuNaNi
*/


#include <a_samp>
new idx;
new teamnumber;

#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_WHITE 0xFFFFFFAA
#define FILTERSCRIPT
//-----------------------------------
enum pInfo
{
	pLeader,
	pMember,
	pRank,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
//----------------------------------------------------------------------------------------------------
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
//----------------------------------------------------------------------------------------------------
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Members -= FS -= By PuNaNi @ LoadeD  ");
	print("--------------------------------------\n");
	return 1;
}
//----------------------------------------------------------------------------------------------------
public OnFilterScriptExit()
{
	print("\n--------------------------------------");
	print(" Members -= FS -= By PuNaNi @ UnLoaded ");
	print("--------------------------------------\n");
	return 1;
}
//----------------------------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
	new string[256];
	new sendername[MAX_PLAYER_NAME];
	new cmd[256];
	cmd = strtok(cmdtext, idx);
//-----------------[Members By PuNaNi]----------------------
	if(strcmp(cmd,"/members",true)==0)
	{
    if(IsPlayerConnected(playerid))
    {
      if (PlayerInfo[playerid][pLeader] != 0) teamnumber = PlayerInfo[playerid][pLeader];
		  else if (PlayerInfo[playerid][pMember] != 0) teamnumber = PlayerInfo[playerid][pMember];
		  else
		  {
      SendClientMessage(playerid, COLOR_LIGHTRED, "Nu faci parte dintr-o ehipa!");
      return 1;
      }
      SendClientMessage(playerid, COLOR_LIGHTRED, "* Membrio Oline *");
      for(new i = 0; i < MAX_PLAYERS; i++)
      {
	    if (IsPlayerConnected(i))
		  {
  	  GetPlayerName(i, sendername, sizeof(sendername));
  	  format(string, sizeof(string), "");
	    if (PlayerInfo[i][pLeader] == teamnumber) format(string, sizeof(string), "%s ( LEADERUL TAU )",sendername);
		  else if (PlayerInfo[i][pMember] == teamnumber) format(string, sizeof(string), "%s - Rank Colegului Tau : %d.",sendername, PlayerInfo[i][pRank]);
		  if (strlen(string) > 1) SendClientMessage(playerid, 0xF5DEB3AA, string);
				 }
			 }
		 }
		return 1;
	}
  return 0;
}
PS: I tried for 15 minutes to do the problem, please help me



Re: Probem on an FilterScript - monster010 - 12.10.2009

nobody know?