dewu Posted February 8, 2015 Share Posted February 8, 2015 Hi guys. What is the controlstate of stand up from crouching position? Because i want to disable stand up possibility. Or maybe other, simply way? I'm newbie ;P Link to comment
Dealman Posted February 8, 2015 Share Posted February 8, 2015 Did you try looking at Control_names? Link to comment
dewu Posted February 8, 2015 Author Share Posted February 8, 2015 There's nothing about stand up ;/ just crouch, so how to disable stand up possibility in other way? Link to comment
xeon17 Posted February 8, 2015 Share Posted February 8, 2015 setGlitchEnabled ( "crouchbug", false ) ? Link to comment
dewu Posted February 8, 2015 Author Share Posted February 8, 2015 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
Dealman Posted February 8, 2015 Share Posted February 8, 2015 Try using it client-side; function onStart_Handler() setControlState("crouch", true); toggleControl("crouch", false); toggleControl("jump", false); end addEventHandler("onClientResourceStart", resourceRoot, onStart_Handler); Link to comment
dewu Posted February 8, 2015 Author Share Posted February 8, 2015 My false, i don't clearly say all. I want to set it for player nearby using server-side, that's why i used thePlayer. Now i see, that thePlayer near is crouching at the second then stand up and he can't crouch again use control. Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 addEventHandler("onClientPreRender",root,function() bool = isPedDucked(localPlayer) toggleControl("crouch", not bool) toggleControl("jump",not bool) end ) Link to comment
dewu Posted February 8, 2015 Author Share Posted February 8, 2015 I tried that: function dupa2 (thePlayer) bool = isPedDucked(thePlayer) toggleControl(thePlayer, "crouch", not bool) toggleControl(thePlayer, "jump", not bool) end no working, without errors ;c Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 And.. where is the event in your code? Link to comment
dewu Posted February 8, 2015 Author Share Posted February 8, 2015 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
Tomas Posted February 8, 2015 Share Posted February 8, 2015 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
dewu Posted February 8, 2015 Author Share Posted February 8, 2015 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
Tomas Posted February 8, 2015 Share Posted February 8, 2015 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
Moderators IIYAMA Posted February 9, 2015 Moderators Share Posted February 9, 2015 Try execute this clientside: addEventHandler("onClientPreRender",root, function () if isPedDucked(localPlayer) then setControlState ("crouch",false) end end) Link to comment
dewu Posted February 9, 2015 Author Share Posted February 9, 2015 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 IIYAMA Posted February 9, 2015 Moderators Share Posted February 9, 2015 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
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