AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Real Weapon Drop (https://forums.alliedmods.net/showthread.php?t=70786)

MPNumB 05-01-2008 13:00

Real Weapon Drop
 
3 Attachment(s)
Description:
This plugin introduces into the game more features related to dropped weapons. Features such as:
  1. Ability to drop weapons up and down - where you aim, in that direction weapon will be thrown.
  2. Ability to manually drop grenades.
  3. Drop all weapons at death. Including grenades and a special box of ammunition.
  4. Drop all weapons on disconnect. Including grenades and a special box of ammunition.
  5. Barrel of dropped weapons is always facing in the same direction as player was looking.

Requires:
FakeMeta
HamSandWich


Cvars:

* "rwd_aimdrop" - Counter-Strike:Source style manual weapon drop.
- "1" - enabled. [default]
- "0" - disabled.

* "rwd_grenadedrop" - ability to manually drop grenades.
- "1" - enabled. [default]
- "0" - disabled.

* "rwd_deathdrop" - drop all weapons on death.
- "1" - enabled. [default]
- "0" - disabled.

* "rwd_disconnectdrop" - drop all weapons on disconnect.
- "1" - enabled. [default]
- "0" - disabled.

* "rwd_modelanglefix" - barrel of the weapon angle fix.
- "1" - enabled. [default]
- "0" - disabled.


Additional info:
Tested in Counter-Strike 1.6 with amxmodx 1.8.2. Various features can be enabled and disabled via cvars. This plugin also has support VIP objectives and grenade trail plugins.


Notes:
Barrel of dropped weapons may be facing in wrong direction if client is using custom weapon models.


Warnings:
In some cases pausing this plugin may lead to glitches, therefor if when needed please use cvars instead. That is if paused in certain moments by other plugins. Manual pauses won't do much harm, except dropped flashes will fill up your flashbang slot to maximum, and ammunition box will be touchable only once.


Credits:
Special thanks to Arkshine for Counter-Strike SDK and big help what he have provided by delivering very useful information! Also big thanks goes to eDark for calculation functions!


Change-Log:

* 2.3
- Fixed: Crash at mapchange if there's too many players and other entities.
- Changed: More reliability when saving number of dropped bullets and flash grenades.

* 2.1
- Changed: Minor performance improvement.

* 2.0
- Fixed: Grenades do not bounce insane when dropped.
- Fixed: VIPs can't no longer pick-up ammunition.
- Fixed: VIPs also do drop their weapons if have any.
- Changed: Full plugin rewrite - plugin is now much more stable.

* 1.4
- Fixed: "grenade bounce for ever" by adding gravitation level manually.

* 1.3
- Fixed: Explode grenade on death if it's not armed.
- Added: Grenade drop.

* 1.2
- Fixed: Due to bug in standard ArrayDeleteItem(Array:which, item) native I created my own working one.

* 1.1
- Changed: (code) Modified array clear (less cpu usage - I think).
- Changed: (code) Entity scan (less cpu usage).
- Changed: (code) Unneeded data getting from array - removed (less cpu usage).

* 1.0
- First release.

bigbud 05-01-2008 17:56

Re: Real Weapon Drop
 
Again a nice Work...

+karma

Seker 05-01-2008 19:44

Re: Real Weapon Drop
 
will try it out

+karma ;)

BOYSplayCS 05-01-2008 21:15

Re: Real Weapon Drop
 
Omg.

Amazing.

Emp` 05-01-2008 22:30

Re: Real Weapon Drop
 
Code:

parse(buffer, s_ent, 4, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0);
// ->
parse(buffer, s_ent, 4);

Code:

        while( (ent=engfunc(EngFunc_FindEntityByString, ent, "classname", "weaponbox"))>0 )
        {
                if( ent>0 )
//you already check if the ent is >0 in the while loop

Code:

                classname = "";
// ->
                copy(classname, 1, "");
//poor way to clear an array

Code:

set_task(0.01,
//this just rounds down to 0.0, but look at next comment

don't see a point in modify_death_speed(weaponbox_ent) because you already set the velocity in weaponbox_spawned(weaponbox_ent, owner) so it really isn't doing anything
Code:

                                buffer = "";
//same as other comment with clearing array

Approval with changes and confirmation that it works.

atomen 05-02-2008 03:33

Re: Real Weapon Drop
 
Nice Plugin.

NOTE : The plugin works fine

BloodMan 05-02-2008 04:37

Re: Real Weapon Drop
 
Good Job.

MPNumB 05-02-2008 06:05

Re: Real Weapon Drop
 
Quote:

Originally Posted by Emp` (Post 620011)
Code:

parse(buffer, s_ent, 4, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0, "", 0);
// ->
parse(buffer, s_ent, 4);

Code:

        while( (ent=engfunc(EngFunc_FindEntityByString, ent, "classname", "weaponbox"))>0 )
        {
                if( ent>0 )
//you already check if the ent is >0 in the while loop

Code:

                classname = "";
// ->
                copy(classname, 1, "");
//poor way to clear an array

Code:

set_task(0.01,
//this just rounds down to 0.0, but look at next comment

don't see a point in modify_death_speed(weaponbox_ent) because you already set the velocity in weaponbox_spawned(weaponbox_ent, owner) so it really isn't doing anything
Code:

                                buffer = "";
//same as other comment with clearing array

Approval with changes and confirmation that it works.

1. Agree, but didn't know, that it's poss. =P
2. If there are no weaponbox'es that while will be true, but only once (first check), that's why I'm checking it twice.
3. Kk, will change array clear, but just quiruous - what's the diffrence?
4. Set task 0.01 - exucates task in next frame (if 100 fps). Kz_jump_plugin uses the same set_task time to remove duck when teleported. Example: c4 exploaded - predeath - player speed is low speed. Delay - modifyes speed to explotion speed, what can be much bigger.

But ok. I'll make all that, butwont change delay, cuz i'm 100% sure, that it works. I was impressed finding that out two, but belive me - it makes a delay even with 0.0 will make 1 frame delay.

// edit:

Updated to 1.1 :
Changed: (code) modifyed array clear (less cpu usage - I think).
Changed: (code) entity scan (less cpu usage).
Changed: (code) unneded data getting from array - removed (less cpu usage).

Exolent[jNr] 05-02-2008 07:25

Re: Real Weapon Drop
 
I read somewhere that the best way to clear a string is to set the first character to ^0.
Example:

Code:
static sString[32]; sString[0] ='^0';

MPNumB 05-02-2008 07:28

Re: Real Weapon Drop
 
Quote:

Originally Posted by X-olent (Post 620135)
I read somewhere that the best way to clear a string is to set the first character to ^0.
Example:

Code:
static sString[32]; sString[0] ='^0';

and then:
Code:

client_print(0, print_chat, sString[1]);
:D

In other words it clears only first symbol. But if print will start from it - it wont print nothing. And isn't it 0x00 or just 0? :D


All times are GMT -4. The time now is 18:59.

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