5150 Posted February 28, 2016 Posted February 28, 2016 does anyone have or know of a script to make the swat tank fire like a regular rhino?
Captain Cody Posted February 28, 2016 Posted February 28, 2016 https://wiki.multitheftauto.com/wiki/CreateProjectile
5150 Posted February 29, 2016 Author Posted February 29, 2016 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
WhiteCatMeow Posted February 29, 2016 Posted February 29, 2016 https://wiki.multitheftauto.com/wiki/CreateProjectile Its Possible To Make It But Theres A Problem When S.W.A.T Shoots Theres Water And It Can't Be Stop!
5150 Posted February 29, 2016 Author Posted February 29, 2016 https://wiki.multitheftauto.com/wiki/CreateProjectile 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?
Mann56 Posted February 29, 2016 Posted February 29, 2016 https://wiki.multitheftauto.com/wiki/CreateProjectile 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)
MIKI785 Posted February 29, 2016 Posted February 29, 2016 getVehicleModelFromName takes a string, not element. Use getElementModel instead. Also it is possible to disable the water, just use toggleControl.
Dealman Posted February 29, 2016 Posted February 29, 2016 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.
Captain Cody Posted February 29, 2016 Posted February 29, 2016 You can unbind the fire button in the swat tank, and use mouse_1 key
5150 Posted February 29, 2016 Author Posted February 29, 2016 all this is kind of chinese to me lol... i know how to read some scripts but when it come to modifying them, ugh
Captain Cody Posted February 29, 2016 Posted February 29, 2016 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 --
5150 Posted February 29, 2016 Author Posted February 29, 2016 one more thing, is this server or clientside?
Captain Cody Posted February 29, 2016 Posted February 29, 2016 createProjectile is client sided so clientside
5150 Posted March 13, 2016 Author Posted March 13, 2016 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?
5150 Posted March 14, 2016 Author Posted March 14, 2016 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
pro-mos Posted March 17, 2016 Posted March 17, 2016 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.
Captain Cody Posted March 17, 2016 Posted March 17, 2016 You could use https://wiki.multitheftauto.com/wiki/Ge ... etPosition To set the direction of the projectile.
5150 Posted March 19, 2016 Author Posted March 19, 2016 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now