Here is some button code that I use in one of my current testing scripts.
This code does work but you will have to play around with it alittle bit to apply it to your current project since there is no "one size fits all" approach to scripting sadly.
main = function()
F_MissionSetup()
PlayerSetControl(1)
CameraSetWidescreen(true)
DisablePunishmentSystem(true)
CameraReset()
Wait(50)
Wait(10)
CameraFade(500, 1)
--TextPrintString("Starting", 1, 1)
HasGravity = true
index = 1
--F_BuildWeaponTable()
--F_BuildPickupTable()
controllernum = 0
HairIsChanging = nil
DebugMenuAddPage("Spawn Character")
ShouldLoop = true
while (ShouldLoop) do
if F_IsButtonPressedWithDelayCheck(1, 0, 1, 100) then
TextPrintString("Print Something"..index, 2, 2)
elseif F_IsButtonPressedWithDelayCheck(0, 0, 1, 100) then
TextPrintString("Print More Something"..index, 2, 2)
elseif IsButtonPressed(2, 0) then
CreateThread("Function0")
elseif F_IsButtonPressedWithDelayCheck(3, 0, 1, 200) then
CreateThread("Function1")
end
Wait(0)
end
end
Keep in mind that this is just a example and not intended to be used directly as it is since it is only a portion of some test code of mine and I edited it to remove certain things that I need to keep quiet about for the time being.