Raised This Month: $ Target: $400
 0% 

Help with cs_get_weapon_id


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 07-06-2010 , 19:02   Re: Help with cs_get_weapon_id
Reply With Quote #7

Quote:
Originally Posted by DarkGod View Post
Shield?
It does not say so in amxconst.inc, but thank you.

Quote:
Originally Posted by wrecked_ View Post
cs_get_weapon_id() is used with the weapon entity as the first and only parameter. In your case, you were passing the player's id. Just an explanation so you'd learn from this.
I see now. Thank you.

Quote:
Originally Posted by Bugsy View Post
Instead of using a switch you could create an array, having an element for each weapon index.
Just be sure to add a blank/zero value as a place holder if there is no weapon for a given index.
PHP Code:
new const GunMax31 ] =
{
     
0,
     
13,
     
0,
     
10,
     
0
// etc for all weapons

Then access value

GunMax[ get_user_weapon( id ) ]

If you choose to do this, it is a good idea to check the value returned by get_user_weapon prior to passing it into the array.
I believe get_user_weapon() returns the CSW_* value of the gun the index is holding, so I do not quite understand what you are trying to explain me here.
I think it was cs_get_user_weapon() which gave a number.

But why add a 0 after each weapon? And I do not quite follow you on how to store max clips and such. I rarely use arrays. Is it any faster to do it that way, and not with a switch?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
 



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 07:07.


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