Jump to content

assalt-bank- help amount of four or more players to rob


magicplayerc

Recommended Posts

 

function openMyGate (Jogador)
    if isElementWithinMarker(Jogador, markers[1]) then 
        setTimer( function ()
        outputChatBox("" .. getPlayerName(Jogador) .. " #00ff88● #FFFFFFEsta tentando assaltar empresa da BRINKS agora",players,255,255,255,true)
        moveObject ( objetos[1], 2500, 847.20001220703,-1371.5999755859, 22.700000762939 )
        setElementPosition(markers[1], 848.06927490234 - 0.2, -1374.2985839844, 3000)
        destroyElement(markers[1], root, false)
            setTimer( function ()
                ped1 = exports [ "slothBot" ]:spawnBot (830.59997558594, -1372, 25, 268, 163, 0, 0, nil , 38,  "guarding"  ) ---guarda parede 1
                setTimer(function() exports ["slothbot"]:setBotAttackEnabled(ped1, true) end, 100, 1)
                setTimer( function ()    
                ped2 = exports [ "slothBot" ]:spawnBot (830.59997558594, -1367, 25, 262, 164, 0, 0, nil , 31,  "guarding"  )--- guarda parede 2
                setTimer(function() exports ["slothbot"]:setBotAttackEnabled(ped2, true) end, 100, 1)
                setTimer( function ()    
                ped3 = exports [ "slothBot" ]:spawnBot (832.90002441406, -1364, 25, 180, 165, 0, 0, nil , 27, "guarding"  )---guarda cliente 1
                setTimer(function() exports ["slothbot"]:setBotAttackEnabled(ped3, true) end, 100, 1)
                setTimer( function ()    
                ped4 = exports [ "slothBot" ]:spawnBot (838, -1363.9000244141, 25, 180, 166, 0, 0, nil , 31, "guarding"  ) ---guarda client 2
                setTimer(function() exports ["slothbot"]:setBotAttackEnabled(ped4, true) end, 250, 1)    
                ped9 = exports [ "slothBot" ]:spawnBot (843.29998779297, -1363.8000488281, 25, 186, 163, 0, 0, nil , 38, "guarding"  ) ---guarda cliente 3
                setTimer(function() exports ["slothbot"]:setBotAttackEnabled(ped9, true) end, 100, 1)        
                ped10 = exports [ "slothBot" ]:spawnBot (830.40002441406, -1375, 25, 262, 164, 0, 0, nil , 27, "guarding"  ) ---guarda 1 parede gerente
                setTimer(function() exports ["slothbot"]:setBotAttackEnabled(ped10, true) end, 100, 1)
                ped11 = exports [ "slothBot" ]:spawnBot (830.5, -1383, 25, 286, 165, 0, 0, nil , 31, "guarding"  ) ---guarda 2 parede gerente
                setTimer(function() exports ["slothbot"]:setBotAttackEnabled(ped11, true) end, 100, 1)
                end, 200, 1)
                end, 200, 1)
                end, 200, 1)
            end, 200, 1)
        end,4502, 1)
        setPedRotation(Jogador, 87.794250488281)
        setElementPosition(Jogador, 847.806640625, -1374.2625732422, 22.59531211853)
        setPedAnimation(Jogador, "KISSING", "GF_CarSpot", 4500, false, false, false, false)
        setTimer( function ()
            triggerEvent(eventorestart, root)
        end, 1000, 1)
    end
 end
 addCommandHandler("arrombar",openMyGate)

Edited by magicplayerc
Link to comment

MSHAyJ3.png

Use code blocks next time, please. And give some more details at what you mean to achieve. The title doesn't go into enough detail to get help - what should qualify four players? Four players online? Four players in proximity? Four players of a specific team? Four players of a specific team within proximity? And then, what should happen when there isn't four players? Should it continue if it started with four, or should it end abruptly? Et cetera. A lot of unanswered questions.

 

The following code is reformatted to be more readable and has whitespace corrections that were bugging me, but behaviour-wise, it is unchanged.

function openMyGate(Jogador)
  if isElementWithinMarker(Jogador, markers[1]) then
    setTimer(function()
        outputChatBox(getPlayerName(Jogador).." #00ff88● #FFFFFFEsta tentando assaltar empresa da BRINKS agora", players, 255, 255, 255, true)
        moveObject(objetos[1], 2500, 847.20001220703, -1371.5999755859, 22.700000762939)
        setElementPosition(markers[1], 848.06927490234-0.2, -1374.2985839844, 3000)
        destroyElement(markers[1], root, false)

        setTimer(function() -- wait 4502ms
            ped1 = exports["slothBot"]:spawnBot(830.59997558594, -1372, 25, 268, 163, 0, 0, nil , 38, "guarding") -- guarda parede 1
            setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped1, true) end, 100, 1)

            setTimer( function () -- wait 200ms
                ped2 = exports["slothBot"]:spawnBot(830.59997558594, -1367, 25, 262, 164, 0, 0, nil , 31, "guarding")-- guarda parede 2
                setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped2, true) end, 100, 1)

                setTimer(function() -- wait 200ms
                    ped3 = exports["slothBot"]:spawnBot(832.90002441406, -1364, 25, 180, 165, 0, 0, nil , 27, "guarding") -- guarda cliente 1
                    setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped3, true) end, 100, 1)

                    setTimer(function() -- wait 200ms
                        ped4 = exports["slothBot"]:spawnBot(838, -1363.9000244141, 25, 180, 166, 0, 0, nil, 31, "guarding") -- guarda client 2
                        setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped4, true) end, 250, 1)

                        ped9 = exports["slothBot"]:spawnBot(843.29998779297, -1363.8000488281, 25, 186, 163, 0, 0, nil , 38, "guarding") -- guarda cliente 3
                        setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped9, true) end, 100, 1)

                        ped10 = exports["slothBot"]:spawnBot(830.40002441406, -1375, 25, 262, 164, 0, 0, nil, 27, "guarding") -- guarda 1 parede gerente
                        setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped10, true) end, 100, 1)

                        ped11 = exports["slothBot"]:spawnBot(830.5, -1383, 25, 286, 165, 0, 0, nil, 31, "guarding") -- guarda 2 parede gerente
                        setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped11, true) end, 100, 1)
                      end, 200, 1)
                  end, 200, 1)
              end, 200, 1)
          end, 200, 1)
      end, 4502, 1)

    setPedRotation(Jogador, 87.794250488281)
    setElementPosition(Jogador, 847.806640625, -1374.2625732422, 22.59531211853)
    setPedAnimation(Jogador, "KISSING", "GF_CarSpot", 4500, false, false, false, false)
    setTimer(function() -- wait 1000ms
        triggerEvent(eventorestart, root)
      end, 1000, 1)
  end
end
addCommandHandler("arrombar", openMyGate)

 

Edited by MrTasty
Link to comment
local colArea 	= createColRectangle(-2171.0678710938, 678.17950439453, 15, 15)
local radarArea = createRadarArea(-2183.5678710938, 705.67950439453, 40, -40, 0, 255, 0, 175)
local hitArea = 0
local playerData = {
	joinArea = {},
}

function areaEnter(thePlayer, matchingDimension)
	if (getElementType(thePlayer) == "player") then
		if hitArea < 4 then
			hitArea = hitArea + 1
			playerData.joinArea[thePlayer] = true
		else
			outputChatBox("#FFAA00*Atenção: #FFFFFFJá possui 4 assaltantes na empresa.")
			setElementPosition(thePlayer, 0, 0, 0)
		end
	end
end
addEventHandler("onColShapeHit", colArea, areaEnter)

function areaExit(thePlayer, matchingDimension)
	if (getElementType(thePlayer) == "player") then
		if playerData.joinArea[thePlayer] then
			playerData.joinArea[thePlayer] = nil
			
			if hitArea > 0 then
				hitArea = hitArea - 1
			end
		end
	end
end
addEventHandler("onColShapeLeave", colArea, areaExit)

function openMyGate(Jogador)
	if hitArea >= 4 then
		if isElementWithinMarker(Jogador, markers[1]) then
			setTimer(function()
				outputChatBox(getPlayerName(Jogador).." #00ff88● #FFFFFFEsta tentando assaltar empresa da BRINKS agora", players, 255, 255, 255, true)
				moveObject(objetos[1], 2500, 847.20001220703, -1371.5999755859, 22.700000762939)
				setElementPosition(markers[1], 848.06927490234-0.2, -1374.2985839844, 3000)
				destroyElement(markers[1], root, false)

				setTimer(function() -- wait 4502ms
					ped1 = exports["slothBot"]:spawnBot(830.59997558594, -1372, 25, 268, 163, 0, 0, nil , 38, "guarding") -- guarda parede 1
					setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped1, true) end, 100, 1)

					setTimer( function () -- wait 200ms
						ped2 = exports["slothBot"]:spawnBot(830.59997558594, -1367, 25, 262, 164, 0, 0, nil , 31, "guarding")-- guarda parede 2
						setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped2, true) end, 100, 1)

						setTimer(function() -- wait 200ms
							ped3 = exports["slothBot"]:spawnBot(832.90002441406, -1364, 25, 180, 165, 0, 0, nil , 27, "guarding") -- guarda cliente 1
							setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped3, true) end, 100, 1)

							setTimer(function() -- wait 200ms
								ped4 = exports["slothBot"]:spawnBot(838, -1363.9000244141, 25, 180, 166, 0, 0, nil, 31, "guarding") -- guarda client 2
								setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped4, true) end, 250, 1)

								ped9 = exports["slothBot"]:spawnBot(843.29998779297, -1363.8000488281, 25, 186, 163, 0, 0, nil , 38, "guarding") -- guarda cliente 3
								setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped9, true) end, 100, 1)

								ped10 = exports["slothBot"]:spawnBot(830.40002441406, -1375, 25, 262, 164, 0, 0, nil, 27, "guarding") -- guarda 1 parede gerente
								setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped10, true) end, 100, 1)

								ped11 = exports["slothBot"]:spawnBot(830.5, -1383, 25, 286, 165, 0, 0, nil, 31, "guarding") -- guarda 2 parede gerente
								setTimer(function() exports["slothbot"]:setBotAttackEnabled(ped11, true) end, 100, 1)
							end, 200, 1)
						end, 200, 1)
					end, 200, 1)
				end, 200, 1)
			end, 4502, 1)

			setPedRotation(Jogador, 87.794250488281)
			setElementPosition(Jogador, 847.806640625, -1374.2625732422, 22.59531211853)
			setPedAnimation(Jogador, "KISSING", "GF_CarSpot", 4500, false, false, false, false)

			setTimer(function() -- wait 1000ms
				triggerEvent(eventorestart, root)
				hitArea = 0
				playerData = nil
			end, 1000, 1)
		end
	else
		outputChatBox("#FF5050*Erro: #FFFFFFPrecisa de 4 Jogadores para arrombar.")
	end
end
addCommandHandler("arrombar", openMyGate)

Seja bem vindo, brother!

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...