Log in to reply
 

Can't activate certain controls?



  • For my mod I'm disabling controls. Right now, controls are disabled until the button they occupy is held for over 200 milliseconds, after which the button isn't disabled any more. This works great for vehicle control types like handbrake, ducking and aiming. All activate properly after 200ms.

    Sadly, the "toggle" buttons like switch weapons doesn't work this way. Even immediately lifting up after the disable is lifted, doesn't activate the control. It does seem like holding the button for too long will also not work (this is without my blocks being active).

    Anybody got an idea how to do a button press?

    Have some code:

    for (int i = 0; i < static_cast<int>(ScriptControls::ControllerControlType::SIZEOF_ControllerControlType); i++) {
    	if (controls.ControlXboxBlocks[i] == -1) continue;
    	// todo: only work for shift up/down atm
    	if (i != (int)ScriptControls::ControllerControlType::ShiftUp && i != (int)ScriptControls::ControllerControlType::ShiftDown) continue;
    
    	if (controls.ButtonHeldOver(static_cast<ScriptControls::ControllerControlType>(i), 200)) {
    		// todo: Neither of these two should be needed but I can't get tap-controls to activate. (switch wpn)
    		CONTROLS::ENABLE_CONTROL_ACTION(0, controls.ControlXboxBlocks[i], true);
    		CONTROLS::_SET_CONTROL_NORMAL(0, controls.ControlXboxBlocks[i], 1.0f);
    	}
    	else {
    		CONTROLS::DISABLE_CONTROL_ACTION(0, controls.ControlXboxBlocks[i], true);
    	}
    }
    

Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.