AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Weapon-dependant gravity (https://forums.alliedmods.net/showthread.php?t=186696)

Backstabnoob 06-02-2012 15:59

Weapon-dependant gravity
 
7 Attachment(s)
Weapon-dependant gravity

This is probably the shortest and the most "codeless" plugin ever made. I didn't think it would be THIS easy when I got this idea, but well... it was. It's up to the approvers whether they'll approve these few lines of code or not.


Description
This plugin changes users gravity according to all the weapons they currently hold. The weight of weapons should be realistic, found the values on wikipedia :D. For example, if the user holds a M249, their gravity would be increased to somewhere around 120%. However, if they hold both Desert Eagle and M249, it will be 130% (just a guess). Tested, works well.

Cvars
None. If you got an idea for a cvar, drop it in this topic.

Changelog

0.1
  • Now counts all weapons in user's inventory
  • More optimized
  • Uses HamSandwich hooks instead of CurWeapon
  • Changed to work with flashbangs as well; other grenades are still counted as 1 though

Counter-Strike only


xPaw 06-02-2012 16:03

Re: Weapon-dependant gravity
 
http://forums.alliedmods.net/showthread.php?p=864835

Backstabnoob 06-02-2012 16:13

Re: Weapon-dependant gravity
 
There actually is a huge difference between the two mods. This one:

- is really short, probably won't affect the server CPU at all,
- uses a completely different way of calculating the gravity,
- doesn't use cstrike module so it probably works on all mods
- is readable

xPaw 06-02-2012 16:23

Re: Weapon-dependant gravity
 
Quote:

Originally Posted by Backstabnoob (Post 1721607)
doesn't use cstrike module so it probably is works on all mods

It won't work properly on all mods, because you have predefined gravity list specifically for cstrike.

Backstabnoob 06-02-2012 16:28

Re: Weapon-dependant gravity
 
That's true. I might add constants for other mods later, but I don't feel like finding the weights for 100 other weapons right now so it is cstrike only.

ConnorMcLeod 06-02-2012 17:02

Re: Weapon-dependant gravity
 
http://forums.alliedmods.net/showthread.php?t=60218

http://forums.alliedmods.net/showthread.php?p=532149

:)

Arkshine 06-02-2012 17:11

Re: Weapon-dependant gravity
 
Redundant, poor method (changing gravity in CurWeapon, seriously?). Existing plugins are way better and more complete.

Unapproved.

Backstabnoob 06-02-2012 17:18

Re: Weapon-dependant gravity
 
Quote:

Originally Posted by Arkshine (Post 1721648)
Redundant, poor method (changing gravity in CurWeapon, seriously?). Unapproved.

Poor method? What? Don't know if you are joking, but you know, CurWeapon is fired when player changes the weapon which is excellent for this. Did you even bother reading what this plugin does?

get_user_weapon() in Ham_Item_PreFrame post returns the last weapon, not the current. Please show me a "less poor" method.

Arkshine 06-02-2012 17:33

Re: Weapon-dependant gravity
 
For your information, the event you hook is called for the active weapon, so each time you fire, you set the gravity... Yes, poor method.

Backstabnoob 06-02-2012 17:39

Re: Weapon-dependant gravity
 
And how does that matter? How is that worse than setting the maxspeed in CurWeapon which is what 98% of the speed-changing plugins do? Aren't these poorly coded as well?

I asked for a less poor method, so please be that kind and show me that way. I want to learn from my mistakes.


All times are GMT -4. The time now is 10:05.

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