Jump to content

Hydra .


CapY

Recommended Posts

Posted
function DisableHydraFire ( theVehicle ) 
    toggleControl ( "vehicle_secondary_fire", ~(getElementModel ( theVehicle ) == 520 ) ) ) 
end 
addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), DisableHydraFire ) 

Posted
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 ) 

Posted

Can it be available only for admins and moderators?

And btw , must i put it in play resource or freeroam resource ?

Posted
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 ) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted
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 ?

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

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

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.

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

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 ) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

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.

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

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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