Raised This Month: $ Target: $400
 0% 

setting ammo when reloading


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-21-2005 , 12:58   setting ammo when reloading
Reply With Quote #1

Code:
#include<amxmodx>
#include<cstrike>
#include<engine>

public plugin_init(){
	register_plugin("Test","1.0","cheap_suit")
}

public reload(){
	if(get_user_button(id)&IN_RELOAD){
	cs_set_weapon_ammo ( id,0) 
	}
}
cant you tell me whats wrong?
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 02-21-2005 , 13:39  
Reply With Quote #2

ya, your public reload() function never gets called..

what are you trying to do?
xeroblood is offline
Send a message via MSN to xeroblood
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-21-2005 , 14:38  
Reply With Quote #3

trying to set ammo to 0 when they press reload
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 02-21-2005 , 14:56   easy
Reply With Quote #4

I would use client_PreThink, like this:

Code:
public client_PreThink(id) {     if(get_user_button(id) & IN_RELOAD) {         new clip, ammo         new weapon = get_user_weapon(id, clip, ammo)         cs_set_user_bpammo(id, weapon, 0)     }     return PLUGIN_HANDLED }
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-21-2005 , 18:01  
Reply With Quote #5

Code:
#include<amxmodx> 
#include<cstrike> 
#include<engine> 

public plugin_init(){ 
   register_plugin("fullclipreload","1.0","cheap_suit")
} 

public client_PreThink(id) { 

    if(get_user_button(id) & IN_RELOAD) { 

        new clip = cs_get_weapon_ammo(id) 

        cs_set_weapon_ammo(clip, 0) 
    } 

    return PLUGIN_HANDLED 
}
please tell me whats wrong with it?
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
hellraser
Member
Join Date: Jul 2004
Old 03-05-2005 , 07:59  
Reply With Quote #6

you never call the function,thats why it doesn't work...
hellraser is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-05-2005 , 09:07  
Reply With Quote #7

client_PreThink() is an AMXX forward, so it gets called by AMXX..

But, that's not the problem, the problem is:

cs_set_weapon_ammo(clip, 0)

The first parameter should not be the clip, but the user index..

from cstrike.inc:

native cs_set_weapon_ammo(index, newammo);
xeroblood is offline
Send a message via MSN to xeroblood
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 03-12-2005 , 19:18  
Reply With Quote #8

so will work?
Code:
 
#include<amxmodx> 
#include<cstrike> 
#include<engine> 

public plugin_init(){ 
   register_plugin("fullclipreload","1.0","cheap_suit") 
} 

public client_PreThink(id) { 

    if(get_user_button(id) & IN_RELOAD) { 

       cs_set_weapon_ammo(id, 0) 
    } 

    return PLUGIN_HANDLED 
}
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
larnk
Member
Join Date: Dec 2004
Old 03-12-2005 , 21:14  
Reply With Quote #9

Wrong...
cs_set_weapon_ammo(id,ammo)

this id is not user id, this the weapon's id
below is an example

Code:
public cs_set_user_ammo(id,ammount)     new iWPNidx = -1,wpn[32],clip,ammo      new weaponid=get_user_weapon(id, clip, ammo)     get_weaponname(weaponid,wpn,31)     while ((iWPNidx = find_ent_by_class(iWPNidx, wpn)) != 0){         if (id == entity_get_edict(iWPNidx, EV_ENT_owner)) {             cs_set_weapon_ammo(iWPNidx,ammount)        }    } }
[/small]
larnk is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-13-2005 , 13:57  
Reply With Quote #10

Yes, cheap_suit, the most recent code you posted should work. Larnk's will give you a plethora of warnings and errors.
__________________
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 14:07.


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