Raised This Month: $ Target: $400
 0% 

Weapon-dependant gravity


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay        Approver:   Arkshine (91)
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-02-2012 , 15:59   Weapon-dependant gravity
Reply With Quote #1

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 . 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

Attached Files
File Type: sma Get Plugin or Get Source (weapon_dependant_gravity.sma - 1595 views - 2.4 KB)

Last edited by Backstabnoob; 06-03-2012 at 07:34.
Backstabnoob is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-02-2012 , 16:03   Re: Weapon-dependant gravity
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?p=864835
__________________
xPaw is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-02-2012 , 16:13   Re: Weapon-dependant gravity
Reply With Quote #3

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

Last edited by Backstabnoob; 06-02-2012 at 16:23.
Backstabnoob is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-02-2012 , 16:23   Re: Weapon-dependant gravity
Reply With Quote #4

Quote:
Originally Posted by Backstabnoob View Post
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.
__________________
xPaw is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-02-2012 , 16:28   Re: Weapon-dependant gravity
Reply With Quote #5

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.

Last edited by Backstabnoob; 06-02-2012 at 16:31.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-02-2012 , 17:02   Re: Weapon-dependant gravity
Reply With Quote #6

http://forums.alliedmods.net/showthread.php?t=60218

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

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-02-2012 , 17:11   Re: Weapon-dependant gravity
Reply With Quote #7

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

Unapproved.
__________________

Last edited by Arkshine; 06-02-2012 at 17:22.
Arkshine is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-02-2012 , 17:18   Re: Weapon-dependant gravity
Reply With Quote #8

Quote:
Originally Posted by Arkshine View Post
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.

Last edited by Backstabnoob; 06-02-2012 at 17:24.
Backstabnoob is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-02-2012 , 17:33   Re: Weapon-dependant gravity
Reply With Quote #9

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.
__________________
Arkshine is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-02-2012 , 17:39   Re: Weapon-dependant gravity
Reply With Quote #10

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.

Last edited by Backstabnoob; 06-02-2012 at 17:42.
Backstabnoob 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 11:58.


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