Create an account

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] How does the defer command work?

At the end of a multiplayer death match, "user wins" is written to the console signifying that the round has ended. I've been experimenting with autoexec.cfg and I'd like to start using the defer cmd.

I want to wait for the line I mentioned above and, when it is detected, fire a series of subcmds. I have three in mind; they are teamstatus, something that will print all the lines on the console to a private server of mine, and quit (in that order).

Is it possible to complete such a task and if so could you give me an idea of how it can be implemented?

defer is a bit of a strangely functioning command;
The entire command line is executed at the same time, so multiple defers will trigger at the same time.
The easiest way to work around this is to increase the time for each consecutive defer, e.g. alias sv_hook_gameend "teamstatus; defer 1 \"condump mylog.txt\"; defer 2 quit"
[Image: 230.png]

Hi mario, sorry it's been a really long time since I asked this question but I've tried to implement what you said to no avail... I can't find many resources that include examples of how this code works so it's hard for me to learn therefore I can't spot the error myself. Could you explain for instance how defer would work with only just 1 defer? say I wanted to just quit at game end? If you have better things to do than teach me how to code I'd understand haha but maybe you have a good resource though that you could include so I could learn on my own? Thanks

If you just want to close the server when the match ends, then an alternative method could be to quit when the match ends via quit_and_redirect. Setting it to "self" may work best.
Options like that can be found via CACS:

As for how to use the console for scripting, nowhere explains every detail, but some tips are available:
[Image: 230.png]

This is what ended up working for me...

alias cl_hook_gameend "teamstatus; defer 1 \"condump mylog.txt\"; defer 2 quit"

I just had to change the hook_gameend part. Couldn't have done it without you, thanks a bunch!

Possibly Related Threads…
Thread Author Replies Views Last Post
  [NEED HELP] My mouse binds do not work in GLX? FAF 5 1,760 07-29-2022, 08:39 AM
Last Post: FAF
  [NEED HELP] cl_gunalign doesn't seem to work on some servers/maps Aguaumreal 2 2,581 09-10-2019, 03:42 AM
Last Post: Aguaumreal
  [BUG] Rebound "R" key, still occasionally does "team say" anyways Cynical 2 1,809 06-27-2019, 08:54 AM
Last Post: Cynical
  [NEED HELP] Buffs Don't Work 3agle427 0 1,560 01-19-2019, 04:46 PM
Last Post: 3agle427
  [BUG] Command line typing issues teratorn 5 3,053 04-12-2018, 04:02 AM
Last Post: teratorn
  [BUG] xonotic-maps ebuild does not compile ZyX 0 2,230 05-01-2017, 10:10 PM
Last Post: ZyX
  [NEEDS INFO] lsmaps command -maniac|Su- 4 2,808 03-29-2017, 05:17 PM
Last Post: cefiar
  [SOLVED] Surround sound refuses to work with C-Media CMI-8788 soundcards Lee_Stricklin 2 3,002 03-06-2017, 08:24 PM
Last Post: Lee_Stricklin
  [SOLVED] Xonotic doesn't work with overwolf Ch4mp 2 3,746 08-12-2016, 02:44 AM
Last Post: Ch4mp
  [FIXED] assault map don't work Brot 3 4,194 10-13-2015, 05:44 PM
Last Post: Mario

Forum Jump:

Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-