custom command run at round end and other places

Discussion in 'TTT Suggestions' started by Xproplayer, Oct 12, 2016.

  1. Xproplayer

    Xproplayer VIP Silver

    With inspiration from the end of round damagelog print command the idea came to me to have the servers run a custom command on all clients during various stages of the game, mostly though the round end.

    Given the example code:
    Code:
    function SGMCommand()
    
    for _, ply in ipairs( player.GetAll() ) do
    
    ply:ConCommand( "sgm_roundover" )
    
    end
    
    end
    hook.Add( "TTTEndRound", "SGMCommand", SGMCommand )
    
    At the end of the round all clients would have the command "sgm_roundover" run in their console, for 90% of players this would simply result in an error "unkown command: sgm_roundover", but for the experienced players such as myself, this would be extremely useful when given an alias for a few reasons.

    the best one would indeed be to have the damagelogs print at the end of the round, and is simple as
    alias sgm_roundover "ttt_print_damagelog" in a cfg file that is run when you open gmod

    But a few other ideas I've come up with such as having it set your volume back to whatever you play at, this would mean you could die, have a keybind to set your volume to 0, hit that and alt tab and do whatever else you want to, then when the round is over it would automatically turn your volume back on and you'd hear and be able to come back for the next round.

    You could also do a similar idea in having a key to set voice_scale to .000001 and then when the round ends set it back to whatever you like, I have a keybind right now that toggles between my two voice scales so that when I'm alt tabbed I can hear all game sound except players voices, meaming I'll hear the end of round music, but also opens me up to hearing gunfire explosions etc.

    Another one could be ulx thetime, that way us normal players would know when the round ended and we could use it for forum reports if needed, and if multiple people had it it'd still only post the time once so no worries for spam.


    If anyone has any similar ideas post them here and I will add them to this post.
     
    • Like Like x 2
    • Agree Agree x 1
    • Winner Winner x 1
  2. Dolph1n

    Dolph1n Time is an adventure- if you know when to look. Banned Elite

    wouldn't you be able to do something like this client-side? so only your local console runs the command without server interference.
    if not just not even have the same code client-side
     
  3. Xproplayer

    Xproplayer VIP Silver

    No theres no way to catch the hook of round over without running clientside lua which is blocked for obvious reasons.
     
    • Like Like x 1