Jump to content

Crouching


dewu

Recommended Posts

    setGlitchEnabled ( "crouchbug", false ) 

?

I don't want it for all players.

Also i tried stg like this:

setControlState ( thePlayer, "crouch", true ) -- set player to crouch 
toggleControl ( thePlayer, "crouch", false ) -- disable crouch control to stand up 

but don't know why it's not working.

Try 'jump'

Jump? I don't undestand.

Link to comment

There is:

function dupa2 (thePlayer) 
bool = isPedDucked(thePlayer) 
toggleControl(thePlayer, "crouch", not bool) 
toggleControl(thePlayer, "jump", not bool) 
end 
addEvent("crouchOn", true) 
addEventHandler("crouchOn", getRootElement(), dupa2) 
  

and it too not works.

Link to comment
There is:
function dupa2 (thePlayer) 
bool = isPedDucked(thePlayer) 
toggleControl(thePlayer, "crouch", not bool) 
toggleControl(thePlayer, "jump", not bool) 
end 
addEvent("crouchOn", true) 
addEventHandler("crouchOn", getRootElement(), dupa2) 
  

and it too not works.

Where are you triggering 'crouchOn' ?

Link to comment

Okay, i decide to do something other:

  
setControlState( thePlayer, "walk", true ) -- working 
  
toggleControl ( thePlayer, "jump", false)  -- not working 
toggleControl ( thePlayer, "crouch", false ) -- working 
toggleControl ( thePlayer, "sprint", false )  -- not working 
  

WHY?! I still can jump and sprint.

Link to comment
Okay, i decide to do something other:
  
setControlState( thePlayer, "walk", true ) -- working 
  
toggleControl ( thePlayer, "jump", false)  -- not working 
toggleControl ( thePlayer, "crouch", false ) -- working 
toggleControl ( thePlayer, "sprint", false )  -- not working 
  

WHY?! I still can jump and sprint.

Where is 'thePlayer' defined?

Link to comment

Guys, i know why disable toggle control of sprinting and jumping doesn't work.

I try to disable these togglecontrols to nearby player sign as thePlayer on server-side:

function dupa2 (thePlayer) 
toggleControl ( thePlayer, "walk", false) -- working 
toggleControl ( thePlayer, "jump", false) -- not working 
toggleControl ( thePlayer, "crouch", false ) -- working 
toggleControl ( thePlayer, "sprint", false )  -- not working 
toggleControl ( thePlayer, "fire", false ) -- working 
toggleControl ( thePlayer, "next_weapon", false ) -- working 
toggleControl ( thePlayer, "previous_weapon", false ) -- working 
toggleControl ( thePlayer, "aim_weapon", false ) -- working 
  
setControlState(thePlayer, "crouch",true) 
setTimer(setControlState,100,1,thePlayer,"crouch",false) 
  
triggerClientEvent(source, "refreshInventoryManual", source) 
end 
addEvent("handcuffs", true) 
addEventHandler("handcuffs", getRootElement(), dupa2) 

how you can see spring and jump does not works, because in client-side is already defined same toggle control:

  
function checkBrokenbone() 
  if getElementData(getLocalPlayer(), "logedin") then 
    if getElementData(getLocalPlayer(), "brokenbone") then 
      if not isPedDucked(getLocalPlayer()) then 
      end 
      toggleControl("jump", false) -- there 
      toggleControl("sprint", false)  -- there 
      else 
      toggleControl("jump", true) -- and there 
      toggleControl("sprint", true) -- and there 
    end 
  end 
end 
setTimer(checkBrokenbone, 1400, 0) 
  

and there's a conflict, or something, because when i remove this:

      else 
      toggleControl("jump", true) -- and there 
      toggleControl("sprint", true) -- and there 

crouching script fully works.

How to fix that?

Link to comment
  • Moderators
function dupa2 (thePlayer) 
      
    setControlState(thePlayer, "crouch",true) 
    setTimer(setControlState,100,1,thePlayer,"crouch",false) 
      
    triggerClientEvent(source, "refreshInventoryManual", source) 
  
    triggerClientEvent(source, "setControlStatus", source,false)-- true = enable, false = disable 
end 
addEvent("handcuffs", true) 
addEventHandler("handcuffs", getRootElement(), dupa2) 

  
local controlStatus = true 
function checkBrokenbone() 
    if getElementData(getLocalPlayer(), "logedin") and controlStatus then 
        if getElementData(getLocalPlayer(), "brokenbone") then 
                if not isPedDucked(getLocalPlayer()) then 
                end 
            toggleControl("jump", false) -- there 
            toggleControl("sprint", false)  -- there 
        else 
            toggleControl("jump", true) -- and there 
            toggleControl("sprint", true) -- and there 
        end 
    end 
end 
setTimer(checkBrokenbone, 1400, 0) 
  
addEvent("setControlStatus",true) 
addEventHandler("setControlStatus",localPlayer, 
function (status) 
    toggleControl (  "walk", status)  
    toggleControl ( "jump", status)  
    toggleControl (  "crouch", status)  
    toggleControl (  "sprint", status)   
    toggleControl (  "fire", status )  
    toggleControl (  "next_weapon", status ) 
    toggleControl ( "previous_weapon", status )  
    toggleControl ( "aim_weapon", status ) 
    controlStatus = status 
end) 

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