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

Avalanche's TS Weapon Functions BETA V v3


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-05-2006 , 16:30   Avalanche's TS Weapon Functions BETA V v3
Reply With Quote #1

Attached is ava_ts.inc, which includes the following functions for The Specialists 2.1:

ts_get_user_tsgun
gets the entity index of the player's weapon_tsgun.

ts_set_weapon_clip
sets the amount of ammo in clip for a player's weapon.

ts_set_weapon_ammo
sets the amount of backpack (not in clip) ammo for a player's weapon.

ts_set_weapon_rof
sets the rate of fire for a player's weapon.

ts_set_weapon_extras
sets the extras of a player's weapon.

ts_get_weapon_info
like ts_getuserwpn, except that you can specify a weapon to get information about, so as to grab info of weapons not currently drawn.

ts_get_user_weapons
the TS equivalent to AMXx's base get_user_weapons.

ts_set_weapon_ready
sets whether a weapon is "ready" or not.

The include itself contains more documentation. Note that this requires tsx/tsfun and fakemeta to use.

TS can only display a number as high as 216 (-ish) for the clip display, and there is probably a limit on the backpack ammo display as well. Although only certain numbers can be displayed, the actual amount of bullets can be much more.

Silencers on weapons that don't normally have them will make the gunfire sound extremely quiet or non-existant. Lasersights on weapons that don't normally have them will work, but won't point in the correct direction. Flashlights on weapons that don't normally have them work perfectly. You can't add scopes to weapons that don't normally have them.

Custom rates of fire work across all weapons. Pump-action on non-pump-action shotguns acts like full-auto. Burst fire does not work on pump-action shotguns (they won't fire at all). Free semi on non-akimbo weapons acts like semi-auto. Free full on non-akimbo weapons acts like full-auto. Besides those exceptions, all rates of fire work on all weapons. Also, of course, you can't change ROF on weapons that don't normally have a ROF anyway (grenades, knives, katanas, etcetera).

Messages are by default sent as emessages, so watch out for recursive functions (ie: calling one of these functions in a WeaponInfo hook). This is so that AMXx receives the new values, for when someone calls ts_getuserwpn. The last parameter of functions that send HUD messages controls whether or not to send as an emessage or regular message. See the include for full details.

Tested on a Windows 32-bit server. I have no clue as to the offset for 64-bit servers, and I'm not 100% sure that my Linux +4 offset is correct. If a Linux server op could test this for me I would be extremely grateful.
Attached Files
File Type: inc ava_ts.inc (20.2 KB, 626 views)
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS

Last edited by XxAvalanchexX; 11-07-2006 at 16:16.
XxAvalanchexX is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 11-05-2006 , 17:13   Re: Avalanche's TS Weapon Functions BETA II
Reply With Quote #2

Good job , this will solva alot of problems for people. ++karma
The Specialist is offline
Send a message via AIM to The Specialist
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-05-2006 , 21:41   Re: Avalanche's TS Weapon Functions BETA III
Reply With Quote #3

Added ts_get_user_tsgun, ts_set_weapon_rof, and ts_set_weapon_extras. Cleaned up some more code. Fixed some possible bugs. Added a flag to certain functions which allows you to send the HUD updates as emessages instead of regular messages, so that other plugins recognize when you change something. You can now add any attachment to any weapon, and set any rate of fire for any weapon (wooh burst fire barrett!).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS

Last edited by XxAvalanchexX; 11-05-2006 at 22:15.
XxAvalanchexX is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-05-2006 , 21:58   Re: Avalanche's TS Weapon Functions BETA III
Reply With Quote #4

I know how much you want to make me one for DOD

gj btw
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
stupok
Veteran Member
Join Date: Feb 2006
Old 11-05-2006 , 22:39   Re: Avalanche's TS Weapon Functions BETA III v2
Reply With Quote #5

Holy f***ing s*** Avalanche, I love you.

I was impressed enough when you made ts_set_weapon_clip, this extra stuff is just blowing me away. I'm gonna have a lot of fun thanks to you
stupok is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-06-2006 , 01:28   Re: Avalanche's TS Weapon Functions BETA IV
Reply With Quote #6

Fixed emessages. Now emessages are default (before, regular messages were), so watch out for recursive functions (ie: calling one of these functions in a WeaponInfo hook).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-06-2006 , 20:01   Re: Avalanche's TS Weapon Functions BETA V
Reply With Quote #7

Added ts_get_weapon_info and ts_get_user_weapons. Also probably fixed some bugs.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 11-06-2006 , 21:14   Re: Avalanche's TS Weapon Functions BETA V v2
Reply With Quote #8

I want to thank you again for taking the time to do all of this, and for doing it so well .

You rock.



The clients on my server are loving it as much as I am.

Last edited by stupok; 11-06-2006 at 21:21.
stupok is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-06-2006 , 23:17   Re: Avalanche's TS Weapon Functions BETA V v2
Reply With Quote #9

What is your server's IP?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-07-2006 , 16:18   Re: Avalanche's TS Weapon Functions BETA V v3
Reply With Quote #10

Optimized a little bit. Restricted attempting to set clip or ammo for the katana. The "ammo" field set by ts_get_weapon_info will now be -1 if the weapon uses clip only (grenades, knives, etcetera). Renamed __tsROFoffset to __tsROFbase for clarity.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 20:44.


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