Raised This Month: $ Target: $400
 0% 

cs_get_weapon_id problem.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 10-19-2011 , 08:09   cs_get_weapon_id problem.
Reply With Quote #1

How to use cs_get_weapon_id? My code seems wrong as I don't got any effect.
Code:
	if( get_pcvar_num( CVAR_UNLIMIT_AMMO ) )
		cs_set_user_bpammo( id, cs_get_weapon_id( id ), 255 );
	else if( !get_pcvar_num( CVAR_UNLIMIT_AMMO ) )
		cs_set_user_bpammo( id, cs_get_weapon_id( id ), 90 );
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others

Last edited by GarbageBox; 10-19-2011 at 08:12.
GarbageBox is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 10-19-2011 , 08:14   Re: cs_get_weapon_id problem.
Reply With Quote #2

http://www.amxmodx.org/funcwiki.php?go=func&id=738
Did u read the wiki
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
Stereo
Veteran Member
Join Date: Dec 2010
Old 10-19-2011 , 08:39   Re: cs_get_weapon_id problem.
Reply With Quote #3

Because you write the index "id" in cs_get_weapon_id
Stereo is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-20-2011 , 03:03   Re: cs_get_weapon_id problem.
Reply With Quote #4

its the wep index not player.

use thise

PHP Code:
    new iWeapon get_user_weapon(id);
    
    if(
get_pcvar_num(CVAR_UNLIMITED_AMMO)
    {
        
cs_set_user_bpammo(idiWeapon 255);
    }
    else
    {
        
cs_set_user_bpammo(idiWeapon 90);
    } 
fixed (

Last edited by Doc-Holiday; 10-20-2011 at 14:53.
Doc-Holiday is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-20-2011 , 11:58   Re: cs_get_weapon_id problem.
Reply With Quote #5

PHP Code:
cs_set_user_bpammoid get_user_weaponid ) , get_pcvar_numCVAR_UNLIMITED_AMMO ) ? 255 90 ); 
__________________

Last edited by Bugsy; 10-20-2011 at 12:19.
Bugsy is online now
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-20-2011 , 13:28   Re: cs_get_weapon_id problem.
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
PHP Code:
cs_set_user_bpammoid get_user_weaponid ) , get_pcvar_numCVAR_UNLIMITED_AMMO ) ? 255 90 ); 
Although that works to most beginners that's kind of hard to understand. Does the same mine does just more efficiently (prolly unnoticed but harder to read for newer people)
Doc-Holiday is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-20-2011 , 13:42   Re: cs_get_weapon_id problem.
Reply With Quote #7

Did you look at your code closely and/or test it? I don't think my code is very confusing except for maybe the ? Val : val2 statement.

get_user_weapons should be get_user_weapon which returns the current held weapon, this eliminates the need for get_weapon_name and get_weaponid.
__________________

Last edited by Bugsy; 10-20-2011 at 13:47.
Bugsy is online now
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-20-2011 , 14:48   Re: cs_get_weapon_id problem.
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
Did you look at your code closely and/or test it? I don't think my code is very confusing except for maybe the ? Val : val2 statement.

get_user_weapons should be get_user_weapon which returns the current held weapon, this eliminates the need for get_weapon_name and get_weaponid.
LOL yeah i just saw that... i typed it out really late at night my bad

and the S on get_user_weapons is a typo... lol i meant get user weapon

Last edited by Doc-Holiday; 10-20-2011 at 14:50.
Doc-Holiday 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 23:21.


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