Jump to content

Hydra .


CapY

Recommended Posts

function disableFireForHydra ( theVehicle, seat, jacked ) 
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra 
        setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns 
  
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra ) 

Link to comment
function disableFireForHydra ( theVehicle, seat, jacked ) 
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra 
         if hasObjectPermissionTo (source, "function.banPlayer", false) then 
                setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns 
          end 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra ) 

Link to comment
function disableFireForHydra ( theVehicle, seat, jacked ) 
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra 
         if hasObjectPermissionTo (source, "function.banPlayer", false) then 
                setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns 
          end 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra ) 

And where i must put it , in play or freeroam ?

Link to comment
function disableFireForHydra ( theVehicle, seat, jacked ) 
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra 
         if not hasObjectPermissionTo (source, "function.banPlayer", false) then 
                setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns 
          end 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra ) 

And add it anywhere, doesn't matter.

Link to comment

It's working, you are using it server side, that's why the functions works on all the players.

Here:

-- SERVER SIDE 
  
function disableFireForHydra ( theVehicle, seat, jacked ) 
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra 
         if not hasObjectPermissionTo (source, "function.banPlayer", false) then 
                 -- disable their guns 
                triggerClientEvent(source, "disableHydraGuns", source, theVehicle) 
          end 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra ) 
  
-- CLIENT SIDE 
addEvent("disableHydraGuns", true) 
addEventHandler("disableHydraGuns", root, 
function(veh) 
setVehicleGunsEnabled(veh, false) 
end) 

Should work, notice that there is server and client sides.

Link to comment

Hmm, then it's another wiki mistake.

function disableFireForHydra ( theVehicle, seat, jacked ) 
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra 
         if hasObjectPermissionTo (source, "function.banPlayer", false) then 
                setVehicleGunsEnabled ( theVehicle, true) 
          else 
                 setVehicleGunsEnabled ( theVehicle, false) 
          end 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra ) 

Link to comment

This is like :

Server :

function disableFireForHydra ( theVehicle, seat, jacked ) 
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra 
         if hasObjectPermissionTo (source, "function.banPlayer", false) then 
                setVehicleGunsEnabled ( theVehicle, true) 
          else 
                 setVehicleGunsEnabled ( theVehicle, false) 
          end 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra ) 

Client:

-- CLIENT SIDE 
addEvent("disableHydraGuns", true) 
addEventHandler("disableHydraGuns", root, 
function(veh) 
setVehicleGunsEnabled(veh, false) 
end) 

Meta:


Mby . I was done something wrong.

Link to comment
addEventHandler("onVehicleEnter", root, 
    function(player) 
        if getElementModel(source) == 520 then 
            if hasObjectPermissionTo(player, "function.banPlayer", false) then 
                toggleControl(player, "vehicle_fire", true) 
            else 
                toggleControl(player, "vehicle_fire", false) 
            end 
        end 
    end 
) 
  
addEventHandler("onVehicleExit", root, 
    function(player) 
        toggleControl(player, "vehicle_fire", true) 
    end 
) 

Server side, whole code.

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