Jump to content

Slothbot Problem


Matiiaas97

Recommended Posts

  • 2 weeks later...
I downloaded the resource bodyguard with the Slothbot also. The resource works very good but the aim of the bots is too bad. I want to know how can i fix this problem.

I have saw this slothbot resource, and i have read its code. He added some delay to the aiming of his bot to be realistic, maybe he added too much delay so now it's bad. So try to reduce the delay and see if it works. I have made my own bot without delay, and it aims perfectly.

Link to comment
I downloaded the resource bodyguard with the Slothbot also. The resource works very good but the aim of the bots is too bad. I want to know how can i fix this problem.

I have saw this slothbot resource, and i have read its code. He added some delay to the aiming of his bot to be realistic, maybe he added too much delay so now it's bad. So try to reduce the delay and see if it works. I have made my own bot without delay, and it aims perfectly.

Thanks you, but how can i reduce the delay ? I know about scripts but i'm not a expert

Link to comment
I downloaded the resource bodyguard with the Slothbot also. The resource works very good but the aim of the bots is too bad. I want to know how can i fix this problem.

I have saw this slothbot resource, and i have read its code. He added some delay to the aiming of his bot to be realistic, maybe he added too much delay so now it's bad. So try to reduce the delay and see if it works. I have made my own bot without delay, and it aims perfectly.

Thanks you, but how can i reduce the delay ? I know about scripts but i'm not a expert

I think he have put explanation in the script, try to find the line "put a little delay to be realistic"

Link to comment
I downloaded the resource bodyguard with the Slothbot also. The resource works very good but the aim of the bots is too bad. I want to know how can i fix this problem.

Please somebody answer to my question. I don't find the word: "Delay" in the script, What line must i change to the bot don't fail the shots ?

Link to comment
I downloaded the resource bodyguard with the Slothbot also. The resource works very good but the aim of the bots is too bad. I want to know how can i fix this problem.

Here is a part of the script but i don't know what line must i change and how.

--CLIENT STUFF 
 
--detects when a bot changes status and starts the new behaviour
function changestatus (dataName)
    if getElementType ( source ) == "ped" and dataName == "status" and (getElementData (source, "slothbot") == true) then
        if (getElementData ( source, "status" ) == "chasing" ) then
            local player = getElementData ( source, "target" )
            local oldTx, oldTy, oldTz = getElementPosition( player )
            local oldPx, oldPy, oldPz = getElementPosition( source )
            setTimer ( chase_aim, 80, 1, source)
            setTimer ( chase_move, 700, 1, source, oldTx, oldTy, oldTz, oldPx, oldPy, oldPz )
            setTimer ( chase_shoot, 1500, 1, source )
        elseif (getElementData ( source, "status" ) == "hunting" ) then
            local oldPx, oldPy, oldPz = getElementPosition( source )
            setTimer ( enemy_check, 600 ,1 , source )-- starts scanning for enemies
            setTimer ( hunt_move, 800, 1, source, oldPx, oldPy, oldPz, oldPx, oldPy, oldPz )
        elseif (getElementData ( source, "status" ) == "following" ) then
            local player = getElementData ( source, "leader" )
            local oldTx, oldTy, oldTz = getElementPosition( player )
            local oldPx, oldPy, oldPz = getElementPosition( source )
            setTimer ( follow_enemy_check, 500 ,1 , source )
            setTimer ( follow_move, 800, 1, source, oldPx, oldPy, oldPz, oldPx, oldPy, oldPz )
        elseif (getElementData ( source, "status" ) == "waiting" ) then 
            setTimer ( wait_enemy_check, 500 ,1 , source )
        elseif (getElementData ( source, "status" ) == "guarding" ) then
            setTimer ( guard_enemy_check, 800 ,1 , source )-- starts scanning for enemies
            setTimer ( guard_move, 400 ,1 , source )
        end
    end
end
addEventHandler( "onClientElementDataChange", getRootElement(), changestatus )
 
--keeps the bot's aim slightly lagged
function chase_aim(ped)
    if (isElement(ped)) then
        local player = getElementData ( ped, "target" )
        if (getElementData ( ped, "status" ) ==  "chasing" ) and (isElement(player)) and (getElementData (ped, "slothbot") == true) then
            if getElementType(player) == "player" then
                local pedhp = getElementHealth ( ped )
                if pedhp > 0 and (isPlayerDead(player) == false) then
                    local x,y,z = getElementPosition( player )
                    local ex,ey,ez = getElementPosition( ped )
                    local isclear = isLineOfSightClear (ex, ey, ez+.6, x, y, z+.6, true, false, false, true, false, false, false)
                    if (isclear == true) then -- if the player target is in sight
                        if isPedDucked(player) then
                            setPedAimTarget ( ped, x, y, z-.5 )
                        else
                            setPedAimTarget ( ped, x, y, z )
                        end
                    end
                    setTimer ( chase_aim, 80, 1, ped, player )
                end
            elseif getElementType(player) == "ped" then
                local pedhp = getElementHealth ( ped )
                if pedhp > 0 and (getElementHealth(player) > 0) then
                    local x,y,z = getElementPosition( player )
                    local ex,ey,ez = getElementPosition( ped )
                    local isclear = isLineOfSightClear (ex, ey, ez+.6, x, y, z+.6, true, false, false, true, false, false, false)
                    if (isclear == true) then -- if the player target is in sight
                        if isPedDucked(player) then
                            setPedAimTarget ( ped, x, y, z-.5 )
                        else
                            setPedAimTarget ( ped, x, y, z )
                        end
                    end
                    setTimer ( chase_aim, 80, 1, ped, player )
                end
            end
        end
    end
end
 
--bot behaviour while in chase mode
function chase_move (ped, oldTx, oldTy, oldTz, oldPx, oldPy, oldPz)
    if (isElement(ped)) then
        local thetarget = getElementData ( ped, "target" )
        if (getElementData ( ped, "status" ) ==  "chasing" ) and (isElement(thetarget)) and (getElementData (ped, "slothbot") == true) then
            local pedhp = getElementHealth ( ped )
            local tarhp = getElementHealth ( thetarget )
            if pedhp > 0 and tarhp > 0 then
                local tx,ty,tz = getElementPosition( thetarget )
                local px,py,pz = getElementPosition( ped )
                local isclear = isLineOfSightClear (px, py, pz+.6, tx, ty, tz+.6, true, false, false, true, false, false, false)
                local angle = ( 360 - math.deg ( math.atan2 ( ( tx - px ), ( ty - py ) ) ) ) % 360 --set the peds angle to the target
                setPedRotation( ped, angle )
                if (isclear == true) then -- if the ped can see the target
                    local angle = ( 360 - math.deg ( math.atan2 ( ( tx - px ), ( ty - py ) ) ) ) % 360 --set the peds angle to the target
                    setPedRotation( ped, angle )
                    setElementData ( ped, "seestarget", true )
                    setTimer ( chase_move, 700, 1, ped, tx, ty, tz, px, py, pz)
                else
                    local angle = ( 360 - math.deg ( math.atan2 ( ( oldTx - px ), ( oldTy - py ) ) ) ) % 360 --set the peds angle to the target
                    setPedRotation( ped, angle )
                    setElementData ( ped, "seestarget", false )
                    setTimer ( chase_move, 700, 1, ped, oldTx, oldTy, oldTz, px, py, pz)
                end
            end
        end
    end
end
 
--tells the bot when to fire its gun. (only run by the peds controller)
function chase_shoot(ped)
    if (isElement(ped)) then
        local player = getElementData ( ped, "target" )
        if (isElement(player)) and (getElementData (ped, "slothbot") == true) then
            if (getElementType(player) == "ped") or (getElementType(player) == "player") then
                if (getElementData ( ped, "status" ) == "chasing" ) and (isElement(player)) then
                    if (getElementHealth(ped)>0) and (getElementHealth(player)>0) and (getElementData ( ped, "controller" ) == getLocalPlayer()) then
                        local x,y,z = getElementPosition( player )
                        local ex,ey,ez = getElementPosition( ped )
                        local isclear = isLineOfSightClear (ex, ey, ez+1, x, y, z+1, true, false, false, true, false, false, false)
                        if isclear == true then -- if the ped can see the local player
                            local distance = (getDistanceBetweenPoints3D (ex, ey, ez, x, y, z))
                            if (getPedWeapon(ped) < 19)  and (getPedWeapon(ped) ~= 9) then -- if its a melee weapon hat isnt a chainsaw
                                if (distance < 2 ) then
                                    triggerServerEvent ( "pedShootTrigger", ped, "melee" )
                                    setTimer ( chase_shoot, 2300, 1, ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 9) then -- if it is a chainsaw (watch out, the peds are deadly with these)
                                if (distance < 2 ) then
                                    local length = 1500
                                    triggerServerEvent ( "pedShootTrigger", ped, "chainsawA", length )
                                    setTimer ( chase_shoot, 6000, 1, ped, player )
                                else
                                    local length = math.random( 2100, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "chainsawB", length )
                                    setTimer ( chase_shoot, length+900 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 22) then
                                if (distance < 35 ) then
                                    local length = math.random( 2100, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+500 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 23) then
                                if (distance < 35 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+400 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 24) then
                                if (distance < 35 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+400 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 25) then
                                if (distance < 27 ) then
                                    local length = 300
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 1400 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 26) then
                                if (distance < 20 ) then
                                    local length = 1200
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 800 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 27) then
                                if (distance < 25 ) then
                                    local length = 1200
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 1800 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 28) then
                                if (distance < 40 ) then
                                    local length = math.random( 2100, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+500 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 29) then
                                if (distance < 55 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+1500 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 30) then
                                if (distance < 60 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+1500 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 31) then
                                if (distance < 60 ) then
                                    local length = 700
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 1200 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 32) then
                                if (distance < 30 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+600 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 33) then
                                if (distance < 75 ) then
                                    local length = 400
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 1600 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 34) then
                                if (distance < 75 ) then
                                    triggerServerEvent ( "pedShootTrigger", ped, "sniper")
                                    setTimer ( chase_shoot, 2000 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 37) then
                                if (distance < 15 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+900 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 38) then
                                if (distance < 65 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+900 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 41) then
                                if (distance < 4 ) then
Link to comment
I downloaded the resource bodyguard with the Slothbot also. The resource works very good but the aim of the bots is too bad. I want to know how can i fix this problem.

Here is a part of the script but i don't know what line must i change and how.

--CLIENT STUFF 
 
--detects when a bot changes status and starts the new behaviour
function changestatus (dataName)
    if getElementType ( source ) == "ped" and dataName == "status" and (getElementData (source, "slothbot") == true) then
        if (getElementData ( source, "status" ) == "chasing" ) then
            local player = getElementData ( source, "target" )
            local oldTx, oldTy, oldTz = getElementPosition( player )
            local oldPx, oldPy, oldPz = getElementPosition( source )
            setTimer ( chase_aim, 80, 1, source)
            setTimer ( chase_move, 700, 1, source, oldTx, oldTy, oldTz, oldPx, oldPy, oldPz )
            setTimer ( chase_shoot, 1500, 1, source )
        elseif (getElementData ( source, "status" ) == "hunting" ) then
            local oldPx, oldPy, oldPz = getElementPosition( source )
            setTimer ( enemy_check, 600 ,1 , source )-- starts scanning for enemies
            setTimer ( hunt_move, 800, 1, source, oldPx, oldPy, oldPz, oldPx, oldPy, oldPz )
        elseif (getElementData ( source, "status" ) == "following" ) then
            local player = getElementData ( source, "leader" )
            local oldTx, oldTy, oldTz = getElementPosition( player )
            local oldPx, oldPy, oldPz = getElementPosition( source )
            setTimer ( follow_enemy_check, 500 ,1 , source )
            setTimer ( follow_move, 800, 1, source, oldPx, oldPy, oldPz, oldPx, oldPy, oldPz )
        elseif (getElementData ( source, "status" ) == "waiting" ) then 
            setTimer ( wait_enemy_check, 500 ,1 , source )
        elseif (getElementData ( source, "status" ) == "guarding" ) then
            setTimer ( guard_enemy_check, 800 ,1 , source )-- starts scanning for enemies
            setTimer ( guard_move, 400 ,1 , source )
        end
    end
end
addEventHandler( "onClientElementDataChange", getRootElement(), changestatus )
 
--keeps the bot's aim slightly lagged
function chase_aim(ped)
    if (isElement(ped)) then
        local player = getElementData ( ped, "target" )
        if (getElementData ( ped, "status" ) ==  "chasing" ) and (isElement(player)) and (getElementData (ped, "slothbot") == true) then
            if getElementType(player) == "player" then
                local pedhp = getElementHealth ( ped )
                if pedhp > 0 and (isPlayerDead(player) == false) then
                    local x,y,z = getElementPosition( player )
                    local ex,ey,ez = getElementPosition( ped )
                    local isclear = isLineOfSightClear (ex, ey, ez+.6, x, y, z+.6, true, false, false, true, false, false, false)
                    if (isclear == true) then -- if the player target is in sight
                        if isPedDucked(player) then
                            setPedAimTarget ( ped, x, y, z-.5 )
                        else
                            setPedAimTarget ( ped, x, y, z )
                        end
                    end
                    setTimer ( chase_aim, 80, 1, ped, player )
                end
            elseif getElementType(player) == "ped" then
                local pedhp = getElementHealth ( ped )
                if pedhp > 0 and (getElementHealth(player) > 0) then
                    local x,y,z = getElementPosition( player )
                    local ex,ey,ez = getElementPosition( ped )
                    local isclear = isLineOfSightClear (ex, ey, ez+.6, x, y, z+.6, true, false, false, true, false, false, false)
                    if (isclear == true) then -- if the player target is in sight
                        if isPedDucked(player) then
                            setPedAimTarget ( ped, x, y, z-.5 )
                        else
                            setPedAimTarget ( ped, x, y, z )
                        end
                    end
                    setTimer ( chase_aim, 80, 1, ped, player )
                end
            end
        end
    end
end
 
--bot behaviour while in chase mode
function chase_move (ped, oldTx, oldTy, oldTz, oldPx, oldPy, oldPz)
    if (isElement(ped)) then
        local thetarget = getElementData ( ped, "target" )
        if (getElementData ( ped, "status" ) ==  "chasing" ) and (isElement(thetarget)) and (getElementData (ped, "slothbot") == true) then
            local pedhp = getElementHealth ( ped )
            local tarhp = getElementHealth ( thetarget )
            if pedhp > 0 and tarhp > 0 then
                local tx,ty,tz = getElementPosition( thetarget )
                local px,py,pz = getElementPosition( ped )
                local isclear = isLineOfSightClear (px, py, pz+.6, tx, ty, tz+.6, true, false, false, true, false, false, false)
                local angle = ( 360 - math.deg ( math.atan2 ( ( tx - px ), ( ty - py ) ) ) ) % 360 --set the peds angle to the target
                setPedRotation( ped, angle )
                if (isclear == true) then -- if the ped can see the target
                    local angle = ( 360 - math.deg ( math.atan2 ( ( tx - px ), ( ty - py ) ) ) ) % 360 --set the peds angle to the target
                    setPedRotation( ped, angle )
                    setElementData ( ped, "seestarget", true )
                    setTimer ( chase_move, 700, 1, ped, tx, ty, tz, px, py, pz)
                else
                    local angle = ( 360 - math.deg ( math.atan2 ( ( oldTx - px ), ( oldTy - py ) ) ) ) % 360 --set the peds angle to the target
                    setPedRotation( ped, angle )
                    setElementData ( ped, "seestarget", false )
                    setTimer ( chase_move, 700, 1, ped, oldTx, oldTy, oldTz, px, py, pz)
                end
            end
        end
    end
end
 
--tells the bot when to fire its gun. (only run by the peds controller)
function chase_shoot(ped)
    if (isElement(ped)) then
        local player = getElementData ( ped, "target" )
        if (isElement(player)) and (getElementData (ped, "slothbot") == true) then
            if (getElementType(player) == "ped") or (getElementType(player) == "player") then
                if (getElementData ( ped, "status" ) == "chasing" ) and (isElement(player)) then
                    if (getElementHealth(ped)>0) and (getElementHealth(player)>0) and (getElementData ( ped, "controller" ) == getLocalPlayer()) then
                        local x,y,z = getElementPosition( player )
                        local ex,ey,ez = getElementPosition( ped )
                        local isclear = isLineOfSightClear (ex, ey, ez+1, x, y, z+1, true, false, false, true, false, false, false)
                        if isclear == true then -- if the ped can see the local player
                            local distance = (getDistanceBetweenPoints3D (ex, ey, ez, x, y, z))
                            if (getPedWeapon(ped) < 19)  and (getPedWeapon(ped) ~= 9) then -- if its a melee weapon hat isnt a chainsaw
                                if (distance < 2 ) then
                                    triggerServerEvent ( "pedShootTrigger", ped, "melee" )
                                    setTimer ( chase_shoot, 2300, 1, ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 9) then -- if it is a chainsaw (watch out, the peds are deadly with these)
                                if (distance < 2 ) then
                                    local length = 1500
                                    triggerServerEvent ( "pedShootTrigger", ped, "chainsawA", length )
                                    setTimer ( chase_shoot, 6000, 1, ped, player )
                                else
                                    local length = math.random( 2100, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "chainsawB", length )
                                    setTimer ( chase_shoot, length+900 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 22) then
                                if (distance < 35 ) then
                                    local length = math.random( 2100, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+500 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 23) then
                                if (distance < 35 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+400 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 24) then
                                if (distance < 35 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+400 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 25) then
                                if (distance < 27 ) then
                                    local length = 300
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 1400 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 26) then
                                if (distance < 20 ) then
                                    local length = 1200
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 800 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 27) then
                                if (distance < 25 ) then
                                    local length = 1200
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 1800 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 28) then
                                if (distance < 40 ) then
                                    local length = math.random( 2100, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+500 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 29) then
                                if (distance < 55 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+1500 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 30) then
                                if (distance < 60 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+1500 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 31) then
                                if (distance < 60 ) then
                                    local length = 700
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 1200 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 32) then
                                if (distance < 30 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+600 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 33) then
                                if (distance < 75 ) then
                                    local length = 400
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length)
                                    setTimer ( chase_shoot, 1600 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 34) then
                                if (distance < 75 ) then
                                    triggerServerEvent ( "pedShootTrigger", ped, "sniper")
                                    setTimer ( chase_shoot, 2000 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 37) then
                                if (distance < 15 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+900 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
                            elseif (getPedWeapon(ped) == 38) then
                                if (distance < 65 ) then
                                    local length = math.random( 2000, 5500 )
                                    triggerServerEvent ( "pedShootTrigger", ped, "gun", length )
                                    setTimer ( chase_shoot, length+900 ,1 , ped, player )
                                else
                                    setTimer ( chase_shoot, 1500 ,1 , ped, player )
                                end
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...