Raziru Posted August 18, 2017 Share Posted August 18, 2017 -- outputChatBox triggers 3 times while setControlState triggers only once. for i =1,(4) do setControlState ( "next_weapon", true ) outputChatBox("next_fail") end Link to comment
Mr.Loki Posted August 18, 2017 Share Posted August 18, 2017 (edited) Please read the guidelines before posting. Edited August 18, 2017 by Mr.Loki Link to comment
Raziru Posted August 18, 2017 Author Share Posted August 18, 2017 for i =1,(4) do setControlState ( "next_weapon", true ) outputChatBox("next_fail") end outputChatBox triggers 3 times while setControlState triggers only once. I'd like to have next_weapon 3 times, but it only works once. How can I do it? 1 Link to comment
Mr.Loki Posted August 18, 2017 Share Posted August 18, 2017 I still am not sure of what you are trying to accomplish. Do you want to change the ped/player's weapon? If so then use this setPedWeaponSlot. Link to comment
Raziru Posted August 18, 2017 Author Share Posted August 18, 2017 I've tried to set them having instantly switch to sniper but the trick is if you were to bind 4>Fist, 4>Sniper It wont instantly switch to both. It will switch to 1 of them. so i'm trying to toggle "next_weapon" control till i reach the weapon i desire. Link to comment
Mr.Loki Posted August 18, 2017 Share Posted August 18, 2017 Are you using any script to change the weapons? Link to comment
Raziru Posted August 18, 2017 Author Share Posted August 18, 2017 addEventHandler("onClientResourceStart", resourceRoot, function() wnd = guiCreateWindow(455, 191, 425, 227, "", false) guiWindowSetSizable(wnd, false) butt1 = guiCreateButton(14, 30, 133, 32, "deagle", false, wnd) butt2 = guiCreateButton(199, 38, 150, 34, "shotgun", false, wnd) butt3 = guiCreateButton(300, 10, 150, 34, "2", false, wnd) ebox = guiCreateEdit(139, 111, 182, 45, "", false, wnd) addEventHandler( "onClientGUIClick", butt1, function() if (source==butt1) then slot1= tostring(guiGetText (ebox)) bindKey(slot1,"down",function() cslot1= getPedWeaponSlot ( localPlayer ) if ((2-cslot1) > 0) then for i =1,(2-cslot1) do setControlState ( "next_weapon", true ) outputChatBox("next_fail") end elseif((2-cslot1)<0) then for i =1,(cslot1-2) do setControlState ( "previous_weapon", true ) outputChatBox("pre_fail") end end end) end end) end) that's when i tried "next_weapon" control. addEventHandler("onClientResourceStart", resourceRoot, function() wnd = guiCreateWindow(455, 191, 425, 227, "", false) guiWindowSetSizable(wnd, false) butt1 = guiCreateButton(14, 30, 133, 32, "deagle", false, wnd) butt2 = guiCreateButton(199, 38, 150, 34, "shotgun", false, wnd) butt3 = guiCreateButton(300, 10, 150, 34, "2", false, wnd) ebox = guiCreateEdit(139, 111, 182, 45, "", false, wnd) addEventHandler( "onClientGUIClick", butt1, function() if (source==butt1) then slot1= tostring(guiGetText (ebox)) bindKey(slot1,"down",function() setPedWeaponSlot (localPlayer,2) end) end end) addEventHandler( "onClientGUIClick", butt2, function() if (source==butt2) then slot2= tostring(guiGetText (ebox)) bindKey(slot2,"down",function() setPedWeaponSlot (localPlayer,3) end) end end) end) that one when i tried to bind one key for 2 functions only the 2nd entered function will work. 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