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

Drop weapon when ammo is over


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lqlqlq
Senior Member
Join Date: Jan 2008
Old 02-04-2012 , 06:16   Drop weapon when ammo is over
Reply With Quote #1

Please, give me a simple script about that.
Thanks!
lqlqlq is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-04-2012 , 16:21   Re: Drop weapon when ammo is over
Reply With Quote #2

Hook CurWeapon where 1=1 and check if the clip ammo and bp ammo are 0.
If the ammos are 0, then force "drop" command with engclient_cmd().
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
lqlqlq
Senior Member
Join Date: Jan 2008
Old 03-10-2012 , 07:22   Re: Drop weapon when ammo is over
Reply With Quote #3

Any help ?
PP: Exo, thanks, but i dont understand.
lqlqlq is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 03-10-2012 , 07:42   Re: Drop weapon when ammo is over
Reply With Quote #4

Quote:
Originally Posted by Exolent[jNr] View Post
Hook CurWeapon where 1=1 and check if the clip ammo and bp ammo are 0.
If the ammos are 0, then force "drop" command with engclient_cmd().
if another player picks it up, then it would get dropped again right?
EpicMonkey is offline
lqlqlq
Senior Member
Join Date: Jan 2008
Old 03-10-2012 , 08:17   Re: Drop weapon when ammo is over
Reply With Quote #5

not, i ready to merge with another script (which will automatically delete the dropped weapons on the ground)

Last edited by lqlqlq; 03-10-2012 at 08:17.
lqlqlq is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-10-2012 , 08:21   Re: Drop weapon when ammo is over
Reply With Quote #6

@Exolent
I tried with engclient_cmd() first but it seemed to crash my server every time.
It leaves me in game with 1/0 ammo & everything stops.

It works with client_cmd() for me, but it doesn't seem to work on (pod)bots.

EDIT: Thanks to Bibu, it now works with engclient_cmd() & bots.


PHP Code:
// http://forums.alliedmods.net/showthread.php?t=177624

#include <amxmodx>
#include <cstrike>

#pragma semicolon    1
#define Version        "1.0.1"


public plugin_init()
{
    
register_plugin("Auto-drop Empty Weapons"Version"Drekes");
    
    
register_event("CurWeapon""EventCurWeapon""be""1=1""3=0"
        
"2!29"    // CSW_KNIFE
        
"2!6"        // CSW_C4
        
"2!4"        // CSW_HEGRENADE
        
"2!9"        // CSW_SMOKEGRENADE
        
"2!25"    // CSW_FLASHBANG
    
);
}


public 
EventCurWeapon(id)
{
    new 
iWeapon    read_data(2);
    if(!
cs_get_user_bpammo(idiWeapon))
    {
        new 
szWeaponName[20];
        
get_weaponname(iWeaponszWeaponNamecharsmax(szWeaponName));
        
engclient_cmd(id"drop"szWeaponName);
    }

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 03-11-2012 at 09:28.
drekes is offline
Send a message via MSN to drekes
lqlqlq
Senior Member
Join Date: Jan 2008
Old 03-10-2012 , 08:40   Re: Drop weapon when ammo is over
Reply With Quote #7

@drekes, this not work on steam, right ?
Please, give me a method with engclient_cmd().
lqlqlq is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-10-2012 , 09:01   Re: Drop weapon when ammo is over
Reply With Quote #8

Change client_cmd() to engclient_cmd()?
hleV is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-11-2012 , 09:28   Re: Drop weapon when ammo is over
Reply With Quote #9

Edited code above.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 08:11.


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