Hello everyone! I've been trying to make an already existing plugin work independently, and I think I'm done. The plugin is called Skeys, it's part of Jumpassist; a big plugin used by some servers to handle all kind of rocket jumping. Skeys lets you see what buttons the target you're spectating is pressing. I need some help getting the plugin to be enabled by default for spectating players. Here is the code that I've put together: http://codepad.org/0f79yoFT It's not pretty, basicly straight from jumpassist (which is a mess), with a few alterations. Help appreciated! For reference, here is the source code from jumpassist which I snagged skeys from: https://code.google.com/p/jumpassist/source/browse/scripting/, keep in mind that you have to browse up and down the folders. Thanks!
change: Code: 24 new bool:g_bGetClientKeys[MAXPLAYERS+1]; to Code: 24 new bool:g_bGetClientKeys[MAXPLAYERS+1] = { true, ... }; and change Code: iClientToShow = i; to Code: continue; on line 78 you should also do the IsValidClient() check before grabbing the value of "m_hObserverTarget" (if the player is not in game, you'll get errors and the function will terminate, ignoring any players after them) finally, use continue (not return) in OnGameFrame(), else you'll ignore all players after you reach the first player for whom certain conditions fail
Thanks, jelly, but now it doesn't show anything at all, and it is staggering a lot when I spectate someone in 1st person view. Looks like some sort of memory leak. Here is the code after your changes: http://codepad.org/0KiCGZad
Whoops. The IsValidClient() problerm persists (I indicated the wrong netprop) Here's a fixed version: Code: public OnGameFrame() { new iClientToShow, iObserverMode; for (new i = 1; i < MaxClients; i++) { if (IsClientInGame(i) && IsClientObserver(i) && !IsFakeClient(i) && g_bGetClientKeys) { if (g_iButtons & IN_SCORE) { continue; } iObserverMode = GetEntPropEnt(i, Prop_Send, "m_iObserverMode"); if (iObserverMode == 6) { continue; } iClientToShow = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget"); if (!IsValidClient(iClientToShow)) { continue; } // client and target validated, so do stuff } } }
Jellyfish, I love you. It works like a charm! I urge you to put this on the lethal-zone rocket jump servers (removing Showkeys in the process, as it don't work together with Specinfo).
upload the smx + source and it shall be done. (or herras me some more too, or panromir, or alias, or jellyfish)
Here is the finished plugin: http://www.mediafire.com/download/t2h5uwaangdyc8e/skeys.rar Thanks again, Jelly <3