Jump to content

SWAT turret


5150

Recommended Posts

Posted

does anyone have or know of a script to make the swat tank fire like a regular rhino?

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

Posted

okay, now that i have this, is there a way to

A. lock it to ONLY the swat tank

B. stop the water from firing

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

Posted

Its Possible To Make It But Theres A Problem When S.W.A.T Shoots Theres Water And It Can't Be Stop!

how can i turn this

function shootProjectile() 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
    -- Only create projectile if we are inside a vehicle 
    if(vehicle)then 
        local x, y, z = getElementPosition(vehicle) 
        createProjectile(vehicle, 19, x, y, z) 
    end 
end 
  
bindKey("vehicle_fire", "down", shootProjectile) 

into only SWAT though?

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

Posted

Its Possible To Make It But Theres A Problem When S.W.A.T Shoots Theres Water And It Can't Be Stop!

how can i turn this

function shootProjectile() 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
    -- Only create projectile if we are inside a vehicle 
    if(vehicle)then 
        local x, y, z = getElementPosition(vehicle) 
        createProjectile(vehicle, 19, x, y, z) 
    end 
end 
  
bindKey("vehicle_fire", "down", shootProjectile) 

into only SWAT though?

function shootProjectile() 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
    -- Only create projectile if we are inside a vehicle 
    if(vehicle)then 
        if getVehicleModelFromName(vehicle) == 601 then 
            local x, y, z = getElementPosition(vehicle) 
            createProjectile(vehicle, 19, x, y, z) 
        end 
    end 
end 
  
bindKey("vehicle_fire", "down", shootProjectile) 

"When i'll grow older, i'll be stronger, they'll call me freedom, just like a waving flag"

"Have confidence in yourself, no problem is impossible in life"

Posted

Use getElementModel to verify that the model of the vehicle is the ID of the SWAT truck (601), then as MIKI785 suggested - use toggleControl to disable the "fire" control.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

all this is kind of chinese to me lol... i know how to read some scripts but when it come to modifying them, ugh

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

Posted
  function shootProjectile() 
        local vehicle = getPedOccupiedVehicle(localPlayer) 
        -- Only create projectile if we are inside a vehicle 
        if(vehicle)then 
            if getVehicleModelFromName(vehicle) == 601 then 
                local x, y, z = getElementPosition(vehicle) 
                createProjectile(vehicle, 19, x, y, z) 
            end 
        end 
    end 
      
  
  
function swatEnter ( thePlayer, seat ) 
    if getElementModel ( source ) == 'Put swat tank id here' then 
    bindKey("mouse1", "down", shootProjectile) 
    toggleControl ( "vehicle_fire", false ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), swatEnter )  
  
  
  
function swatExit ( thePlayer, seat ) 
    if getElementModel ( source ) == 'Put swat tank id here' then 
    unbindKey("mouse1", "down", shootProjectile) 
    toggleControl ( "vehicle_fire", true ) 
    end 
end 
addEventHandler ( "onVehicleExit", getRootElement(), swatExit )) 

-- Not tested --

Wolf Inc Discord

Youtube channel
Github

Posted

i will test it, thank you

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

Posted

one more thing, is this server or clientside?

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

  • 2 weeks later...
Posted

hey a little update, i just got around to testing it, and i added it as clientside and filled in the vehicle id in the script but its still not working. any ideas?

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

Posted
Anything in debug?

nothing. it said there was a ) typo on line 30, so i fixed it but now it says nothing and doesnt work :/

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

Posted

i built upon CodyL's code:

function shootProjectile() 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
        -- Only create projectile if we are inside a SWAT 
    if(vehicle) and getVehicleModel(vehicle) == 601 then 
    local x, y, z = getElementPosition(vehicle) 
        createProjectile(vehicle, 19, x, y, z+1.7) 
    end 
end 
  
function toggleDemControls(bool) 
    toggleControl ( "vehicle_fire", bool ) 
    toggleControl ( "vehicle_secondary_fire", bool) 
end 
  
function swatEnter (player) 
    if player ~= localPlayer then return end 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
    if getElementModel (vehicle) == 601 then 
        toggleDemControls(false) 
        bindKey("vehicle_fire", "down", shootProjectile) 
        bindKey("vehicle_secondary_fire", "down", shootProjectile) 
    end 
end 
addEventHandler ( "onClientVehicleEnter", root, swatEnter )  
  
-- enable vehicle fire when player exits the SWAT, or when he dies 
-- so he can use hunter or anything else. 
  
function enableVehicleFireIfDead () 
    if source ~= localPlayer then return end 
    toggleDemControls(true) 
end 
  
function swatExit (player) 
    if player ~= localPlayer then return end 
    toggleDemControls(true) 
end 
addEventHandler ( "onClientVehicleExit", root, swatExit ) 
addEventHandler ( "onClientPlayerWasted", root, enableVehicleFireIfDead ) 
  

if you could make the rocket rotation change with the camera that would be a bonus.

Posted

it worked out great thanks man. if you want to see where its going to, or if anyone wants to help with the project its involved with, read this topic https://forum.multitheftauto.com/viewtopic.php?f=115&t=94301&p=846861#p846861

Paid Roleplay Mapper/Server Management - Message on forums or Discord for info

Fluent with Owlgaming Code. Discord message for paid full set-ups and help

My Discord: 5150#5150 (or .5150)

 

Monky Gaming Roleplay/Adventure Discord 
(English players and servers interested in collaborating or partnering message me)

https://discord.gg/SFBUHknpxy

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