Raised This Month: $94 Target: $400
 23% 

Realistic Weapon Pickup 0.9


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   General Purpose        Approver:   Exolent[jNr] (178)
shine771
Senior Member
Join Date: Jun 2007
Location: Latvia
Old 12-05-2008 , 15:49   Realistic Weapon Pickup 0.9
Reply With Quote #1

Realistic Weapon Pickup
0.9

Description: I tried to make weapon pickup system more realistic. In the built in sytem you run over a gun - you automaticly pick it up without stopping and actually picking it up. It sucks.. admit it. With this plugin you'll have to stop, crouch and press E to Pick Up a weapon. You can change the min distance from which you can pick it up. So if you like to pick up weapons without crouching, just change the cvar. When you get in a distance to pick up a gun and you're aiming at it, it'll glow in a Purple-Blue color(Changable by cvar), and there will be a little tip just above the round timer - "Press USE to pick up" in the same color as glow.

Cvars:
amx_rwpickup
<1/0> <On/Off> <default:1>
amx_rwp_distance <Units> <Min distance from which you can pick up weapons.> <default:31>
amx_rwp_glow <1/0> <On/Off> <default:1>
amx_rwp_glow_color <R G B> <Glow and tip color in RGB format.> <default: "75 0 255">

Screenshot:

[IMG]http://img220.**************/img220/1820/screenshotrwpcs3.th.jpg[/IMG]

Changes:
0.7
*Initial Release
0.8
*Cleaned the code. Really cleaned it!
*Recoded half of the plugin. Optimized it.
0.9
*Now bots can normally pick up weapons.



Attached Files
File Type: sma Get Plugin or Get Source (rwp.sma - 5156 views - 3.2 KB)
__________________

Last edited by shine771; 12-30-2008 at 20:53.
shine771 is offline
FuZ!on
Senior Member
Join Date: Aug 2007
Old 12-05-2008 , 15:58   Re: Realistic Weapon Pickup 0.7
Reply With Quote #2

This is interesting. Very nice idea. Might not fit my needs but will try it!
FuZ!on is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-05-2008 , 16:08   Re: Realistic Weapon Pickup 0.7
Reply With Quote #3

Interesting, shine771.

Though, I have to say that's not well coded. I think you can use a better way using Ham. Do you mind if I'm trying another way and show here ? ( or you might prefer by PM ? )

Another thing, what about when you aim the weapon and pressing USE, you will be automaticaly crouched and then the weapon added too ? I think it's more realistic.
__________________
Arkshine is offline
shine771
Senior Member
Join Date: Jun 2007
Location: Latvia
Old 12-05-2008 , 16:16   Re: Realistic Weapon Pickup 0.7
Reply With Quote #4

Probably it isn't well coded.. and the code isn't clean either. I think i will make the duck thing after you'll show me your method. Umm.. do you mean hook 4 touches "weaponbox","armoury_entity","weapon_shie ld" and "pdm_money" with one fuction? Like:
Quote:
RegisterHam(Ham_Touch,"armoury_entity","hooke r")
RegisterHam(Ham_Touch,"weaponbox","hooker")
...
?
Btw. Forgot to mention that this plugin supports my other plugin - "player drop money".

P.s. I dont like when someone really remakes the plugin.. i dont feel like the author anymore xd. So can you give the basic idea? Make a list of improvements?
__________________

Last edited by shine771; 12-05-2008 at 16:19.
shine771 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-05-2008 , 16:43   Re: Realistic Weapon Pickup 0.7
Reply With Quote #5

Ok, I can understand. ( yeah, I'm trying to be more diplomatic now. )

Basicaly,

- Hook Ham_Touch, for all provided entities.
- Disable/Enable touch on player when needs.

For hooking +use, I would use FM_CmdStart. Or maybe ( but never tested ), Ham_Use ( if it works, it would be better ) .


About the "make the duck", I said you should aim the weapon, but I think it would be more appropriate when you look on the ground and weapon is near from you. Well it can be customizable.
__________________
Arkshine is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-05-2008 , 16:47   Re: Realistic Weapon Pickup 0.7
Reply With Quote #6

omg shine remove that porn link from your signature -_-
__________________
xPaw is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-05-2008 , 16:50   Re: Realistic Weapon Pickup 0.7
Reply With Quote #7

I must say that when I opened the .sma, I became blind.
Please learn to make clean code.
Using more than 1 statement on a line is very bad.

Also, instead of copying a function from fakemeta_util, just include it.
fakemeta_util is standard with the 1.8.0+ compilers (web compiler is 1.8.0 at least).
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
shine771
Senior Member
Join Date: Jun 2007
Location: Latvia
Old 12-05-2008 , 17:58   Re: Realistic Weapon Pickup 0.8
Reply With Quote #8

xPaw you could have posted something about the plugin -_-.
Uh.. really cleaned the code. It's 200% more readable. Look at the code again, exolent. I hope you wont become blind again :O.
@arkshine: About the Ham_Use. As far as i know, you must specify the entity which is used. In this case, i need to detect when player is pressing use, not on a specific entity. About the duck... The whole point of this plugin is to make this game more realistic. So that users would have to do something, not only run, run, shoot, shoot. I want to remove that automatization, so that players can do something by their selves. I think that automatic ducking is the same thing as just running across the weapon.
Btw: With this plugin you can avoid glitches like, c4 falling behind a crate or any other unreachable place.
__________________

Last edited by shine771; 12-05-2008 at 18:08.
shine771 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-05-2008 , 18:33   Re: Realistic Weapon Pickup 0.8
Reply With Quote #9

Well, I would prefer automatic. I'm pretty sure it will get very annoying after a while. ( I tried and I've stopped few minutes after.) Though, I may block player while the process. Don't know. Anyway it's your plugin so... I don't care. :p

About your current code :

- 0.8 -> "0.7" ^^
- new bool:is_glowing[33][2049] <== whoa. Are you sure that's necessary to create such large array for that ? If I understand well, weapons in a distance will be glow ? Just few weapons should be enough. You can use dynamic array too.
- I hate cvars. You parse each time the same thing, when it need to be parsed only one time, or when the value changes. :/
- new classname[33] ; don't create var in a loop, if you can. It may called severals times, also you can use static too.
__________________
Arkshine is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-05-2008 , 18:47   Re: Realistic Weapon Pickup 0.8
Reply With Quote #10

I'm going to add on to what arkshine said:

Quote:
Originally Posted by arkshine View Post
- new bool:is_glowing[33][2049] <== whoa. Are you sure that's necessary to create such large array for that ? If I understand well, weapons in a distance will be glow ? Just few weapons should be enough. You can use dynamic array too.
- I hate cvars. You parse each time the same thing, when it need to be parsed only one time, or when the value changes. :/
new bool:is_glowing[33][2049]

You should just do a bit sum.

Code:
new g_glowing_ents[33]; // to set a ent glowing for the player g_glowing_ents[id] |= (1<<ent); // to remove g_glowing_ents[id] &= ~(1<<ent); // to check if( g_glowing_ents[id] & (1<<ent) )

I think that should work fine.
Unless I'm being stupid and there is a limit for bits.
If I am being stupid, use a dynamic Array, and push/delete entities when they are(n't) glowing.


--------------------------------

For your cvar with color:
You call that so many times in the plugin.
You call it every AddToFullPack frame, and every time the HUD is shown a message (every 0.1 seconds when enabled).
Instead, hook the new round event and store the colors in global variables each round.

EDIT:

Also, I don't see anywhere that you set the glowing entity to remove the glow if player moves away from the weapon.

EDIT2:

Scratch what I said above about the bit sum.
What you should do is make 1 entity glow at a time.

Code:
new g_glowing_ent[33]; // found an entity g_glowing_ent[id] = ent; // not near any entity g_glowing_ent[id] = -1;

That way, the AddToFullPack forward will automatically remove the glow from the old weapon and put it on the new weapon.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 12-05-2008 at 18:51.
Exolent[jNr] is offline
Reply


Thread Tools
Display Modes

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 05:11.


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