Jump to content

Disable special fightning style. How?


Recommended Posts

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

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

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

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

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