Dzsozi (h03) Posted March 20, 2014 Share Posted March 20, 2014 Hello everyone! So I was just thinking about how can I disable the special fighting styles and replace them with the default left mouse click fightning style. So in single player when you hold down mouse2 and press F your character's fightning style is special. How can I disable special fightning styles? So if I hold mouse2 and press F it's like when you punch normally. I hope you can understand. Thanks for help! Link to comment
Noki Posted March 21, 2014 Share Posted March 21, 2014 Firstly you'd want to make sure no one else has a different fighting style. Loop through the players and set their styles to default. You might be able to do something with toggleControl. Link to comment
Dzsozi (h03) Posted March 21, 2014 Author Share Posted March 21, 2014 Firstly you'd want to make sure no one else has a different fighting style. Loop through the players and set their styles to default. You might be able to do something with toggleControl. Okay, I'll try something, thank you! Link to comment
Dzsozi (h03) Posted March 22, 2014 Author Share Posted March 22, 2014 Well, I can't do this. I searched the wiki for hours but I don't know how to toggle the special fightning style, because this is with exit_enter, so I think it's going to disable the enter and the exit functions on vehicles. I don't know how to start or make it Please, can you write me an example? I would be really grateful! Link to comment
Moderators Citizen Posted March 22, 2014 Moderators Share Posted March 22, 2014 Well, you didn't really looked at the wiki functions list: getPedFightingStyle setPedFightingStyle And here are two possible solutions: function forceNormalFightStyle() for k, player in ipairs ( getElementsByType("player") ) do if getPedFightingStyle( player ) ~= 4 then setPedFightingStyle( player, 4 ) end end end setTimer(forceNormalFightStyle, 1000, 0) -- or addEventHandler("onPlayerJoin", root, function() local timer = setTimer( setPedFightingStyle, 1000, 0, source, 4 ) setElementData( source, "fightStyleTimer", timer) end) addEventHandler("onPlayerQuit", root, function() local timer = getElementData( source, "fightStyleTimer") if timer and isTimer( timer ) then killTimer( timer ) end end) I really don't know which one is the best (talking about performance). By the way, it's tiny enough to not really care of it. Link to comment
cheez3d Posted March 22, 2014 Share Posted March 22, 2014 You can check if the player is holding down the Right Mouse Button (if I remember correctly, you can only use the special fighting style only when you hold down RMB) and use toggleControl() when it's being holded. If you disable the "enter_exit" control permanently you will also not be able to enter/exit vehicles. Link to comment
Dzsozi (h03) Posted March 23, 2014 Author Share Posted March 23, 2014 Well, you didn't really looked at the wiki functions list:getPedFightingStyle setPedFightingStyle And here are two possible solutions: function forceNormalFightStyle() for k, player in ipairs ( getElementsByType("player") ) do if getPedFightingStyle( player ) ~= 4 then setPedFightingStyle( player, 4 ) end end end setTimer(forceNormalFightStyle, 1000, 0) -- or addEventHandler("onPlayerJoin", root, function() local timer = setTimer( setPedFightingStyle, 1000, 0, source, 4 ) setElementData( source, "fightStyleTimer", timer) end) addEventHandler("onPlayerQuit", root, function() local timer = getElementData( source, "fightStyleTimer") if timer and isTimer( timer ) then killTimer( timer ) end end) I really don't know which one is the best (talking about performance). By the way, it's tiny enough to not really care of it. Thank you very much! It works. 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