Raised This Month: $ Target: $400
 0% 

Clip Percent Display


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Statistical       
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-25-2012 , 14:16   Clip Percent Display
Reply With Quote #1

This mod was written by me upon request by fearmelfice at http://forums.alliedmods.net/showthread.php?t=188255

It displays the percent of your clip you have left, when around %50 and %10.

Real simple. Probably even unapprovable. But....this is better than PMing it. Especially in case anyone else wants it.....

To Do:
Whatever anyone needs
ML support, if needed
Attached Files
File Type: sma Get Plugin or Get Source (clip_display.sma - 811 views - 3.4 KB)
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-25-2012 at 14:38. Reason: Removed debug prints from source
Liverwiz is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-25-2012 , 14:18   Re: Clip Percent Display
Reply With Quote #2

v1.1 is in the works.

I only have a few ideas of what to add to it. I'm open for great suggestions! Optimization/features anyone?

Already have:
User command to toggle
CVARs for percents to display
Optimization of trigger code
Better handling of small clips (clip < needs different thresholds
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-27-2012 at 18:04.
Liverwiz is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-25-2012 , 14:21   Re: Clip Percent Display
Reply With Quote #3

Code:
client_print(0, print_console, "Someone fired!") client_print(invoker, print_console, "You fired! weapon: %d, clip: %d, clipSize: %d, calc: %f, percent: %d", weapon, ammo, clipSize[weapon], calc, percent)

You might want to take those out, so the players don't get spammed.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-25-2012 , 14:36   Re: Clip Percent Display
Reply With Quote #4

Quote:
Originally Posted by Exolent[jNr] View Post
Code:
client_print(0, print_console, "Someone fired!") client_print(invoker, print_console, "You fired! weapon: %d, clip: %d, clipSize: %d, calc: %f, percent: %d", weapon, ammo, clipSize[weapon], calc, percent)

You might want to take those out, so the players don't get spammed.
LOL
looks like some of my bug-reports leaked in, didn't it? That will be fixed like....now.

EDIT: fixed.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-25-2012 at 14:38.
Liverwiz is offline
Old 06-25-2012, 19:21
fysiks
This message has been deleted by fysiks. Reason: off topic
Old 06-25-2012, 19:37
Liverwiz
This message has been deleted by YamiKaitou. Reason: reply to deleted post
Old 06-25-2012, 19:44
Exolent[jNr]
This message has been deleted by YamiKaitou. Reason: reply to deleted post
Old 06-25-2012, 23:29
fysiks
This message has been deleted by fysiks. Reason: off topic
Old 06-25-2012, 23:59
Liverwiz
This message has been deleted by YamiKaitou. Reason: reply to deleted post
Old 06-26-2012, 00:05
fysiks
This message has been deleted by fysiks. Reason: off topic
Old 06-26-2012, 00:07
Liverwiz
This message has been deleted by YamiKaitou. Reason: reply to deleted post
Old 06-26-2012, 00:09
fysiks
This message has been deleted by fysiks. Reason: off topic
Old 06-26-2012, 00:21
Liverwiz
This message has been deleted by YamiKaitou. Reason: reply to deleted post
fearmelfice
Junior Member
Join Date: Apr 2012
Old 06-26-2012 , 01:18   Re: Clip Percent Display
Reply With Quote #5

hmm i'm gunna test it right now
thanks dude
__________________
i haven't submitted any plugins yet

Last edited by fearmelfice; 06-26-2012 at 01:20.
fearmelfice is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-26-2012 , 02:18   Re: Clip Percent Display
Reply With Quote #6

PHP Code:
    ,    1    // vest
    
,    1    // vesthelm 
I think you can remove those ones
Also, you don't need to hook precacheEvent, you can just send it with wanted events in plugin_init, it has already been sent by the game and you only retrieve original values, so result is the same but code may appear a bit cleaner, your choice. (you can also then move g_guns_events to local var)

Plugin is so small that you should enable more features, like print in chat instead of hud for example, and for hud, dynamic percentage color, like from red (0%) to green (100%).
May be add the same message when a player is deploying a weapon.
Etc... (i don't see other ones lol)
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-26-2012 at 02:18.
ConnorMcLeod is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-26-2012 , 09:59   Re: Clip Percent Display
Reply With Quote #7

Quote:
Originally Posted by fearmelfice View Post
hmm i'm gunna test it right now
thanks dude
My pleasure. Post in here with anything else you want/bugs you find.

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
    ,    1    // vest
    
,    1    // vesthelm 
I think you can remove those ones
Also, you don't need to hook precacheEvent, you can just send it with wanted events in plugin_init, it has already been sent by the game and you only retrieve original values, so result is the same but code may appear a bit cleaner, your choice. (you can also then move g_guns_events to local var)

Plugin is so small that you should enable more features, like print in chat instead of hud for example, and for hud, dynamic percentage color, like from red (0%) to green (100%).
May be add the same message when a player is deploying a weapon.
Etc... (i don't see other ones lol)
Yeah i was thinking that some other things in there would be nice. But since it was upon request i didn't want to add too much unwanted crap.
As for the pre-cache code....i really just CopyPasta'd from VEN. If the need for a v1.1 I'll fix it up a bit, but as of now....it works to what i believe the requester wanted.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-26-2012 at 10:01.
Liverwiz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-26-2012 , 11:20   Re: Clip Percent Display
Reply With Quote #8

Quote:
Originally Posted by Liverwiz View Post
But since it was upon request i didn't want to add too much unwanted crap.
This is not a good reason to not implement things to make your plugin more customizable.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 06-26-2012 , 12:25   Re: Clip Percent Display
Reply With Quote #9

I'm not sure if i should make a new thread in the scripting section, so, I will just ask here.

Code:
ShowSyncHudMsg(invoker, g_hudObj, "Your clip is at %%%d", percent)

Why did you put 2 extra && before %d?
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-26-2012 , 12:46   Re: Clip Percent Display
Reply With Quote #10

Quote:
Originally Posted by pokemonmaster View Post
I'm not sure if i should make a new thread in the scripting section, so, I will just ask here.

Code:
ShowSyncHudMsg(invoker, g_hudObj, "Your clip is at %%%d", percent)

Why did you put 2 extra && before %d?
https://forums.alliedmods.net/showthread.php?t=188255
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode