FSXTim Posted June 14, 2012 Share Posted June 14, 2012 Hello, I get errors at all 'toggleControl'-lines (Bad argument). function playerListKeyPressed ( key, state ) if state == "down" then radioUpState = isControlEnabled ( "radio_next" ) radioDownState = isControlEnabled ( "radio_previous" ) weaponUpState = isControlEnabled ( "next_weapon" ) weaponDownState = isControlEnabled ( "previous_weapon" ) toggleControl ( source, "radio_next", false ) toggleControl ( source, "radio_previous", false ) toggleControl ( source, "next_weapon", false ) toggleControl ( source, "previous_weapon", false ) if isTimer ( playerListUpdateTimer ) then killTimer ( playerListUpdateTimer ) end scollBarAdjustTimer = setTimer ( reAdjustPlayerListScollBar, 50, -1 ) bindKey ( "mouse_wheel_up", "down", playerListScrollUp ) bindKey ( "mouse_wheel_down", "down", playerListScrollDown ) showPlayerList () else toggleControl ( "radio_next", radioUpState ) toggleControl ( "radio_previous", radioDownState ) toggleControl ( "next_weapon", weaponUpState ) toggleControl ( "previous_weapon", weaponDownState ) killTimer ( scollBarAdjustTimer ) unbindKey ( "mouse_wheel_up", "down", playerListScrollUp ) unbindKey ( "mouse_wheel_down", "down", playerListScrollDown ) guiSetVisible ( gImage["playerList"], false ) end end bindKey ( "tab", "both", playerListKeyPressed ) Greets Link to comment
TAPL Posted June 14, 2012 Share Posted June 14, 2012 remove source, it's not needed client side. Link to comment
FSXTim Posted June 14, 2012 Author Share Posted June 14, 2012 Ok, I did, but I can still toggle the radio. Greets Link to comment
TAPL Posted June 14, 2012 Share Posted June 14, 2012 You may need to use this event to disable radio. https://wiki.multitheftauto.com/wiki/OnC ... adioSwitch Link to comment
FSXTim Posted June 14, 2012 Author Share Posted June 14, 2012 I can still toggle the radio. function playerListKeyPressed (button, state) if state == "down" then toggleControl ( "radio_next", false ) toggleControl ( "radio_previous", false ) toggleControl ( "next_weapon", false ) toggleControl ( "previous_weapon", false ) if isTimer ( playerListUpdateTimer ) then killTimer ( playerListUpdateTimer ) end scollBarAdjustTimer = setTimer ( reAdjustPlayerListScollBar, 50, -1 ) bindKey ( "mouse_wheel_up", "down", playerListScrollUp ) bindKey ( "mouse_wheel_down", "down", playerListScrollDown ) showPlayerList () addEventHandler("onClientPlayerRadioSwitch", getLocalPlayer(), function () setRadioChannel(0) end ) else toggleControl ( "radio_next", true ) toggleControl ( "radio_previous", true ) toggleControl ( "next_weapon", true ) toggleControl ( "previous_weapon", true ) killTimer ( scollBarAdjustTimer ) unbindKey ( "mouse_wheel_up", "down", playerListScrollUp ) unbindKey ( "mouse_wheel_down", "down", playerListScrollDown ) guiSetVisible ( gImage["playerList"], false ) end end bindKey("tab", "both", playerListKeyPressed) Greets Link to comment
TAPL Posted June 14, 2012 Share Posted June 14, 2012 Try function playerListKeyPressed (button, state) if state == "down" then toggleControl ( "next_weapon", false ) toggleControl ( "previous_weapon", false ) addEventHandler("onClientPlayerRadioSwitch", localPlayer, Radio) if isTimer ( playerListUpdateTimer ) then killTimer ( playerListUpdateTimer ) end scollBarAdjustTimer = setTimer ( reAdjustPlayerListScollBar, 50, 1) bindKey ( "mouse_wheel_up", "down", playerListScrollUp ) bindKey ( "mouse_wheel_down", "down", playerListScrollDown ) showPlayerList () else removeEventHandler("onClientPlayerRadioSwitch", localPlayer, Radio) toggleControl ( "next_weapon", true ) toggleControl ( "previous_weapon", true ) if isTimer(scollBarAdjustTimer) then killTimer(scollBarAdjustTimer) end unbindKey ( "mouse_wheel_up", "down", playerListScrollUp ) unbindKey ( "mouse_wheel_down", "down", playerListScrollDown ) guiSetVisible ( gImage["playerList"], false ) end end bindKey("tab", "both", playerListKeyPressed) function Radio() cancelEvent() end Link to comment
FSXTim Posted June 14, 2012 Author Share Posted June 14, 2012 Thanks, this works! Greets 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