Page 1 of 1

Hitmarker + Damage Stats

Posted: Fri Sep 12, 2014 5:42 pm
by stonedegg
This plugin is a revision of my Hitmarker plugin I made for eventscripts some time ago.


What it does:
When a player hurts or blinds another player, a hitmarker will be shown at his crosshair (Call of Duty style).
Furthermore it shows every player their damage stats at the end of the round (how much damage dealt and taken and to/by whom).

Players can change their settings individually by typing !settings.


Screenshots:
2.jpg
2.jpg



Download:

Posted: Fri Sep 12, 2014 8:41 pm
by Ayuto
Well done! Though, I have a few suggestions.

1. You don't need to care about making materials downloadable. SP will take care of it, if you just do this.

Syntax: Select all

dl = Downloadables()
dl.add("materials/overlays/hitmarker/hitmarkerv2.vmt")
dl.add("materials/overlays/hitmarker/hitmarkerv2.vtf")
The variable "dl" must exist as long as the script is loaded. So, the easiest option is to put it directly at the global scope.

2. This callback is redundant.

Syntax: Select all

def damage_callback(menu, index, option):
menu.close(index)
The menu will automatically close if you have selected something. Closing it again has no effect.

3. If you use the SayCommand decorator, SP will take care of registering/unregistering the say command.

Syntax: Select all

@SayCommand('!settings')
def settingsCommand(playerinfo, teamonly, command):
# ...

Posted: Sat Sep 13, 2014 1:13 am
by satoon101
Awesome! I am also working on a damage stats plugin, a rewrite of my ES victim_stats script:
https://github.com/satoon101/VictimStats

To clarify the Downloadables points Ayuto made, if you create the Downloadables instance in the global scope, when you unload the script, the strings are removed from the main downloadable list. The stringtable itself will still contain the values until map change. Speaking of map change, once you add values to your Downloadables set, they are automatically added to the downloadables stringtable then and every map change until your script is unloaded (or removes them from its set).

As far as user settings, as mentioned a bit in another thread, this is already mostly implemented as its own package. I haven't finished its wiki page, but did start it a few days ago:
http://wiki.sourcepython.com/index.php/settings.player

Posted: Sat Sep 13, 2014 7:30 pm
by stonedegg
Thanks! :)
I will update the script soon with your suggestions.

@satoon, I know about the settings module, tho I don't know quite yet how to use it. An example script with an implementation would be nice. ;)

Posted: Wed Sep 17, 2014 3:56 pm
by satoon101
In relation to the settings package, I finally got the string settings working just fine, but still need to work on adding menus for the integer/float settings (and possibly add in a bool setting). I will work on testing the current master branch on Linux and CS:GO tonight and hopefully post a new release, if all goes well. As for a working example script, you might take a look at my victim_stats plugin:
https://github.com/satoon101/VictimStats

Only chat messages are working in it, currently, but the user settings do work.

My most_damage plugin has user settings, too, but I haven't tested it since I made some recent changes.
https://github.com/satoon101/MostDamage