dewu Posted February 8, 2015 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
dewu Posted February 8, 2015 Author Posted February 8, 2015 There's nothing about stand up ;/ just crouch, so how to disable stand up possibility in other way?
dewu Posted February 8, 2015 Author 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.
Dealman Posted February 8, 2015 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);
dewu Posted February 8, 2015 Author 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.
Tomas Posted February 8, 2015 Posted February 8, 2015 addEventHandler("onClientPreRender",root,function() bool = isPedDucked(localPlayer) toggleControl("crouch", not bool) toggleControl("jump",not bool) end )
dewu Posted February 8, 2015 Author 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
dewu Posted February 8, 2015 Author 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.
Tomas Posted February 8, 2015 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' ?
dewu Posted February 8, 2015 Author 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.
Tomas Posted February 8, 2015 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?
Moderators IIYAMA Posted February 9, 2015 Moderators Posted February 9, 2015 Try execute this clientside: addEventHandler("onClientPreRender",root, function () if isPedDucked(localPlayer) then setControlState ("crouch",false) end end)
dewu Posted February 9, 2015 Author 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?
Moderators IIYAMA Posted February 9, 2015 Moderators 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)
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