Jump to content

[Help] In BankRob


Recommended Posts

Hello Guys I have problem in my BR script!. In Br The Official Gang Start Br Open Doors ... and in zone take money , the people in gang create Br Take Money But the people in Br Criminals and other offiical Gangs not take money! The Money Take All to the people in The Gang Rob Bank The Others not take can help me ?? in put all can take money?

SFbankrobLevel = 0 -- you must be a trusted gang with a level of "number" to start robbing  ( /rm    for admins) 
numberOfPolice = 0 -- PLAYERS THAT HAVE TO BE IN THE POLICETEAM or you cant start hack the doors
criminalTeams = { ["Official Gangs"] = true,["Criminals"] = true}
 
cs1 = createColRectangle(350, 370, 90, 60 ) setElementInterior(cs1, 3)  setElementDimension(cs1, 2)
 
 function SFrespawnOutside()
    local players = getElementsByType("player")
    for i, getOut in pairs (players) do
        if getElementDimension(getOut) == 2 and getElementInterior(getOut) == 3 and isElementWithinColShape(getOut, cs1) then
            local x, y, z = getElementPosition(getOut)
            if z >= 969 and z <= 982 then
                local x = math.random(400,400.5)
                local y = math.random(384,384.5)
                setElementPosition(getOut, x, y, 981.6)
                exports.RPGcommands:sendMessage("*San FierroBank Robbery Reset*", 200,0,0, getOut)
                triggerClientEvent("closeKeyPad", getRootElement(), getOut)
            end
        end
    end
 end
 
function SFstartBankrob()
SFplayerName1 = nil  SFbanktimer = nil       SFbanktimer1 = nil     SFgang = ""
 
if SFDoor1 then destroyElement(SFDoor1) SFDoor1 = nil end
if SFDoor2 then destroyElement(SFDoor2) SFDoor2 = nil end
if SFDoor3 then destroyElement(SFDoor3) SFDoor3 = nil end
 
if SFmarkerDoor1 then   destroyElement(SFmarkerDoor1) SFmarkerDoor1 = nil end
if SFmarkerDoor2 then   destroyElement(SFmarkerDoor2) SFmarkerDoor2 = nil end
if SFmarkerDoor3 then   destroyElement(SFmarkerDoor3) SFmarkerDoor3 = nil end
 
if SFmarkerSafe1 then   destroyElement(SFmarkerSafe1) SFmarkerSafe1 = nil end
if SFmarkerSafe2 then   destroyElement(SFmarkerSafe2) SFmarkerSafe2 = nil end
if SFmarkerSafe3 then   destroyElement(SFmarkerSafe3) SFmarkerSafe3 = nil end
if SFmarkerSafe4 then   destroyElement(SFmarkerSafe4) SFmarkerSafe4 = nil end
if SFmarkerSafe5 then   destroyElement(SFmarkerSafe4) SFmarkerSafe5 = nil end
if SFmarkerSafe6 then   destroyElement(SFmarkerSafe4) SFmarkerSafe6 = nil end
if SFmarkerSafe7 then   destroyElement(SFmarkerSafe4) SFmarkerSafe7 = nil end
if SFmarkerSafe8 then   destroyElement(SFmarkerSafe4) SFmarkerSafe8 = nil end
 
SFDoor1 = createObject(2634, 401, 380.6, 982, 0, 0, 0)  setElementInterior(SFDoor1, 3)  setElementDimension(SFDoor1, 2)
SFDoor2 = createObject(2634, 364.5, 350.70001, 975.70001, 0, 0, 270)        setElementInterior(SFDoor2, 3)  setElementDimension(SFDoor2, 2)
SFDoor3 = createObject(2634, 382.29999, 371.5, 969.59998, 0, 0, 90)     setElementInterior(SFDoor3, 3)  setElementDimension(SFDoor3, 2)
 
SFrespawnOutside()
end
 
function SFstartBankrob2()
SFsecurity1 = 0 SFsecurity2 = 0 SFsecurity3 = 0 SFsecurity4 = 0 SFsecurity5 = 0 SFsecurity6 = 0 SFsecurity7 = 0 SFsecurity8 = 0 SFgang = ""
outputDebugString("new bankrob approved at SAN FIERRO")
    if SFmarkerDoor1 then   destroyElement(SFmarkerDoor1) SFmarkerDoor1 = nil end
    if SFmarkerDoor2 then   destroyElement(SFmarkerDoor2) SFmarkerDoor2 = nil end
    if SFmarkerDoor3 then   destroyElement(SFmarkerDoor3) SFmarkerDoor3 = nil end
 
    if SFmarkerSafe1 then   destroyElement(SFmarkerSafe1) SFmarkerSafe1 = nil end
    if SFmarkerSafe2 then   destroyElement(SFmarkerSafe2) SFmarkerSafe2 = nil end
    if SFmarkerSafe3 then   destroyElement(SFmarkerSafe3) SFmarkerSafe3 = nil end
    if SFmarkerSafe4 then   destroyElement(SFmarkerSafe4) SFmarkerSafe4 = nil end
    if SFmarkerSafe5 then   destroyElement(SFmarkerSafe4) SFmarkerSafe4 = nil end
    if SFmarkerSafe6 then   destroyElement(SFmarkerSafe4) SFmarkerSafe4 = nil end
    if SFmarkerSafe7 then   destroyElement(SFmarkerSafe4) SFmarkerSafe4 = nil end
    if SFmarkerSafe8 then   destroyElement(SFmarkerSafe4) SFmarkerSafe4 = nil end
 
    SFmarkerDoor1 = createMarker(402.02828979492, 381.04418182373,982.73931884766, "arrow", 0.7, 0, 162, 232, 200)  setElementInterior(SFmarkerDoor1, 3)    setElementDimension(SFmarkerDoor1, 2)
    SFmarkerDoor2 = createMarker(366.6608581543,350.06567382813,976, "arrow", 0.7, 0, 162, 232, 200)    setElementInterior(SFmarkerDoor2, 3)    setElementDimension(SFmarkerDoor2, 2)
    SFmarkerDoor3 = createMarker(380.62088012695,399.0364685058,969.6, "arrow", 0.7, 0, 162, 232, 200)  setElementInterior(SFmarkerDoor3, 3)    setElementDimension(SFmarkerDoor3, 2)
 
    SFmarkerSafe1 = createMarker(393.3, 409, 969.6, "arrow", 0.8, 0, 162, 232, 200)     setElementInterior(SFmarkerSafe1, 3)    setElementDimension(SFmarkerSafe1, 2)
    SFmarkerSafe2 = createMarker(393.3, 412.69999694824, 969.6, "arrow", 0.8, 0, 162, 232, 200) setElementInterior(SFmarkerSafe2, 3)    setElementDimension(SFmarkerSafe2, 2)
    SFmarkerSafe3 = createMarker(399.29998779297, 412.5, 969.59997558594, "arrow", 0.8, 0, 162, 232, 200)       setElementInterior(SFmarkerSafe3, 3)    setElementDimension(SFmarkerSafe3, 2)
    SFmarkerSafe4 = createMarker(393.3, 417, 969.6, "arrow", 0.8, 0, 162, 232, 200)     setElementInterior(SFmarkerSafe4, 3)    setElementDimension(SFmarkerSafe4, 2)
    SFmarkerSafe5 = createMarker(393.3, 405.4, 969.6, "arrow", 0.8, 0, 162, 232, 200)       setElementInterior(SFmarkerSafe5, 3)    setElementDimension(SFmarkerSafe5, 2)
    SFmarkerSafe6 = createMarker(399.29998779297, 417, 969.6, "arrow", 0.8, 0, 162, 232, 200)       setElementInterior(SFmarkerSafe6, 3)    setElementDimension(SFmarkerSafe6, 2)
    SFmarkerSafe7 = createMarker(399.29998779297, 409, 969.6, "arrow", 0.8, 0, 162, 232, 200)       setElementInterior(SFmarkerSafe7, 3)    setElementDimension(SFmarkerSafe7, 2)
    SFmarkerSafe8 = createMarker(399.29998779297, 405.4, 969.6, "arrow", 0.8, 0, 162, 232, 200)     setElementInterior(SFmarkerSafe8, 3)    setElementDimension(SFmarkerSafe8, 2)
   
    addEventHandler("onMarkerHit", SFmarkerDoor1, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerDoor2, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerDoor3, SFbankDoorGUI)
 
    addEventHandler("onMarkerHit", SFmarkerSafe1, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerSafe2, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerSafe3, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerSafe4, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerSafe5, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerSafe6, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerSafe7, SFbankDoorGUI)
    addEventHandler("onMarkerHit", SFmarkerSafe8, SFbankDoorGUI)
 
    SFrespawnOutside()
end
 
function SFbankDoorGUI(hitElement, matchingDimension)
    if getElementType(hitElement) == "player" and matchingDimension then
        if criminalTeams[getTeamName(getPlayerTeam(hitElement))] then
            if countPlayersInTeam(getTeamFromName("Police")) + countPlayersInTeam(getTeamFromName("Official Squads")) >= numberOfPolice then
            if source == SFmarkerDoor1 and SFsecurity1 ~= 1 then
                    if criminalTeams[getTeamName(getPlayerTeam(hitElement))] then
                        if SFdisable ~= 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Door1")
                        else
                            outputChatBox("robbing is disabled currently, come back later.", hitElement)
                        end
                    else
                        outputChatBox("Only 'trusted' gangs may rob a bank", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerDoor2 and SFsecurity2 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        --if    SFplayerName1 ~= getPlayerName(hitElement) then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Door2")
                        --else
                            --outputChatBox("You may not disable this System! Search for a second Player!", hitElement, 255, 0, 0)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerDoor3 and SFsecurity3 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                        triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Door3")
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerSafe1 and SFsecurity5 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        if SFsecurity1 == 1 and SFsecurity2 == 1 and SFsecurity3 == 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Safe1")
                        else
                            playername = getPlayerName(hitElement)
                            SFbankWatcher(playername)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerSafe2 and SFsecurity6 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        if SFsecurity1 == 1 and SFsecurity2 == 1 and SFsecurity3 == 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Safe2")
                        else
                            playername = getPlayerName(hitElement)
                            SFbankWatcher(playername)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerSafe3 and SFsecurity7 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        if SFsecurity1 == 1 and SFsecurity2 == 1 and SFsecurity3 == 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Safe3")
                        else
                            playername = getPlayerName(hitElement)
                            SFbankWatcher(playername)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerSafe4 and SFsecurity8 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        if SFsecurity1 == 1 and SFsecurity2 == 1 and SFsecurity3 == 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Safe4")
                        else
                            playername = getPlayerName(hitElement)
                            SFbankWatcher(playername)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerSafe5 and SFsecurity9 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        if SFsecurity1 == 1 and SFsecurity2 == 1 and SFsecurity3 == 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Safe5")
                        else
                            playername = getPlayerName(hitElement)
                            SFbankWatcher(playername)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerSafe6 and SFsecurity10 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        if SFsecurity1 == 1 and SFsecurity2 == 1 and SFsecurity3 == 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Safe6")
                        else
                            playername = getPlayerName(hitElement)
                            SFbankWatcher(playername)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerSafe7 and SFsecurity11 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        if SFsecurity1 == 1 and SFsecurity2 == 1 and SFsecurity3 == 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Safe7")
                        else
                            playername = getPlayerName(hitElement)
                            SFbankWatcher(playername)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
                if source == SFmarkerSafe8 and SFsecurity12 ~= 1 then
                    if SFgang == getElementData(hitElement, "gang") then
                        if SFsecurity1 == 1 and SFsecurity2 == 1 and SFsecurity3 == 1 then
                            local wl = exports.ITWpolice:getWantedLevel(hitElement) local wl = wl + 5  if wl > 36 then wl = 36 end  exports.ITWpolice:setWantedLevel(hitElement, wl)
                            triggerClientEvent("MARKERDOOR", getRootElement(), hitElement, "Safe8")
                        else
                            playername = getPlayerName(hitElement)
                            SFbankWatcher(playername)
                        end
                    else
                        outputChatBox(SFgang.." is currently robbing the bank.", hitElement, 200,0,0)
                    end
                end
            else
                outputChatBox("There are not enough cops on the server/you are not in official gangs. Access denied!",hitElement,255,255,255)
            end
        end
    end
 
function SFbankWatcher(playername)
    local players = getElementsByType("player")
    for i, subAdmin in pairs (players) do
        if exports.ITWacl:isPlayerInGroup(subAdmin, "subadmin") then
            exports.RPGcommands:sendMessage("*Buguser/Cheater AT SF-BANK: " .. playername, 255, 0, 0, subAdmin)
        end
    end
end
 
function SFdisableDoor(doorname)
    if doorname == "Door1" and SFmarkerDoor1 and SFsecurity1 == 0 then
        SFgang =
Link to comment

Sorry i don't undrestand your english. anyways try to remove this line :

if SFgang == getElementData(robber, "gang") then 

should be like this :

function SFshareMoney(robbers) 
    local players = getElementsByType("player") 
    local maxmoney = robbers *  250000 
    local money = math.floor(math.random(maxmoney /2 , maxmoney)) 
    local money = money / robbers 
    for i, robber in pairs (players) do 
        if getElementDimension(robber) == 2 and getElementInterior(robber) == 3 and criminalTeams[getTeamName(getPlayerTeam(robber))] and isPedDead(robber) == false then 
                    exports.RPGcommands:giveMoney(robber, money) 
                    outputChatBox("You received ".. money .. "$ from robbery", robber) 
                    setElementData(robber, "robbedBank", "true", false) 
        end 
    end 
end 

Link to comment

what I meant was , the official gangs when rob the bank the money from the robbery so goes the officiais they did to others so that everyone in the bank will not receive any , criminal and other officiais

Sorry my bad english

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...