#1

On my script, I use teleports with playertopoint etc for entering interiors. Is it possible to make a /lock command so when its locked the teleport is no longer functional and when you type /lock again it works?.
Reply
#2

Anyone know?
Reply
#3

pawn Код:
//At the top
new bool:Locked;

//Whenever they teleport
if(Locked)
{
   //They can't teleport
}
else
{
   //SetPlayerPos...
}

//The command
if(!strcmp(cmdtext,"/lock",true))
{
   if(Locked)
   {
      Locked = false;
      //Unlocked
   }
   else
   {
      Locked = true;
      //Locked
   }
}
Reply
#4

Thanks, so the command would be like?:

Код:
if(!strcmp(cmdtext,"/yaklock",true))
{
if(PlayerToPoint(1.0,playerid,2324.0361,-1143.1575,1050.4922))
		      {
	if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 )
		    {
   if(Locked)
   {
      Locked = false;
      //Unlocked
   }
   else
   {
      Locked = true;
      //Locked
	    }
			  }
			}

		return 1;
	}
Reply
#5

It locks but I can't unlock it. When you do /yaklock, it locks correctly but when I do /yaklock again it does nothing.
The command:
Код:
if(!strcmp(cmdtext,"/yaklock",true))
{
if(PlayerToPoint(1.0,playerid,2324.0361,-1143.1575,1050.4922))
		      {
	if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 )
		    {
		    GetPlayerName(playerid, sendername, sizeof(sendername));
			  format(string, sizeof(string), "* %s twists the key in the hole, locking the door.", sendername);
			  ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   if(Locked)
   {
      Locked = false;
      //Unlocked
   }
   else
   {
      Locked = true;
      //Locked
	    }
			  }
			}

		return 1;
	}
The teleport part:
Код:
else if (PlayerToPointStripped(1.0, playerid,1252.2933,-980.0336,37.5556, cx,cy,cz))
	{     		//Yakuza
	if(Locked)
	{
	GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
	}
	else
	{
	SetPlayerPos(playerid,2324.0361,-1143.1575,1050.4922);
		GameTextForPlayer(playerid, "~w~Yakuza HQ", 5000, 3);
		SetPlayerInterior(playerid,12);
		PlayerInfo[playerid][pInt] = 12;
	}
	}
Also, if I added if(Locked) to all the doors, wouldn't /yaklock lock all of them rather than just one?
Reply
#6

Sorry for the bump, could anyone help?.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)