Jump to content

C stack overflow


Recommended Posts

Stack overflow often is a result of infinite recursion. I guess this isn't your full script. Maybe you used this line in onClientPlayerRadioSwitch? If yes, then setRadioChannel triggers another onClientPlayerRadioSwitch which calls setRadioChannel again, and so on. If you want to make the radio station always 0, use setRadioChannel when player enters the vehicle and cancel the event when radio switch is attempted.

Link to comment

Just use it that way:

local blockRadioEvent 
addEventHandler('onClientPlayerRadioSwitch',root,function() 
      if blockRadioEvent then 
            blockRadioEvent = nil 
            return 
      end 
      if conditions then --e.g. channel == 0 
              blockRadioEvent = true 
              setRadioChannel(0) 
      end 
end) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...