Forrest Posted February 12, 2013 Share Posted February 12, 2013 Right, I'm a little bit of a noob to scripting, though I am learning as much and as fast as I can. Right now, I'm trying to make a script for toggle-able semi-auto/auto firearms, and I'm completely stumped as to how I could do it! Does anyone have say, an example, or an idea of how I could do it? Thanks, much appreciated! Link to comment
DNL291 Posted February 12, 2013 Share Posted February 12, 2013 You can use these functions: bindKey setControlState( thePlayer, "fire", state ) getControlState( thePlayer, "fire" ) Link to comment
Moderators IIYAMA Posted February 14, 2013 Moderators Share Posted February 14, 2013 CLIENT function setWeaponFire (key, keyState) if keyState == "down" then setControlState(getLocalPlayer(), "fire", true ) elseif keyState == "up" then setControlState(getLocalPlayer(), "fire", false ) end end addEventHandler ( "onClientResourceStart", resourceRoot, function () bindKey ("mouse1", "both",setWeaponFire) bindKey ("lctrl", "both",setWeaponFire) toggleControl ("fire", false ) end) OR server ( not recommended when high ping) function setWeaponFire (key, keyState) if keyState == "down" then setControlState(source, "fire", true ) elseif keyState == "up" then setControlState(source, "fire", false ) end addEventHandler ( "onResourceStart", resourceRoot, function () for _, player in pairs ( getElementsByType 'player' ) do bindKey (player,"mouse1", "both",setWeaponFire) bindKey (player,"lctrl", "both",setWeaponFire) toggleControl ( player, "fire", false ) end end) addEventHandler ( "onPlayerJoin", getRootElement( ), function () bindKey (source,"mouse1", "both",setWeaponFire) bindKey (source,"lctrl", "both",setWeaponFire) toggleControl ( source, "fire", false ) end) 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