MantisBT - Zandronum
View Issue Details
0002105Zandronum[All Projects] Suggestionpublic2015-02-15 21:552018-09-30 21:37
Catastrophe 
Torr Samaho 
normalfeatureN/A
closedfixed 
MicrosoftWindowsXP/Vista/7
1.3 
2.12.1 
0002105: Added new ccmd ifspectator
+ - Added new ccmd ifspectator that only runs if you're a spectator [Cata]
Example binds.

-=A=-
bind mouse1 " ifspectator noclip; +attack"

This will do +attack and noclip if you are spectating. When you're in-game it will only do +attack.

-=B=-
bind mwheelup "weapnext; ifspectator spynext"
bind mwheeldown "weapprev; ifspectator spyprev"

This will let you use your mouse wheel to scroll through players as a spectator. When you are in-game it will then scroll through weapons like it normally does.

-=C=-
bind i "ifspectator \"wait 35; say hi; wait 35; say bye\" "

This will -only- run as a spectator. Nothing will happen in-game by pressing i.
No tags attached.
diff specbind.diff (688) 2015-02-15 21:55
/tracker/file_download.php?file_id=1414&type=bug
diff specbindv2.diff (649) 2015-02-16 20:22
/tracker/file_download.php?file_id=1416&type=bug
Issue History
2015-02-15 21:55CatastropheNew Issue
2015-02-15 21:55CatastropheFile Added: specbind.diff
2015-02-16 12:58Edward-sanNote Added: 0011700
2015-02-16 13:14Edward-sanNote Edited: 0011700bug_revision_view_page.php?bugnote_id=11700#r6665
2015-02-16 13:22Edward-sanNote Edited: 0011700bug_revision_view_page.php?bugnote_id=11700#r6666
2015-02-16 13:23Edward-sanNote Edited: 0011700bug_revision_view_page.php?bugnote_id=11700#r6667
2015-02-16 20:22CatastropheFile Added: specbindv2.diff
2015-02-16 20:23CatastropheNote Added: 0011707
2015-02-16 20:23CatastropheNote Edited: 0011707bug_revision_view_page.php?bugnote_id=11707#r6672
2015-02-22 12:26DuskStatusnew => needs review
2015-06-14 07:59Torr SamahoNote Added: 0012695
2015-06-14 08:09cobaltAssigned To => Torr Samaho
2015-06-14 08:09cobaltStatusneeds review => needs testing
2015-06-14 08:09cobaltTarget Version => 2.1
2015-06-14 08:09cobaltAdditional Information Updatedbug_revision_view_page.php?rev_id=7413#r7413
2015-06-14 08:09cobaltNote Added: 0012697
2015-06-24 22:45DuskStatusneeds testing => resolved
2015-06-24 22:45DuskFixed in Version => 2.2
2015-06-24 22:45DuskResolutionopen => fixed
2015-06-24 22:47DuskFixed in Version2.2 => 2.1
2018-09-30 21:37Blzut3Statusresolved => closed

Notes
(0011700)
Edward-san   
2015-02-16 12:58   
(edited on: 2015-02-16 13:23)
You could use directly "AddCommandString(cmdTotal.GetChars());" instead of creating the char buffer "cmd".

[edit]Argh! AddCommandString accepts 'char *' and changes the buffer, too! Well, you can still simplify that with:


char *cmd = strdup(cmdTotal.GetChars());
AddCommandString(cmd);
free(cmd);


[edit2]Actually, you can use this:

AddCommandString(cmdTotal.LockBuffer());
cmdTotal.UnlockBuffer();


(0011707)
Catastrophe   
2015-02-16 20:23   
@Edward

Uploaded an updated diff with your suggestion.

(0012695)
Torr Samaho   
2015-06-14 07:59   
I added a slightly refined version of your patch.
(0012697)
cobalt   
2015-06-14 08:09   
Issue addressed by commit 427da93e2ff1: Added a slightly refined version of Catastrophe's patch that adds the CCMD 'ifspectator' (addresses 2105).
Committed by Benjamin Berkels [Torr Samaho] on Sunday 14 June 2015 09:58:42

Changes in files:

 docs/zandronum-history.txt | 1 +
 src/c_cmds.cpp | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)