Jump to content

[HELP] getRadioChannel & setRadioChannel


JanKy

Recommended Posts

Umm, hey guys. I don't understand why i get this error in the debugscript : "attempt to call 'getRadioChannel' ( a nil value )"

Also, even if i use setRadioChannel alone, i get the same error : "attempt to call 'setRadioChannel' ( a nil value )"

Also, here's the code

if getRadioChannel() ~= 0 then 
	setRadioChannel(0) 
	cancelEvent() 
end 

 

Link to comment

Oh, silly me. Wasn't on client side. But now it is, like this :

addEventHandler("onPlayerVehicleEnter", root, function()
	if getRadioChannel() ~= 0 then 
		setRadioChannel(0) 
		cancelEvent() 
	end 
end);

No errors, but the radio still works. Any ideas to make it stop?

Link to comment
  • Moderators
8 hours ago, JanKy said:

Oh, silly me. Wasn't on client side. But now it is, like this :


addEventHandler("onPlayerVehicleEnter", root, function()
	if getRadioChannel() ~= 0 then 
		setRadioChannel(0) 
		cancelEvent() 
	end 
end);

No errors, but the radio still works. Any ideas to make it stop?

addEventHandler("onClientVehicleStartEnter", getRootElement(), function()
    setRadioChannel(0)
end)
addEventHandler("onClientPlayerRadioSwitch", getRootElement(), function()
	cancelEvent()
end)

 

Edited by Patrick2562
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...