Andres99907

can i do a swat with a single seat?

Recommended Posts

I have a problem with the swat, I put a resource that makes it fire, but it explodes if there is someone else inside, I tried to make the doors lock in the swat and that they can not warp when a player is inside but it did not work. :( help

Share this post


Link to post

this is the script to lock the doors

function lockdoors ( theVehicle, seat )
    if ( getElementModel ( theVehicle ) == 601 ) then
         if isVehicleLocked ( playervehicle ) then      
         setVehicleLocked ( v, true )
    else 
         setVehicleLocked ( v, false )
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), lockdoors )

Share this post


Link to post
function lockcar ( thePlayer )
    playervehicle = getPedOccupiedVehicle ( thePlayer ) 	-- define 'playervehicle' as the vehicle the player is in
	 local id = getElementModel ( playervehicle )
    if id == 601 then
                               -- if a player is in a vehicle
        if isVehicleLocked ( playervehicle ) then            -- and if the vehicle is already locked
            setVehicleLocked ( playervehicle, false ) --unlock it	
        else                                                 -- otherwise (if it isn't locked) 
            setVehicleLocked ( playervehicle, true ) -- lock it
playSoundFrontEnd ( thePlayer, 46 ) --optional argument
        end
    end
end


function bindLockOnSpawn ( theSpawnpoint )                     -- when a player spawns
    bindKey ( source, "l", "down", lockcar )                   -- bind the 'l' key to the 'lockcar' function
end
addEventHandler ( "onPlayerSpawn", getRootElement(), bindLockOnSpawn ) 

when you respawn ( /kill ) the key going to be binded

and what happend with the fire of tank?

Edited by <~KaMiKaZe~>
  • Thanks 1

Share this post


Link to post
addEventHandler("onPlayerVehicleEnter",root,
function(vehicle)
  local id = getElementModel(vehicle)
  if id == 601 then
    setVehicleLocked(vehicle,true)
  end
end
)

addEventHandler("onPlayerVehicleExit",root,
function(vehicle)
  local id = getElementModel(vehicle)
  if id == 601 then
    setVehicleLocked(vehicle,false)
  end
end
)

 

Edited by ÆBKV
  • Like 1

Share this post


Link to post

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.