Bug with the /lock command
#1


Hey, I got a small problem.
Somewhen, when I try to /lock my house from the inside, its writes for me that I don't have the keys.. But it happenes only on few houses..
This is the /lock code:
Код:
if(strcmp(cmd, "/lock", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    for(new i = 0; i < sizeof(Houses); i++)
			{
				if (PlayerToPoint(3.0, playerid,Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]) || PlayerToPoint(10.0, playerid,Houses[i][ExitX], Houses[i][ExitY], Houses[i][ExitZ]))
				{
				  if(PlayerInfo[playerid][pHouseKey] == i)
					{
						if(Houses[i][Locked] == 1)
						{
							Houses[i][Locked] = 0;
							SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
		          SaveHouses();
							return 1;
						}
						if(Houses[i][Locked] == 0)
						{
							Houses[i][Locked] = 1;
							SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
		          SaveHouses();
							return 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[ERROR:] You don't have a key for this house!");
						return 1;
					}
				}
			}
			for(new i = 0; i < sizeof(bizes); i++)
			{
				if (PlayerToPoint(3.0, playerid,bizes[i][EnterX], bizes[i][EnterY], bizes[i][EnterZ]) || PlayerToPoint(3.0, playerid,bizes[i][ExitX], bizes[i][ExitY], bizes[i][ExitZ]))
				{
					new playername[MAX_PLAYER_NAME];
					GetPlayerName(playerid,playername,sizeof(playername));
					if(PlayerInfo[playerid][pBizKey] == i && strcmp(playername, bizes[PlayerInfo[playerid][pBizKey]][Owner], true) == 0)
					{
						if(bizes[i][Locked] == 1)
						{
								bizes[i][Locked] = 0;
								SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
			          Savebizes();
							   return 1;
						}
						if(bizes[i][Locked] == 0)
						{
								bizes[i][Locked] = 1;
								SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
			          Savebizes();
							  return 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[ERROR:] You don't have a key for this biz!");
						return 1;
					}
				}
			}
	  }
	  return 1;
	}
Can someone help me please?
Reply


Messages In This Thread
Bug with the /lock command - by ed2ka - 26.10.2009, 05:35
Re: Bug with the /lock command - by Nexotronix - 12.01.2010, 17:17
Re: Bug with the /lock command - by Correlli - 12.01.2010, 17:19
Re: Bug with the /lock command - by Sergei - 12.01.2010, 17:22

Forum Jump:


Users browsing this thread: 2 Guest(s)