Freeze player on enter
#1

Hey. I'm trying to make it so when you type /enter you get frozen for some seconds and then get auto-unfreezed.
Can somebody help me?

Код:
//===============================[Enter]=================================================

    if(strcmp(cmd, "/enter", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			for(new h = 0; h < sizeof(HouseInfo); h++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
    			{
    			    if(strcmp(playername, HouseInfo[h][hOwner], true) == 0)
			        {
						new Level = HouseInfo[h][hLevel];
		    			if(HouseInfo[h][hLock] == 1 && strcmp(HouseInfo[h][hOwner],PlayerName(playerid), false ) != 0) return SendClientMessage(playerid, COLOR_WHITE,  "[HOUSE]: This house has been locked by the owner.");
	    				SetPlayerPos(playerid, HousesCoords[Level][0], HousesCoords[Level][1], HousesCoords[Level][2]);
	   					SetPlayerInterior(playerid, HousesLevels[Level][0]); SetPlayerVirtualWorld(playerid, HouseInfo[h][hWorld]);
	   					HouseEntered[playerid] = h;
					}
					else
					{
						GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
					}
				}
			}
			for(new i = 0; i < sizeof(BizzInfo); i++)
			{
				if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
				{
					////printf("Found House :%d",i);
					if((strcmp(playername, BizzInfo[i][bOwner], true) == 0) || GetPlayerPCash(playerid) >= BizzInfo[i][bEntranceCost] || BizzInfo[i][bEntranceCost]==0)
					{
						if(AdminDuty[playerid] != 1)
						{
							if(BizzInfo[i][bLocked] == 1)
							{
								GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
								return 1;
							}
							GivePlayerPCash(playerid,-BizzInfo[i][bEntranceCost]);
							format(string, sizeof(string), "~r~-$%d~n~~w~/exit", BizzInfo[i][bEntranceCost]);
							BizzInfo[i][bTill] += BizzInfo[i][bEntranceCost];
							BizzInfo[i][bProducts]--;
							OnPropUpdate();
							GameTextForPlayer(playerid, string, 5000, 3);
						}
						SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
						SetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
						PlayerInfo[playerid][pInt] = BizzInfo[i][bInterior];
						HouseEntered[playerid] = i;
						PlayerInfo[playerid][pLocal] = i+99;
						SetPlayerVirtualWorld(playerid,i);
						//PayLog(string);
					}
				}
			}
			for(new i = 0; i < sizeof(SBizzInfo); i++)
			{
				if (PlayerToPoint(3, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
				{
					if(GetPlayerPCash(playerid) >= SBizzInfo[i][sbEntranceCost] || SBizzInfo[i][sbEntranceCost]==0)
					{
							if(SBizzInfo[i][sbLocked] == 1 && AdminDuty[playerid] != 1)
							{
								GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
								return 1;
							}
							GivePlayerPCash(playerid,-SBizzInfo[i][sbEntranceCost]);
							SBizzInfo[i][sbProducts]--;
			    			SBizzInfo[i][sbTill] += SBizzInfo[i][sbEntranceCost];
							OnPropUpdate();
					}
					else
					{
						GameTextForPlayer(playerid, "~r~You don't have the cash", 5000, 1);
					}
				}
			}
			for(new i = 0; i < sizeof(IntInfo); i++)
			{
				if (PlayerToPoint(3, playerid,IntInfo[i][iEntrancex], IntInfo[i][iEntrancey], IntInfo[i][iEntrancez]))
				{
				    if(IntInfo[i][iType] == 5)
					{
						if(PlayerInfo[playerid][pMember] != 1 && AdminDuty[playerid] != 1 && PlayerInfo[playerid][pMember] != 14 && PlayerInfo[playerid][pMember] != 2)
						{
					        SendClientMessage(playerid,COLOR_GREY,"You are not a police officer.");
					        return 1;
					    }
					}
					if(IntInfo[i][iType] == 8)
					{
					    if(PlayerInfo[playerid][pMember] != 8) return 1;
					}
					GameTextForPlayer(playerid, "~w~/exit", 5000, 3);
				    SetPlayerInterior(playerid,IntInfo[i][iInt]);
					SetPlayerVirtualWorld(playerid,IntInfo[i][iWorld]);
					SetPlayerPos(playerid,IntInfo[i][iExitx], IntInfo[i][iExity], IntInfo[i][iExitz]);
					IntEntered[playerid] = i;
					if(IntInfo[i][iType] == 1)
					{
					    SetPlayerShopName(playerid,"FDBURG");
					}
					else if(IntInfo[i][iType] == 2)
					{
					    SetPlayerShopName(playerid,"FDPIZA");
					}
					else if(IntInfo[i][iType] == 3)
					{
					    SetPlayerShopName(playerid,"FDCHICK");
					}
					else if(IntInfo[i][iType] == 4)
					{
					    SendClientMessage(playerid,COLOR_WHITE,"Type /skin or /clothes to change your clothes.");
					}
				}
			}
			for(new h = 5; h < sizeof(FamilyInfo); h++)
			{
			    if(PlayerToPoint(2.0, playerid, FamilyInfo[h][FamilySpawn][0],FamilyInfo[h][FamilySpawn][1],FamilyInfo[h][FamilySpawn][2]))
			    {
			        if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pMember] != h && FamilyInfo[h][FamilyLocked] == 1 && AdminDuty[playerid] != 1)
			        {
                        GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
			        }
		            else
			        {
		                if(FamilyInfo[h][FamilyInterior] == 0)
						{
                            GameTextForPlayer(playerid, "~r~Entrance is in Construction", 5000, 1);
						}
						else if(FamilyInfo[h][FamilyInterior] == 1) // Crackden
						{
                            format(string, sizeof(string), "~p~%s~n~~w~HQ", FamilyInfo[h][FamilyName]);
		                    GameTextForPlayer(playerid, string, 5000, 1);
                            SetPlayerVirtualWorld(playerid,h);
                            SetPlayerInterior(playerid,5);
			                SetPlayerPos(playerid, 318.6968,1117.9586,1083.8828);
						}
						else if(FamilyInfo[h][FamilyInterior] == 2) // Ryders
						{
                            format(string, sizeof(string), "~p~%s~n~~w~HQ", FamilyInfo[h][FamilyName]);
		                    GameTextForPlayer(playerid, string, 5000, 1);
                            SetPlayerVirtualWorld(playerid,h);
                            SetPlayerInterior(playerid,2);
			                SetPlayerPos(playerid, 2465.8018,-1698.3330,1013.5078);
						}
						else if(FamilyInfo[h][FamilyInterior] == 3) // Cjs
						{
                            format(string, sizeof(string), "~p~%s~n~~w~HQ", FamilyInfo[h][FamilyName]);
		                    GameTextForPlayer(playerid, string, 5000, 1);
                            SetPlayerVirtualWorld(playerid,h);
                            SetPlayerInterior(playerid,3);
			                SetPlayerPos(playerid, 2496.0498,-1694.3333,1014.7422);
						}
					}
					return 1;
			    }
			}
            for(new i = 0; i < sizeof(EnterSpray); i++)
     	    {
   			    if (PlayerToPoint(5.0,playerid,EnterSpray[i][0], EnterSpray[i][1], EnterSpray[i][2]))
    		    {
					if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 14)
					{
					    SendClientMessage(playerid,COLOR_WHITE,"Remember to type /exit to leave.");
					    SetVehiclePos(idcar,EnterSpray[i][3], EnterSpray[i][4], EnterSpray[i][5]);
						return 1;
					}
					if(GetPlayerPCash(playerid) >= 500)
					{
					    GivePlayerPCash(playerid,-500);
					    SendClientMessage(playerid,COLOR_WHITE,"Remember to type /exit to leave.");
					    SetVehiclePos(idcar,EnterSpray[i][3], EnterSpray[i][4], EnterSpray[i][5]);
					    return 1;
					}
    		    }
			}
			if (PlayerToPoint(2.0, playerid,2315.4888,-0.0249,26.7422))
			{
			    GameTextForPlayer(playerid, "~w~Vault", 5000, 1);
				SetPlayerPos(playerid,2310.0803,26.1137,-41.4836);
			}
			else if (PlayerToPoint(2.0, playerid,1524.4868,-1677.7761,6.2188))
			{
				SetPlayerPos(playerid,274.3254,122.1001,1004.6172);
				SetPlayerInterior(playerid,10);
				IntEntered[playerid] = 0;
			}
			else if (PlayerToPoint(8.0, playerid,979.2475,-1256.5812,16.9534))
			{
                SetVehiclePos(idcar,-2723.6589,217.4788,4.4844);
				SetVehicleZAngle(idcar,263.5777);
            }
        }
		return 1;
    }
Reply
#2

Simple.

At every entrance exit position do:

pawn Код:
TogglePlayerControllable(playerid, 0);
SetTimerEx("ToggleMovement",2500, false, "i", playerid);
Somewhere else

pawn Код:
forward ToggleMovement(playerid);
public ToggleMovement(playerid)
{
TogglePlayerControllable(playerid, 1);
return 1;
}
Try it
Reply
#3

pawn Код:
forward Transferring(playerid);
stock Transfere(playerid)
{
    SetTimerEx("Transferring", 3000, false, "i", playerid);
    TogglePlayerControllable(playerid, 0);
    return 1;
}

public Transferring(playerid)
{
    TogglePlayerControllable(playerid, 1);
    return 1;
}
this would be one way to do it..
just write "Transfere(playerid);" where you want the player to be freezed.
Reply
#4

Can somebody add that code here?

Код:
//===============================[Enter]=================================================

    if(strcmp(cmd, "/enter", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			for(new h = 0; h < sizeof(HouseInfo); h++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
    			{
    			    if(strcmp(playername, HouseInfo[h][hOwner], true) == 0)
			        {
						new Level = HouseInfo[h][hLevel];
		    			if(HouseInfo[h][hLock] == 1 && strcmp(HouseInfo[h][hOwner],PlayerName(playerid), false ) != 0) return SendClientMessage(playerid, COLOR_WHITE,  "[HOUSE]: This house has been locked by the owner.");
	    				SetPlayerPos(playerid, HousesCoords[Level][0], HousesCoords[Level][1], HousesCoords[Level][2]);
	   					SetPlayerInterior(playerid, HousesLevels[Level][0]); SetPlayerVirtualWorld(playerid, HouseInfo[h][hWorld]);
	   					HouseEntered[playerid] = h;
					}
					else
					{
						GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
					}
				}
			}
			for(new i = 0; i < sizeof(BizzInfo); i++)
			{
				if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
				{
					////printf("Found House :%d",i);
					if((strcmp(playername, BizzInfo[i][bOwner], true) == 0) || GetPlayerPCash(playerid) >= BizzInfo[i][bEntranceCost] || BizzInfo[i][bEntranceCost]==0)
					{
						if(AdminDuty[playerid] != 1)
						{
							if(BizzInfo[i][bLocked] == 1)
							{
								GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
								return 1;
							}
							GivePlayerPCash(playerid,-BizzInfo[i][bEntranceCost]);
							format(string, sizeof(string), "~r~-$%d~n~~w~/exit", BizzInfo[i][bEntranceCost]);
							BizzInfo[i][bTill] += BizzInfo[i][bEntranceCost];
							BizzInfo[i][bProducts]--;
							OnPropUpdate();
							GameTextForPlayer(playerid, string, 5000, 3);
						}
						SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
						SetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
						PlayerInfo[playerid][pInt] = BizzInfo[i][bInterior];
						HouseEntered[playerid] = i;
						PlayerInfo[playerid][pLocal] = i+99;
						SetPlayerVirtualWorld(playerid,i);
						//PayLog(string);
					}
				}
			}
			for(new i = 0; i < sizeof(SBizzInfo); i++)
			{
				if (PlayerToPoint(3, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
				{
					if(GetPlayerPCash(playerid) >= SBizzInfo[i][sbEntranceCost] || SBizzInfo[i][sbEntranceCost]==0)
					{
							if(SBizzInfo[i][sbLocked] == 1 && AdminDuty[playerid] != 1)
							{
								GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
								return 1;
							}
							GivePlayerPCash(playerid,-SBizzInfo[i][sbEntranceCost]);
							SBizzInfo[i][sbProducts]--;
			    			SBizzInfo[i][sbTill] += SBizzInfo[i][sbEntranceCost];
							OnPropUpdate();
					}
					else
					{
						GameTextForPlayer(playerid, "~r~You don't have the cash", 5000, 1);
					}
				}
			}
			for(new i = 0; i < sizeof(IntInfo); i++)
			{
				if (PlayerToPoint(3, playerid,IntInfo[i][iEntrancex], IntInfo[i][iEntrancey], IntInfo[i][iEntrancez]))
				{
				    if(IntInfo[i][iType] == 5)
					{
						if(PlayerInfo[playerid][pMember] != 1 && AdminDuty[playerid] != 1 && PlayerInfo[playerid][pMember] != 14 && PlayerInfo[playerid][pMember] != 2)
						{
					        SendClientMessage(playerid,COLOR_GREY,"You are not a police officer.");
					        return 1;
					    }
					}
					if(IntInfo[i][iType] == 8)
					{
					    if(PlayerInfo[playerid][pMember] != 8) return 1;
					}
					GameTextForPlayer(playerid, "~w~/exit", 5000, 3);
				    SetPlayerInterior(playerid,IntInfo[i][iInt]);
					SetPlayerVirtualWorld(playerid,IntInfo[i][iWorld]);
					SetPlayerPos(playerid,IntInfo[i][iExitx], IntInfo[i][iExity], IntInfo[i][iExitz]);
					IntEntered[playerid] = i;
					if(IntInfo[i][iType] == 1)
					{
					    SetPlayerShopName(playerid,"FDBURG");
					}
					else if(IntInfo[i][iType] == 2)
					{
					    SetPlayerShopName(playerid,"FDPIZA");
					}
					else if(IntInfo[i][iType] == 3)
					{
					    SetPlayerShopName(playerid,"FDCHICK");
					}
					else if(IntInfo[i][iType] == 4)
					{
					    SendClientMessage(playerid,COLOR_WHITE,"Type /skin or /clothes to change your clothes.");
					}
				}
			}
			for(new h = 5; h < sizeof(FamilyInfo); h++)
			{
			    if(PlayerToPoint(2.0, playerid, FamilyInfo[h][FamilySpawn][0],FamilyInfo[h][FamilySpawn][1],FamilyInfo[h][FamilySpawn][2]))
			    {
			        if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pMember] != h && FamilyInfo[h][FamilyLocked] == 1 && AdminDuty[playerid] != 1)
			        {
                        GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
			        }
		            else
			        {
		                if(FamilyInfo[h][FamilyInterior] == 0)
						{
                            GameTextForPlayer(playerid, "~r~Entrance is in Construction", 5000, 1);
						}
						else if(FamilyInfo[h][FamilyInterior] == 1) // Crackden
						{
                            format(string, sizeof(string), "~p~%s~n~~w~HQ", FamilyInfo[h][FamilyName]);
		                    GameTextForPlayer(playerid, string, 5000, 1);
                            SetPlayerVirtualWorld(playerid,h);
                            SetPlayerInterior(playerid,5);
			                SetPlayerPos(playerid, 318.6968,1117.9586,1083.8828);
						}
						else if(FamilyInfo[h][FamilyInterior] == 2) // Ryders
						{
                            format(string, sizeof(string), "~p~%s~n~~w~HQ", FamilyInfo[h][FamilyName]);
		                    GameTextForPlayer(playerid, string, 5000, 1);
                            SetPlayerVirtualWorld(playerid,h);
                            SetPlayerInterior(playerid,2);
			                SetPlayerPos(playerid, 2465.8018,-1698.3330,1013.5078);
						}
						else if(FamilyInfo[h][FamilyInterior] == 3) // Cjs
						{
                            format(string, sizeof(string), "~p~%s~n~~w~HQ", FamilyInfo[h][FamilyName]);
		                    GameTextForPlayer(playerid, string, 5000, 1);
                            SetPlayerVirtualWorld(playerid,h);
                            SetPlayerInterior(playerid,3);
			                SetPlayerPos(playerid, 2496.0498,-1694.3333,1014.7422);
						}
					}
					return 1;
			    }
			}
            for(new i = 0; i < sizeof(EnterSpray); i++)
     	    {
   			    if (PlayerToPoint(5.0,playerid,EnterSpray[i][0], EnterSpray[i][1], EnterSpray[i][2]))
    		    {
					if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 14)
					{
					    SendClientMessage(playerid,COLOR_WHITE,"Remember to type /exit to leave.");
					    SetVehiclePos(idcar,EnterSpray[i][3], EnterSpray[i][4], EnterSpray[i][5]);
						return 1;
					}
					if(GetPlayerPCash(playerid) >= 500)
					{
					    GivePlayerPCash(playerid,-500);
					    SendClientMessage(playerid,COLOR_WHITE,"Remember to type /exit to leave.");
					    SetVehiclePos(idcar,EnterSpray[i][3], EnterSpray[i][4], EnterSpray[i][5]);
					    return 1;
					}
    		    }
			}
			if (PlayerToPoint(2.0, playerid,2315.4888,-0.0249,26.7422))
			{
			    GameTextForPlayer(playerid, "~w~Vault", 5000, 1);
				SetPlayerPos(playerid,2310.0803,26.1137,-41.4836);
			}
			else if (PlayerToPoint(2.0, playerid,1524.4868,-1677.7761,6.2188))
			{
				SetPlayerPos(playerid,274.3254,122.1001,1004.6172);
				SetPlayerInterior(playerid,10);
				IntEntered[playerid] = 0;
			}
			else if (PlayerToPoint(8.0, playerid,979.2475,-1256.5812,16.9534))
			{
                SetVehiclePos(idcar,-2723.6589,217.4788,4.4844);
				SetVehicleZAngle(idcar,263.5777);
            }
        }
		return 1;
    }
Reply
#5

Close
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)