Help with command
#1

I want to put this:
Код:
if(IsPlayerInRangeOfPoint(playerid,3.0,2305.5840,-16.0986,26.7496)) //Bank
			{
			    SetPlayerInterior(playerid, 0);
			    SetPlayerPos(playerid, -179.5009,1133.0728,19.7422);
			    SetPlayerVirtualWorld(playerid, 0);
			}
To here:

Код:
CMD:exit(playerid, params[])
{
	new done, 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(!done && IsPlayerInRangeOfPoint(playerid, 2, DoorInfo[idx][dIX], DoorInfo[idx][dIY], DoorInfo[idx][dIZ]) && GetPlayerVirtualWorld(playerid) == DoorInfo[idx][dIVW] && GetPlayerInterior(playerid) == DoorInfo[idx][dIInt])
	    {
	        if(BankRobber[playerid] && BankBlock && GetPlayerInterior(playerid) == 83 && GetPlayerVirtualWorld(playerid) == 8473)
	        {
	       	    new Rob = BankRobber[playerid]-1;
			    DisablePlayerCheckpoint(playerid);
				BankRobbersCount --;
				format(BankRobbers[Rob], MAX_PLAYER_NAME, "");
				DeliverMoney[playerid] = 0;
				//
				foreach(Player, i)
				{
				    if(BankRobber[i] || PlayerInfo[i][pFac] == 1)
				    {
						if(Rob == 0) TextDrawHideForPlayer(i, Textdraw1);
						else if(Rob == 1) TextDrawHideForPlayer(i, Textdraw2);
						else if(Rob == 2) TextDrawHideForPlayer(i, Textdraw3);
						else if(Rob == 3) TextDrawHideForPlayer(i, Textdraw4);
						else if(Rob == 4) TextDrawHideForPlayer(i, Textdraw5);
					}
				}
				format(string, sizeof(string), "** %s has went out of the bank before loading money and has failed the robbery. **", RPN(playerid));
				SendRobberyMessage(COLOR_LIGHTRED, string);
				SendCopMessage(COLOR_LIGHTRED, string);
				SendFBIMessage(COLOR_LIGHTRED, string);
				BankRobber[playerid] = 0;
				if(BankRobbersCount == 0)
				{
					TextDrawHideForAll(Area5);
					TextDrawHideForAll(Textdraw1);
					TextDrawHideForAll(Textdraw2);
					TextDrawHideForAll(Textdraw3);
					TextDrawHideForAll(Textdraw4);
					TextDrawHideForAll(Textdraw5);
					BankRobbery = 0;
					RobberyStarted = 0;
					format(string, sizeof(string), "** The bank robbery has ended, $%d were stolen and $%d were saved. **", TotalStolen*50000, (TotalRobbers*50000-(TotalStolen*50000)));
					SendClientMessageToAll(COLOR_YELLOW, string);
					TotalRobbers = 0;
					new copsonline;
					foreach(Player, i)
					{
					    if(IsACop(i)) copsonline++;
					    if(IsASheriff(i)) copsonline++;
					    if(IsAFBI(i)) copsonline++;
					}
					foreach(Player, i)
					{
					    if(IsACop(i))
					    {
							new Saved = (TotalRobbers*50000-(TotalStolen*50000));
							GiveZaiatMoney(i, Saved/copsonline);
							format(string, sizeof(string), "** You have received your cut from the saved money. ($%d)", Saved/copsonline);
							SendClientMessage(i, COLOR_LIME, string);
					    }
					}
				}
	            return 1;
	        }
	        if(DoorInfo[idx][dCExt])
	        {
	            GameTextForPlayer(playerid, "~w~Loading Objects", 3500, 3);
				TogglePlayerControllable(playerid, 0);
	            SetTimerEx("EnterExitTimer", 5000, false, "i", playerid);
	            PlayerInfo[playerid][pSpawnFreeze] = 1;
	        }
	        PlayerInfo[playerid][pSpawnFreeze] = 0;
	        SetPlayerInterior(playerid, DoorInfo[idx][dOInt]);
	        SetPlayerVirtualWorld(playerid, DoorInfo[idx][dOVW]);
	        SetPlayerFacingAngle(playerid, DoorInfo[idx][dOA]);
	        SetCameraBehindPlayer(playerid);
	        SetPlayerPos(playerid, DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ]);
	        done = 1;
	    }
	}
	if(IsPlayerInRangeOfPoint(playerid, 2, 243.9951,304.9418,999.1484) || IsPlayerInRangeOfPoint(playerid, 2, 2259.6702,-1135.8542,1050.6328) || IsPlayerInRangeOfPoint(playerid, 2, 2308.8254,-1212.8070,1049.0234) || IsPlayerInRangeOfPoint(playerid, 2, 260.7436,1237.5563,1084.2578)
	|| IsPlayerInRangeOfPoint(playerid, 2, -42.5742,1405.6521,1084.4297) || IsPlayerInRangeOfPoint(playerid, 2, 2468.6787,-1698.2617,1013.5078) || IsPlayerInRangeOfPoint(playerid, 2, 2365.2183,-1135.4014,1050.8750) || IsPlayerInRangeOfPoint(playerid, 2, 2270.1270,-1210.4855,1047.5625)
	|| IsPlayerInRangeOfPoint(playerid, 2, 2324.4424,-1149.2057,1050.7101) || IsPlayerInRangeOfPoint(playerid, 2, 83.0863,1322.3020,1083.8662) ||  IsPlayerInRangeOfPoint(playerid, 2, 1327.1052,-1071.0226,3458.9060)) // Houses
	{
	    new idx;
		idx = GetPlayerVirtualWorld(playerid)-500;
		if(!done && idx < MAX_HOUSES && HouseInfo[idx][hLevel])
		{
			format(string, sizeof(string), "* %s pushes the door and exits the house.", RPN(playerid));
		 	if(PlayerInfo[playerid][pMaskOn] == 1)
			{
		        format(string, sizeof(string), "* Stranger pushes the door and exits the house.");
			}
			else
			{
				format(string, sizeof(string), "* %s pushes the door and exits the house.", RPN(playerid));
			}
			SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	        SetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
	        SetPlayerInterior(playerid, 0);
	        SetPlayerVirtualWorld(playerid, 0);
	        done = 1;
        }
	}
	if(IsPlayerInRangeOfPoint(playerid, 15, -2070.3000488281,-24,47.099998474121)) // Garages
    {
        new idx;
        idx = GetPlayerVirtualWorld(playerid)-500;
        new vehicleid = GetPlayerVehicleID(playerid);
        if(!done && idx < MAX_GARAGES && GarageInfo[idx][gLevel])
		{
			format(string, sizeof(string), "* %s lifts the door up and exits the garage.", RPN(playerid));
			SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			//if(IsPlayerInAnyVehicle(playerid))
			{
			    SetVehiclePos(vehicleid, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]);
		        SetCameraBehindPlayer(playerid);
		        SetVehicleVirtualWorld(vehicleid, 0);
		        SetPlayerPos(playerid, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]);
			    SetPlayerInterior(playerid, 0);
			    SetCameraBehindPlayer(playerid);
			    SetPlayerVirtualWorld(playerid, 0);
			    PutPlayerInVehicle(playerid, vehicleid, 0);
			}
			else
			{
			    SetPlayerPos(playerid, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]);
			    SetPlayerInterior(playerid, 0);
			    SetCameraBehindPlayer(playerid);
			    SetPlayerVirtualWorld(playerid, 0);
			}
	        done = 1;
        }
	}
    if(IsPlayerInRangeOfPoint(playerid, 5, 2233.8032,1712.2303,1011.7632) || IsPlayerInRangeOfPoint(playerid, 2, -27.3025,-57.6649,1003.5469) || IsPlayerInRangeOfPoint(playerid, 2, 207.0638,-139.9965,1003.5078) || IsPlayerInRangeOfPoint(playerid, 2, 285.8044,-85.9956,1001.5229) || IsPlayerInRangeOfPoint(playerid, 2, 493.4252,-24.3061,1000.6797) || IsPlayerInRangeOfPoint(playerid, 2, 834.1631,7.4883,1004.1797) || IsPlayerInRangeOfPoint(playerid, 2, 372.3830,-133.2579,1001.4922))
	{
	    new idx;
		idx = GetPlayerVirtualWorld(playerid)-100;
		if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
		{
			if(BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ])
			{
				idx = GetPlayerVirtualWorld(playerid)-100;
				if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
				{
					if (g_remainingRobTicks[playerid])
					{
						SendClientMessage(playerid, COLOR_GREY, "You failed the robbery.");
						DestroyObject(g_robbizBag[playerid]);
						DisablePlayerCheckpoint(playerid);
						g_apprehendedCash[playerid] = 0;
						g_remainingRobTicks[playerid] = 0;
						g_bIsRobbiz[playerid] = false;
						SendCopMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
						SendFBIMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
						SendHSFMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
						SendSheriffMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
						SendSATFMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
					}
					SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
					SetPlayerInterior(playerid, 0);
					SetPlayerVirtualWorld(playerid, 0);
				}
				done = 1;
				return 1;
			}
			format(string, sizeof(string), "* %s pushes the door and exits the shop.", RPN(playerid));
 		 	if(PlayerInfo[playerid][pMaskOn] == 1)
			{
		        format(string, sizeof(string), "* Stranger pushes the door and exits the shop.");
			}
			else
			{
				format(string, sizeof(string), "* %s pushes the door and exits the shop.", RPN(playerid));
			}
			SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	        SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
	        SetPlayerInterior(playerid, 0);
	        SetPlayerVirtualWorld(playerid, 0);
        }
        done = 1;
	}
	return 1;
}
Reply
#2

Something like this but you need to position these in the editor. I think it should work if you position them. Lookout for the "{ and }" , if one of these is not correctly placed the whole script is gonna return errors.

pawn Код:
CMD:exit(playerid, params[])
{
    new done, 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(!done && IsPlayerInRangeOfPoint(playerid, 2, DoorInfo[idx][dIX], DoorInfo[idx][dIY], DoorInfo[idx][dIZ]) && GetPlayerVirtualWorld(playerid) == DoorInfo[idx][dIVW] && GetPlayerInterior(playerid) == DoorInfo[idx][dIInt])
            if(IsPlayerInRangeOfPoint(playerid,3.0,2305.5840,-16.0986,26.7496)) //Bank
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, -179.5009,1133.0728,19.7422);
                SetPlayerVirtualWorld(playerid, 0);
            }
        {
            if(BankRobber[playerid] && BankBlock && GetPlayerInterior(playerid) == 83 && GetPlayerVirtualWorld(playerid) == 8473)
            {
                new Rob = BankRobber[playerid]-1;
                DisablePlayerCheckpoint(playerid);
                BankRobbersCount --;
                format(BankRobbers[Rob], MAX_PLAYER_NAME, "");
                DeliverMoney[playerid] = 0;
                //
                foreach(Player, i)
                {
                    if(BankRobber[i] || PlayerInfo[i][pFac] == 1)
                    {
                        if(Rob == 0) TextDrawHideForPlayer(i, Textdraw1);
                        else if(Rob == 1) TextDrawHideForPlayer(i, Textdraw2);
                        else if(Rob == 2) TextDrawHideForPlayer(i, Textdraw3);
                        else if(Rob == 3) TextDrawHideForPlayer(i, Textdraw4);
                        else if(Rob == 4) TextDrawHideForPlayer(i, Textdraw5);
                    }
                }
                format(string, sizeof(string), "** %s has went out of the bank before loading money and has failed the robbery. **", RPN(playerid));
                SendRobberyMessage(COLOR_LIGHTRED, string);
                SendCopMessage(COLOR_LIGHTRED, string);
                SendFBIMessage(COLOR_LIGHTRED, string);
                BankRobber[playerid] = 0;
                if(BankRobbersCount == 0)
                {
                    TextDrawHideForAll(Area5);
                    TextDrawHideForAll(Textdraw1);
                    TextDrawHideForAll(Textdraw2);
                    TextDrawHideForAll(Textdraw3);
                    TextDrawHideForAll(Textdraw4);
                    TextDrawHideForAll(Textdraw5);
                    BankRobbery = 0;
                    RobberyStarted = 0;
                    format(string, sizeof(string), "** The bank robbery has ended, $%d were stolen and $%d were saved. **", TotalStolen*50000, (TotalRobbers*50000-(TotalStolen*50000)));
                    SendClientMessageToAll(COLOR_YELLOW, string);
                    TotalRobbers = 0;
                    new copsonline;
                    foreach(Player, i)
                    {
                        if(IsACop(i)) copsonline++;
                        if(IsASheriff(i)) copsonline++;
                        if(IsAFBI(i)) copsonline++;
                    }
                    foreach(Player, i)
                    {
                        if(IsACop(i))
                        {
                            new Saved = (TotalRobbers*50000-(TotalStolen*50000));
                            GiveZaiatMoney(i, Saved/copsonline);
                            format(string, sizeof(string), "** You have received your cut from the saved money. ($%d)", Saved/copsonline);
                            SendClientMessage(i, COLOR_LIME, string);
                        }
                    }
                }
                return 1;
            }
            if(DoorInfo[idx][dCExt])
            {
                GameTextForPlayer(playerid, "~w~Loading Objects", 3500, 3);
                TogglePlayerControllable(playerid, 0);
                SetTimerEx("EnterExitTimer", 5000, false, "i", playerid);
                PlayerInfo[playerid][pSpawnFreeze] = 1;
            }
            PlayerInfo[playerid][pSpawnFreeze] = 0;
            SetPlayerInterior(playerid, DoorInfo[idx][dOInt]);
            SetPlayerVirtualWorld(playerid, DoorInfo[idx][dOVW]);
            SetPlayerFacingAngle(playerid, DoorInfo[idx][dOA]);
            SetCameraBehindPlayer(playerid);
            SetPlayerPos(playerid, DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ]);
            done = 1;
        }
    }
    if(IsPlayerInRangeOfPoint(playerid, 2, 243.9951,304.9418,999.1484) || IsPlayerInRangeOfPoint(playerid, 2, 2259.6702,-1135.8542,1050.6328) || IsPlayerInRangeOfPoint(playerid, 2, 2308.8254,-1212.8070,1049.0234) || IsPlayerInRangeOfPoint(playerid, 2, 260.7436,1237.5563,1084.2578)
    || IsPlayerInRangeOfPoint(playerid, 2, -42.5742,1405.6521,1084.4297) || IsPlayerInRangeOfPoint(playerid, 2, 2468.6787,-1698.2617,1013.5078) || IsPlayerInRangeOfPoint(playerid, 2, 2365.2183,-1135.4014,1050.8750) || IsPlayerInRangeOfPoint(playerid, 2, 2270.1270,-1210.4855,1047.5625)
    || IsPlayerInRangeOfPoint(playerid, 2, 2324.4424,-1149.2057,1050.7101) || IsPlayerInRangeOfPoint(playerid, 2, 83.0863,1322.3020,1083.8662) ||  IsPlayerInRangeOfPoint(playerid, 2, 1327.1052,-1071.0226,3458.9060)) // Houses
    {
        new idx;
        idx = GetPlayerVirtualWorld(playerid)-500;
        if(!done && idx < MAX_HOUSES && HouseInfo[idx][hLevel])
        {
            format(string, sizeof(string), "* %s pushes the door and exits the house.", RPN(playerid));
            if(PlayerInfo[playerid][pMaskOn] == 1)
            {
                format(string, sizeof(string), "* Stranger pushes the door and exits the house.");
            }
            else
            {
                format(string, sizeof(string), "* %s pushes the door and exits the house.", RPN(playerid));
            }
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            SetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            done = 1;
        }
    }
    if(IsPlayerInRangeOfPoint(playerid, 15, -2070.3000488281,-24,47.099998474121)) // Garages
    {
        new idx;
        idx = GetPlayerVirtualWorld(playerid)-500;
        new vehicleid = GetPlayerVehicleID(playerid);
        if(!done && idx < MAX_GARAGES && GarageInfo[idx][gLevel])
        {
            format(string, sizeof(string), "* %s lifts the door up and exits the garage.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            //if(IsPlayerInAnyVehicle(playerid))
            {
                SetVehiclePos(vehicleid, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]);
                SetCameraBehindPlayer(playerid);
                SetVehicleVirtualWorld(vehicleid, 0);
                SetPlayerPos(playerid, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]);
                SetPlayerInterior(playerid, 0);
                SetCameraBehindPlayer(playerid);
                SetPlayerVirtualWorld(playerid, 0);
                PutPlayerInVehicle(playerid, vehicleid, 0);
            }
            else
            {
                SetPlayerPos(playerid, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]);
                SetPlayerInterior(playerid, 0);
                SetCameraBehindPlayer(playerid);
                SetPlayerVirtualWorld(playerid, 0);
            }
            done = 1;
        }
    }
    if(IsPlayerInRangeOfPoint(playerid, 5, 2233.8032,1712.2303,1011.7632) || IsPlayerInRangeOfPoint(playerid, 2, -27.3025,-57.6649,1003.5469) || IsPlayerInRangeOfPoint(playerid, 2, 207.0638,-139.9965,1003.5078) || IsPlayerInRangeOfPoint(playerid, 2, 285.8044,-85.9956,1001.5229) || IsPlayerInRangeOfPoint(playerid, 2, 493.4252,-24.3061,1000.6797) || IsPlayerInRangeOfPoint(playerid, 2, 834.1631,7.4883,1004.1797) || IsPlayerInRangeOfPoint(playerid, 2, 372.3830,-133.2579,1001.4922))
    {
        new idx;
        idx = GetPlayerVirtualWorld(playerid)-100;
        if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
        {
            if(BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ])
            {
                idx = GetPlayerVirtualWorld(playerid)-100;
                if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
                {
                    if (g_remainingRobTicks[playerid])
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You failed the robbery.");
                        DestroyObject(g_robbizBag[playerid]);
                        DisablePlayerCheckpoint(playerid);
                        g_apprehendedCash[playerid] = 0;
                        g_remainingRobTicks[playerid] = 0;
                        g_bIsRobbiz[playerid] = false;
                        SendCopMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
                        SendFBIMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
                        SendHSFMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
                        SendSheriffMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
                        SendSATFMessage(COLOR_BLUE, "The business robbery has been failed, Back to normal duties");
                    }
                    SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
                    SetPlayerInterior(playerid, 0);
                    SetPlayerVirtualWorld(playerid, 0);
                }
                done = 1;
                return 1;
            }
            format(string, sizeof(string), "* %s pushes the door and exits the shop.", RPN(playerid));
            if(PlayerInfo[playerid][pMaskOn] == 1)
            {
                format(string, sizeof(string), "* Stranger pushes the door and exits the shop.");
            }
            else
            {
                format(string, sizeof(string), "* %s pushes the door and exits the shop.", RPN(playerid));
            }
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
        }
        done = 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)