Raised This Month: $32 Target: $400
 8% 

CS/DoD/TFC Weapon Gravity


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Gameplay        Approver:   Zenith77 (33)
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 09-16-2007 , 22:33   CS/DoD/TFC Weapon Gravity
Reply With Quote #1

Quote:
/********************************************* *******
*
* Name: CS/DoD/TFC Weapon Gravity
* Author: M249-M4A1
* Idea: X-Script
* Version: 2.0
* Date: 10-06-2007
*
* Description:
* - Players will have a different personal gravity, depending on the weapon that
* they are currently using.
*
* Commands:
* - say /weapongrav
* - amx_reload_weapongrav [SERVER COMMAND]
* - amx_weapon_gravity <1=ON|0=OFF> [REQUIRES ADMIN_BAN FLAG]
*
* Command Details:
* - say /weapongrav toggles weapon gravity on or off (only for that person who typed it)
* - amx_reload_weapongrav reloads gravity configuration file
* - amx_weapon_gravity toggles the weapon gravity plugin on/off
*
* CVARs:
* - [CS] cs_weapon_gravity <1=ON|0=OFF> - enables/disables the plugin (default enabled)
* - [DoD] dod_weapon_gravity (same as above)
* - [TFC] tfc_weapon_gravity (same as above)
*
* Notes:
* - This plugin may interfere with other gravity plugins.
* - Refer to the gravity configuration file "m2_weapon_gravity.ini" file for instructions
* on editing weapon gravities.
*
* Special Thanks (and Credits):
* - X-Script, for their idea of making this plugin, and letting me take over.
* - Zenith77, for many great suggestions to make this plugin better, and providing me with alternative
* code for efficiency and ease of use.
* - EJL's Sound Download Management for the read-from-file example.
* - Bahrmanou, for their method of messaging all players except the caller.
*
* Changelog:
* - 1.0: Initial release
* - 1.5: Cleaned up code; Added lower gravity for all weapons; Added CVAR to enable/disable plugin
* - 1.6: Removed a useless variable; Removed as much white space as possible; Added comments
* - 1.6b: Added ability for clients to enable/disable weapon gravity; Say /weapongrav to toggle
* - 1.6c: Fixed bug where clients could not turn off weapon gravity; Added information message when player joins
* - 1.7: Plugin now reads from a configuration file; Default configuration file is:
* "addons/amxmodx/configs/tfc_weapon_gravity.ini" but can be changed (edit CONFIGFILE in the define section below)
* - 1.7b: Code revision; Added Credits
* - 1.7c: Cleaned up code; Changed CVAR name: "amx_tfcgravity" to "tfc_weapon_gravity"
* - 1.7d: Notify all players (except caller) of the caller's gravity change; Added command to toggle plugin on/off
* - 1.8: Updated "tfc_weapon_gravity.ini" and updated some code
* - 1.9: Supports Counter-Strike, Day of Defeat, and Team Fortress Classic
* - 2.0: One gravity configuration file: "m2_weapon_gravity.ini"
*
********************************************* *******/
Attached Files
File Type: ini m2_weapon_gravity.ini (3.3 KB, 793 views)
File Type: sma Get Plugin or Get Source (m2_weapon_gravity.sma - 2188 views - 10.4 KB)
__________________

Last edited by M249-M4A1; 01-27-2010 at 04:14. Reason: Demonstration video no longer available
M249-M4A1 is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 09-16-2007 , 22:36   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #2

Oh yeah, this is pretty much how X-Script left it. Zenith suggested an alternate method of editing the values, so I'll be adding that user-friendly alternative in like 10 minutes...
__________________

Last edited by M249-M4A1; 09-30-2007 at 15:21.
M249-M4A1 is offline
Old 09-18-2007, 11:43
_Tool_
This message has been deleted by Roach. Reason: Opinions arent needed in this. If you have an issue take it to a PM.
Zenith77
Veteran Member
Join Date: Aug 2005
Old 09-18-2007 , 18:29   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #3

This is why I suggested the plugin should read from a file. Also, the admin should be able to turn on or off a cvar that allows clients to turn off the gravity changes.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Stixsmaster
Veteran Member
Join Date: May 2007
Location: I am all around you...I
Old 09-18-2007 , 19:08   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #4

The idea behind this type of plugin is to add more challenge to the game...

---Stixsmaster
__________________
Stixsmaster is offline
Send a message via AIM to Stixsmaster Send a message via MSN to Stixsmaster
Old 09-19-2007, 15:56
X-Script
This message has been deleted by Roach. Reason: Reply to deleted post
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 09-21-2007 , 15:57   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #5

Quote:
Originally Posted by Stixsmaster View Post
The idea behind this type of plugin is to add more challenge to the game...

---Stixsmaster
Exactly.
X-Script is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 09-21-2007 , 16:14   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #6

Fixed a bug in the plugin, refer to changelog for details.
__________________
M249-M4A1 is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 09-22-2007 , 12:20   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #7

This needs more functionality before approval. I find it's pretty pointless, and I don't think many people will use this in the fist place in its current state. Follow my given suggestion(s) here and in the previous threads.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 09-22-2007 , 13:14   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #8

Now updated with configuration file!
__________________

Last edited by M249-M4A1; 09-23-2007 at 11:29.
M249-M4A1 is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 09-24-2007 , 00:29   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #9

Some things that need to be done:

  1. Code:
    set_task(1.0, "ReadFile")
    I personally use plugin_cfg() to load plugin configuration. You don't have to do this however, just making a note.

  2. Code:
        if (get_pcvar_num(g_WpnGrav) < 1) {         client_print(id, print_chat, "[AMXX] : Weapon gravity has been disabled by the admin!")         return PLUGIN_HANDLED         } else if (PersonalGrav[id] == false) {         PersonalGrav[id] = true         weapongravity(id)         client_print(id, print_chat, "[AMXX] : Your gravity now adjusts to the weapon you are holding! Say /weapongrav again to turn it off!")         } else {         PersonalGrav[id] = false         weapongravity(id)         client_print(id, print_chat, "[AMXX] : Your weapon gravity has been turned off! Say /weapongrav to turn it back on!")     }
    Dear God indent this correctly. Do this for all other areas that occur like this. In fact you may just want to consider using an auto-indenter.

  3. Code:
                i++             gTFCWeaponGravityList[i - 1] = str_to_float(readin)

    Change that to:
    Code:
                gTFCWeaponGravityList[i++] = str_to_float(readin)
  4. Please give proper credit to users who helped formed your code. Thanks.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred

Last edited by Zenith77; 09-24-2007 at 00:31.
Zenith77 is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 09-24-2007 , 08:55   Re: TFC Weapon Gravity (X-Script)
Reply With Quote #10

The AMXX Studio did the indenting for me, becuase I did } else { it shows up on the same line. But yeah, I'll make those changes soon. As for the code, if you are referring to the read from file, i used the sound download management line to get me started, the rest was all trial and error.

...and thanks for the feedback, zenith!

EDIT: changes made!!!!
__________________

Last edited by M249-M4A1; 09-24-2007 at 17:02.
M249-M4A1 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 18:52.


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