/enter command bug
#1

Greetings. I found out that something is wrong in my /enter command. In game, it doesn't freeze the player. Here's the lines of the /enter command

Код:
CMD:enter(playerid, params[])
{
	new string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	for(new idx=0; idx<MAX_DOORS; idx++) // Dynamic Doors
	{
	    if(IsPlayerInRangeOfPoint(playerid, 2, DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ]))
	    {
	        if(DoorInfo[idx][dIInt] == 83 && DoorInfo[idx][dIVW] == 8473 && BankBlock)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "You can't enter the bank as it is being robbed at the moment.");
	            return 1;
	        }
	        if(DoorInfo[idx][dCInt])
	        {
	            GameTextForPlayer(playerid, "~w~Loading Objects", 3500, 3);
				TogglePlayerControllable(playerid, 0);
	            SetTimerEx("EnterExitTimer", 20000, false, "i", playerid);
	            PlayerInfo[playerid][pSpawnFreeze] = 1;
	        }
	        PlayerInfo[playerid][pSpawnFreeze] = 0;
	        SetPlayerInterior(playerid, DoorInfo[idx][dIInt]);
	        SetPlayerVirtualWorld(playerid, DoorInfo[idx][dIVW]);
	        SetPlayerFacingAngle(playerid, DoorInfo[idx][dIA]);
	        SetCameraBehindPlayer(playerid);
	        SetPlayerPos(playerid, DoorInfo[idx][dIX], DoorInfo[idx][dIY], DoorInfo[idx][dIZ]);
	        return 1;
	    }
	}
	for(new idx=1; idx<MAX_BIZ; idx++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
		{
      		if(!BizInfo[idx][bStatus] && PlayerInfo[playerid][pBiz] != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "This business is closed.");
		    if(BizInfo[idx][bType] == 1) // 24/7 Business
		    {
		        format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				if(PlayerInfo[playerid][pMaskOn] == 1)
				{
			        format(string, sizeof(string), "* Stranger pushes the door and enters the shop.");
				}
				else
				{
					format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				}
				SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		        SetPlayerPos(playerid, -27.3025,-57.6649,1003.5469);
		        SetPlayerFacingAngle(playerid, 357.5915);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 6);
		        SetPlayerVirtualWorld(playerid, idx+100);
		        format(string, sizeof(string), "** Welcome to %s's 24/7 Market (( /list & /buy )) **", BizInfo[idx][bOwner]);
		        SendClientMessage(playerid, COLOR_ORANGE, string);
		        return 1;
		    }
		    else if(BizInfo[idx][bType] == 2) // Clothes Shop Business
		    {
		        format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
 				if(PlayerInfo[playerid][pMaskOn] == 1)
				{
			        format(string, sizeof(string), "* Stranger pushes the door and enters the shop.");
				}
				else
				{
					format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				}
				SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		        SetPlayerPos(playerid, 207.0638,-139.9965,1003.5078);
		        SetPlayerFacingAngle(playerid, 356.3849);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 3);
		        SetPlayerVirtualWorld(playerid, idx+100);
		        format(string, sizeof(string), "** Welcome to %s's Clothes Shop (( /buyclothes(old) & /buytoys )) **", BizInfo[idx][bOwner]);
		        SendClientMessage(playerid, COLOR_ORANGE, string);
		        return 1;
		    }
		    else if(BizInfo[idx][bType] == 3) // Ammunation Business
		    {
		        format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				if(PlayerInfo[playerid][pMaskOn] == 1)
				{
			        format(string, sizeof(string), "* Stranger pushes the door and enters the shop.");
				}
				else
				{
					format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				}
				SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		        SetPlayerPos(playerid, 285.8044,-85.9956,1001.5229);
		        SetPlayerFacingAngle(playerid, 358.9898);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 4);
		        SetPlayerVirtualWorld(playerid, idx+100);
		        format(string, sizeof(string), "** Welcome to %s's Ammunation (( /list & /buy /buyweapon )) **", BizInfo[idx][bOwner]);
		        SendClientMessage(playerid, COLOR_ORANGE, string);
		        return 1;
		    }
		    else if(BizInfo[idx][bType] == 4) // Club Business
		    {
		        format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				if(PlayerInfo[playerid][pMaskOn] == 1)
				{
			        format(string, sizeof(string), "* Stranger pushes the door and enters the shop.");
				}
				else
				{
					format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				}
				SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		        SetPlayerPos(playerid, 493.4252,-24.3061,1000.6797);
		        SetPlayerFacingAngle(playerid, 0.2432);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 17);
		        SetPlayerVirtualWorld(playerid, idx+100);
		        format(string, sizeof(string), "** Welcome to %s's Club (( /list & /buy )) **", BizInfo[idx][bOwner]);
		        SendClientMessage(playerid, COLOR_ORANGE, string);
		        return 1;
		    }
		    else if(BizInfo[idx][bType] == 5) // Advertisement Agency
		    {
		        format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				if(PlayerInfo[playerid][pMaskOn] == 1)
				{
			        format(string, sizeof(string), "* Stranger pushes the door and enters the shop.");
				}
				else
				{
					format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				}
				SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		        SetPlayerPos(playerid, 834.1631,7.4883,1004.1797);
		        SetPlayerFacingAngle(playerid, 86.7239);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 3);
		        SetPlayerVirtualWorld(playerid, idx+100);
		        format(string, sizeof(string), "** Welcome to %s's Advertisement Agency (( /ad )) **", BizInfo[idx][bOwner]);
		        SendClientMessage(playerid, COLOR_ORANGE, string);
		        return 1;
		    }
		    else if(BizInfo[idx][bType] == 6) // Fast Food
		    {
		        format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				if(PlayerInfo[playerid][pMaskOn] == 1)
				{
			        format(string, sizeof(string), "* Stranger pushes the door and enters the shop.");
				}
				else
				{
					format(string, sizeof(string), "* %s pushes the door and enters the shop.", RPN(playerid));
				}
				SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		        SetPlayerPos(playerid, 372.3830,-133.2579,1001.4922);
		        SetPlayerFacingAngle(playerid, 0.4216);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 5);
		        SetPlayerVirtualWorld(playerid, idx+100);
		        format(string, sizeof(string), "** Welcome to %s's Fast Food (( /list /buy )) **", BizInfo[idx][bOwner]);
		        SendClientMessage(playerid, COLOR_ORANGE, string);
		        return 1;
		    }
		    else if(BizInfo[idx][bType] == 7) // Casino
		    {
		        format(string, sizeof(string), "* %s pushes the door and enters the casino.", RPN(playerid));
				if(PlayerInfo[playerid][pMaskOn] == 1)
				{
			        format(string, sizeof(string), "* Stranger pushes the door and enters the casino.");
				}
				else
				{
					format(string, sizeof(string), "* %s pushes the door and enters the casino.", RPN(playerid));
				}
				SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		        SetPlayerPos(playerid, 2233.8032,1712.2303,1011.7632);
		        SetPlayerFacingAngle(playerid, 0.4216);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 1);
		        SetPlayerVirtualWorld(playerid, idx+100);
		        format(string, sizeof(string), "** Welcome to %s's Casino (( /list /buy )) **", BizInfo[idx][bOwner]);
		        SendClientMessage(playerid, COLOR_ORANGE, string);
		        return 1;
		    }
		}
	}
	for(new idx=1; idx<MAX_HOUSES; idx++) // Dynamic Houses
	{
		if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
	    {
		    if(!HouseInfo[idx][hStatus] && PlayerInfo[playerid][pHouse] != idx && PlayerInfo[playerid][pVHouse] != idx) return SendClientMessage(playerid, COLOR_GREY, "This house is locked.");
	        format(string, sizeof(string), "* %s pushes the door and enters the house.", RPN(playerid));
			if(PlayerInfo[playerid][pMaskOn] == 1)
			{
			   format(string, sizeof(string), "* Stranger pushes the door and enters the house.");
			}
			else
			{
				format(string, sizeof(string), "* %s pushes the door and enters the house.", RPN(playerid));
			}
			SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	        SetPlayerVirtualWorld(playerid, idx+500);
			if(HouseInfo[idx][hLevel] == 1)
			{
				SetPlayerPos(playerid, 243.9951,304.9418,999.1484);
		        SetPlayerFacingAngle(playerid, 267.0980);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 1);
			}
			else if(HouseInfo[idx][hLevel] == 2)
			{
				SetPlayerPos(playerid, 2259.6702,-1135.8542,1050.6328);
		        SetPlayerFacingAngle(playerid, 267.3974);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 10);
			}
			else if(HouseInfo[idx][hLevel] == 3)
			{
				SetPlayerPos(playerid, 2308.8254,-1212.8070,1049.0234);
		        SetPlayerFacingAngle(playerid, 359.8550);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 6);
			}
			else if(HouseInfo[idx][hLevel] == 4)
			{
				SetPlayerPos(playerid, 260.7436,1237.5563,1084.2578);
		        SetPlayerFacingAngle(playerid, 1.6415);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 9);
			}
			else if(HouseInfo[idx][hLevel] == 5)
			{
				SetPlayerPos(playerid, -42.5742,1405.6521,1084.4297);
     			SetPlayerFacingAngle(playerid, 359.1347);
     			SetCameraBehindPlayer(playerid);
     			SetPlayerInterior(playerid, 8);
			}
			else if(HouseInfo[idx][hLevel] == 6)
			{
				SetPlayerPos(playerid, 2468.6787,-1698.2617,1013.5078);
		        SetPlayerFacingAngle(playerid, 89.1791);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 2);
			}
			else if(HouseInfo[idx][hLevel] == 7)
			{
				SetPlayerPos(playerid, 2365.2183,-1135.4014,1050.8750);
		        SetPlayerFacingAngle(playerid, 359.8550);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 8);
			}
			else if(HouseInfo[idx][hLevel] == 8)
			{
				SetPlayerPos(playerid, 2270.1270,-1210.4855,1047.5625);
		        SetPlayerFacingAngle(playerid, 89.4224);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 10);
			}
			else if(HouseInfo[idx][hLevel] == 9)
			{
				SetPlayerPos(playerid, 2324.4424,-1149.2057,1050.7101);
		        SetPlayerFacingAngle(playerid, 0.7248);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 12);
			}
			else if(HouseInfo[idx][hLevel] == 10)
			{
				SetPlayerPos(playerid, 83.0863,1322.3020,1083.8662);
		        SetPlayerFacingAngle(playerid, 359.5183);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 9);
			}
			else if(HouseInfo[idx][hLevel] == 11)
			{
				SetPlayerPos(playerid, 1327.1052,-1071.0226,3458.9060);
		        SetPlayerFacingAngle(playerid, 359.5183);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerInterior(playerid, 0);
				GameTextForPlayer(playerid, "~w~Loading Objects", 3500, 3);
				TogglePlayerControllable(playerid, 0);
	            SetTimerEx("EnterExitTimer", 5000, false, "i", playerid);
	            PlayerInfo[playerid][pSpawnFreeze] = 1;
			}
		}
	}
	for(new idx=1; idx<MAX_GARAGES; idx++) // Dynamic Garages
	{
		if(IsPlayerInRangeOfPoint(playerid, 5, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ])/* && GetPlayerState(playerid) == PLAYER_STATE_DRIVER*/)
	    {
	        format(string, sizeof(string), "* %s enters the garage.", RPN(playerid));
			if(PlayerInfo[playerid][pMaskOn] == 1)
			{
			   format(string, sizeof(string), "* Stranger enters the garage.");
			}
			else
			{
				format(string, sizeof(string), "* %s enters the garage.", RPN(playerid));
			}
			SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	        SetPlayerVirtualWorld(playerid, idx+500);
	        //SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), idx+500);
	        new vehicleid = GetPlayerVehicleID(playerid);
			if(GarageInfo[idx][gLevel] == 1)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 2)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 3)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 4)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 5)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 6)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 7)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 8)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 9)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
			if(GarageInfo[idx][gLevel] == 10)
			{
				if(IsPlayerInAnyVehicle(playerid))
				{
				    SetVehiclePos(vehicleid, -2070.3000488281,-24,49.099998474121);
			        SetCameraBehindPlayer(playerid);
			        SetVehicleVirtualWorld(vehicleid, idx+500);
				}
				else
				{
				    SetPlayerPos(playerid, -2070.3000488281,-24,49.099998474121);
				    SetPlayerInterior(playerid, 0);
				    SetCameraBehindPlayer(playerid);
				}
			}
	        return 1;
		}
	}
	return 1;
}
Is there something wrong in it? If so, please help me. Thanks
Reply
#2

Tell me what error are u reciving while compiling
Reply
#3

There's no error. But when I go in a door IG, it doesn't freeze the players.
Reply
#4

Код:
if(DoorInfo[idx][dIInt] == 83 && DoorInfo[idx][dIVW] == 8473 && BankBlock)
if(DoorInfo[idx][dCInt])
Are you using the correct variables to check against maybe?
Reply
#5

Try moving TogglePlayerControllable(playerid, 0); to the part where you set the interior, set the camera etc.
Reply
#6

Quote:
Originally Posted by NoahF
Посмотреть сообщение
Try moving TogglePlayerControllable(playerid, 0); to the part where you set the interior, set the camera etc.
He should do the reverse of what you said and move the other code, up to the toggle.

This is where you want to put debug SendClientMessages in to check what is being triggered. It will be to do with your ifs, and your logic.


Did you make this DynamicDoor system or is it downloaded?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)