Raised This Month: $ Target: $400
 0% 

Get the weapon your aiming at


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Martin1
BANNED
Join Date: May 2006
Old 11-07-2006 , 16:19   Get the weapon your aiming at
Reply With Quote #1

Is there a way to get the weapon your aiming at the floor. Im trying to make a plugin that allows you to have more than 1 weapon by making it so when you press the key , it tells the script to remember what weapon it was, then add to the players hand that weapon.
Martin1 is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-08-2006 , 04:20   Re: Get the weapon your aiming at
Reply With Quote #2

You can use for example fm_get_aim_origin from the Fakemeta Utilities and check with fm_find_ent_in_sphere if there are entities close to the aim point (set the short radius for that).

If so - check whether it's a weaponbox entity (classname). If so - get the linked weapon_* entity (classname). You can use for example fm_find_ent_by_integer(-1, pev_owner, weaponbox_entity_index_here) for that.

Then you should check whether the player already have this weapon or not. You can use for example
fm_find_ent_by_owner(-1, weapon_entity_classname, player_index) for that.

Also check if the weapon isn't a C4. In CS a player will be able to collect it mannually anyway, also this will avoid breaking of some specific things.

If so - give the found weapon to a player. You can use for example fm_give_item(player_index, weapon_entity_classname) for that.

Then all you have to do is delete the weaponbox and entity that linked to it. Don't try to delete them with default methods, it may crash your server. Use dllfunc(DLLFunc_Think, weaponbox_entity_index) for that.

Last edited by VEN; 11-08-2006 at 04:35.
VEN 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 06:58.


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