CapY Posted July 26, 2011 Share Posted July 26, 2011 Anybody knows how to disable Hydra missiles ? Link to comment
Fentas Posted July 26, 2011 Share Posted July 26, 2011 function DisableHydraFire ( theVehicle ) toggleControl ( "vehicle_secondary_fire", ~(getElementModel ( theVehicle ) == 520 ) ) ) end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), DisableHydraFire ) Link to comment
Machine Posted July 26, 2011 Share 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 ) Link to comment
CapY Posted July 27, 2011 Author Share 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 ? Link to comment
Machine Posted July 27, 2011 Share 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 Link to comment
JR10 Posted July 27, 2011 Share 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 ) Link to comment
CapY Posted July 27, 2011 Author Share 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 ? Link to comment
JR10 Posted July 27, 2011 Share 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. Link to comment
CapY Posted July 28, 2011 Author Share Posted July 28, 2011 Missiles are still available to everyone . Link to comment
JR10 Posted July 28, 2011 Share 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. Link to comment
CapY Posted July 28, 2011 Author Share Posted July 28, 2011 Ehh, you see , you didn't posted a client - side . Link to comment
JR10 Posted July 28, 2011 Share Posted July 28, 2011 I did, in one [lua] check again. Link to comment
CapY Posted July 28, 2011 Author Share Posted July 28, 2011 You have nil on : setVehicleGunsEnabled(veh,false) end) I got it from debugscript .. Link to comment
JR10 Posted July 28, 2011 Share 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 ) Link to comment
CapY Posted July 28, 2011 Author Share Posted July 28, 2011 It's still shows nil at line 6. Can you post the whole script . Link to comment
JR10 Posted July 28, 2011 Share Posted July 28, 2011 Then the functions doesn't exist or removed. Even though there is a page for it in the wiki. Link to comment
CapY Posted July 28, 2011 Author Share 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. Link to comment
JR10 Posted July 28, 2011 Share Posted July 28, 2011 (edited) There is no need for client then. And setVehicleGunsEnabled doesn't exist then. Edited July 28, 2011 by Guest Link to comment
CapY Posted July 28, 2011 Author Share Posted July 28, 2011 It says Error:?:0 attempt to call userdata value Link to comment
JR10 Posted July 28, 2011 Share 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. Link to comment
CapY Posted July 28, 2011 Author Share Posted July 28, 2011 Doesn't works , anyway, thanks for help . Link to comment
JR10 Posted July 28, 2011 Share 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. Link to comment
CapY Posted July 28, 2011 Author Share Posted July 28, 2011 I am admin and i'm not logged in and hydra missiles is still available for everyone. Link to comment
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