SA-MP Forums Archive
Little problem with HQs. - 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: Little problem with HQs. (/showthread.php?tid=55015)



Little problem with HQs. - kukars22 - 10.11.2008

Hello. I got a little problem. I was making a HQs witch can enter just Faction members, and when I write /openhq, can enter that HQ everyone, when I write /closehq can enter just faction members... But I have problem. When I write /closehq its still opened.. Here is a code, maybe someone know what to do.

Код:
new factionhq = 1;
Код:
if(strcmp(cmd, "/openhq", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	  if (PlayerToPoint(3.0, playerid,2445.5452,-1759.2820,13.5911)) //
			{
				if (PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
				{
				factionhq = 0;
				SendClientMessage(playerid, COLOR_GREEN, " HQ OPEN");
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
				}
	    }
Код:
if(strcmp(cmd, "/closehq", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	  if (PlayerToPoint(3.0, playerid,2445.5452,-1759.2820,13.5911)) //
			{
				if (PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
				{
				factionhq = 0;
				BroadCast(COLOR_RED, " HQ CLOSED");
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
				}
	    }
This is on command "/enter"

Код:
else if (PlayerToPoint(3.0, playerid,2445.5452,-1759.2820,13.5911))//
			{
				if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
			  {
				  SetPlayerInterior(playerid,9);
					SetPlayerPos(playerid,82.8803,1323.3667,1083.8662);
				  GameTextForPlayer(playerid, "~w~Welcome to Faction HQ", 5000, 1);
				}
				else if(factionhq == 0)
			  {
				  SetPlayerInterior(playerid,9);
					SetPlayerPos(playerid,82.8803,1323.3667,1083.8662);
				  GameTextForPlayer(playerid, "~w~Welcome to Faction HQ", 5000, 1);
				}
			}
and this is on "/exit"

Код:
else if (PlayerToPoint(3.0, playerid,82.8803,1323.3667,1083.8662)) //
			{
			  SetPlayerInterior(playerid,0);
				SetPlayerPos(playerid,2445.5452,-1759.2820,13.5911);
			}



Re: Little problem with HQs. - Finn - 10.11.2008

pawn Код:
new bool:HQOpen;
pawn Код:
if(strcmp(cmd, "/openhq", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
    if(PlayerToPoint(3.0, playerid,2445.5452,-1759.2820,13.5911))
    {
      if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
      {
        if(HQOpen == true) return SendClientMessage(playerid, COLOR_GRAD1, "HQ is open already!");
        HQOpen = true;
        SendClientMessage(playerid, COLOR_GREEN, " HQ OPEN");
      }
      else
      {
        SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
      }
    }
  }
}
pawn Код:
if(strcmp(cmd, "/closehq", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
    if(PlayerToPoint(3.0, playerid,2445.5452,-1759.2820,13.5911))
    {
      if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
      {
        if(HQOpen == false) return SendClientMessage(playerid, COLOR_GRAD1, "HQ is closed already!");
        HQOpen = false;
        SendClientMessage(playerid, COLOR_GREEN, " HQ CLOSED");
      }
      else
      {
        SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
      }
    }
  }
}
pawn Код:
// Command /enter
else if (PlayerToPoint(3.0, playerid,2445.5452,-1759.2820,13.5911))//
{
  if(HQOpen == false && PlayerInfo[playerid][pMember] != 6 && PlayerInfo[playerid][pLeader] != 6) return 1;
  SetPlayerInterior(playerid, 9);
  SetPlayerPos(playerid, 82.8803, 1323.3667, 1083.8662);
  GameTextForPlayer(playerid, "~w~Welcome to Faction HQ", 5000, 1);
}



Re: Little problem with HQs. - kukars22 - 14.06.2009

And how to change it if I want add like 10 faction under one cmd?
Like... If Im member if faction1 I can /openhq at my hq, but not in others...


Re: Little problem with HQs. - kukars22 - 24.06.2009

Ehh.. I can use else if?