Jump to content

Question about " AddCommandHandler " ( simple )


Recommended Posts

function addRadio ()
    outputChatBox ( " WOOOORKS " )
    outputChatBox ( "You're currently listening to " .. getRadioChannelName ( getRadioChannel() ) .. "!" )
end    

addCommandHandler ( "MyRadio", addRadio,  bool restricted = false, bool caseSensitive = false )

  What's wrong with this code? Why the hell it doesn't work? ( Nothing happens when i enter the command )

this command must be available for evereone in any case ( I mean it doesn't matter whether i enter /MyRadio or /myradio, /MyRaDiO and so on )

Thank you in advance

Edited by GrainHHH
Link to comment
  • Scripting Moderators
23 minutes ago, GrainHHH said:

function addRadio ()
    outputChatBox ( " WOOOORKS " )
    outputChatBox ( "You're currently listening to " .. getRadioChannelName ( getRadioChannel() ) .. "!" )
end    

addCommandHandler ( "MyRadio", addRadio,  bool restricted = false, bool caseSensitive = false )

  What's wrong with this code? Why the hell it doesn't work? ( Nothing happens when i enter the command )

this command must be available for evereone in any case ( I mean it doesn't matter whether i enter /MyRadio or /myradio, /MyRaDiO and so on )

Thank you in advance

Try like that:

function addRadio()
	outputChatBox("WOOOORKS")
	outputChatBox("You're currently listening to "..getRadioChannelName(getRadioChannel()).."!")
end
addCommandHandler("MyRadio", addRadio, false, false)

And if this wouldn't work, be sure that code is in client-side, also check debugscript 3 for errors/warnings.

Link to comment
2 hours ago, majqq said:

Try like that:


function addRadio()
	outputChatBox("WOOOORKS")
	outputChatBox("You're currently listening to "..getRadioChannelName(getRadioChannel()).."!")
end
addCommandHandler("MyRadio", addRadio, false, false)

And if this wouldn't work, be sure that code is in client-side, also check debugscript 3 for errors/warnings.

Thank god i got it. But there's mistake in your code ( "addCommandHandler " for client-sided type can take only 3 arguments - commandName,  handlerFunction, caseSensitive ). But anyway it hepled me so thank you, i really appreciate  it. And sorry for my english)

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...