News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Help me out  (Read 1333 times)

0 Members and 2 Guests are viewing this topic.

Offline UltimateGamer9

  • Full Member
  • ***
  • Posts: 190
  • Gender: Male
    • View Profile
Help me out
« on: August 08, 2015, 11:01:43 PM »
How do I use TerminateThread? I need it for something.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Help me out
« Reply #1 on: August 08, 2015, 11:10:42 PM »
CreateThread returns a handle to the created thread, which you can use with TerminateThread to terminate the thread.

For example:
Code: [Select]
function main()
Wait(500)
local thread = CreateThread("F_PrintShit")
while true do
if IsButtonBeingPressed(3,0) then
TerminateThread(thread)
end
Wait(0)
end
end

function F_PrintShit()
while true do
TextPrintString("shit",0,1)
Wait(0)
end
end

Pressing the zoom-out button there will stop shit from being printed.