Fentas Posted July 26, 2011 Posted July 26, 2011 function DisableHydraFire ( theVehicle ) toggleControl ( "vehicle_secondary_fire", ~(getElementModel ( theVehicle ) == 520 ) ) ) end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), DisableHydraFire )
Machine Posted July 26, 2011 Posted July 26, 2011 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 )
CapY Posted July 27, 2011 Author Posted July 27, 2011 Can it be available only for admins and moderators? And btw , must i put it in play resource or freeroam resource ?
Machine Posted July 27, 2011 Posted July 27, 2011 yes you can make it avible for admins and modertro by making on acl and you must put in play resorce as i think
JR10 Posted July 27, 2011 Posted July 27, 2011 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 )
CapY Posted July 27, 2011 Author Posted July 27, 2011 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 ?
JR10 Posted July 27, 2011 Posted July 27, 2011 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.
JR10 Posted July 28, 2011 Posted July 28, 2011 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.
CapY Posted July 28, 2011 Author Posted July 28, 2011 Ehh, you see , you didn't posted a client - side .
CapY Posted July 28, 2011 Author Posted July 28, 2011 You have nil on : setVehicleGunsEnabled(veh,false) end) I got it from debugscript ..
JR10 Posted July 28, 2011 Posted July 28, 2011 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 )
CapY Posted July 28, 2011 Author Posted July 28, 2011 It's still shows nil at line 6. Can you post the whole script .
JR10 Posted July 28, 2011 Posted July 28, 2011 Then the functions doesn't exist or removed. Even though there is a page for it in the wiki.
CapY Posted July 28, 2011 Author Posted July 28, 2011 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.
JR10 Posted July 28, 2011 Posted July 28, 2011 (edited) There is no need for client then. And setVehicleGunsEnabled doesn't exist then. Edited July 28, 2011 by Guest
CapY Posted July 28, 2011 Author Posted July 28, 2011 It says Error:?:0 attempt to call userdata value
JR10 Posted July 28, 2011 Posted July 28, 2011 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.
JR10 Posted July 28, 2011 Posted July 28, 2011 What happens?, if you are admin you will be able to shoot, if you are not you won't, maybe you are admin that's why.
CapY Posted July 28, 2011 Author Posted July 28, 2011 I am admin and i'm not logged in and hydra missiles is still available for everyone.
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