Commands through buttons

Discussion in 'Mapping Questions & Discussion' started by Cookie^, Mar 9, 2014.

  1. Cookie^

    Cookie^ L2: Junior Member

    Messages:
    75
    Positive Ratings:
    2
    Hello there, I was wondering.

    How would I be able to make a button that when it gets damaged it executes a command?

    Something like hitting a button and toggling 'sv_cheats' on/off?

    Thanks for your time! :)
     
  2. henke37

    aa henke37

    Messages:
    1,857
    Positive Ratings:
    430
    Have you used the I/O system before? If you have then you clearly wasn't paying attention.
     
  3. ScorpioUprising

    aa ScorpioUprising

    Messages:
    402
    Positive Ratings:
    354
    Really? This was really necessary?
     
    • Thanks Thanks x 4
  4. Egan

    aa Egan

    Messages:
    1,304
    Positive Ratings:
    1,485
    You can use the entities point_clientcommand to do client things like +forward, and point_servercommand to do things the server operator would do like sv_cheats. Although I warn that if you toggle sv_cheats on a public map then it can potentially damage the server. There are a few commands players can type in, with sv_cheats on, that can crash the server, which isn't good in a public map!
     
    • Thanks Thanks x 1
  5. Werewolf

    aa Werewolf Probably not a real Werewolf

    Messages:
    723
    Positive Ratings:
    205
    You need a point_servercommand entity somewhere in your map, and name it something like 'ServerCommand" or "Console"

    Then have your button do "OnPressed>ServerCommand>Command>[yourcommand]>[time]"

    Do NOT use quotation marks in commands, so all you would type would be sv_cheats 1
     
    • Thanks Thanks x 1
  6. Cookie^

    Cookie^ L2: Junior Member

    Messages:
    75
    Positive Ratings:
    2
    Thanks, I used sv_cheats as an example btw :)