Raised This Month: $ Target: $400
 0% 

bullets problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Samurai [/]
Member
Join Date: Sep 2006
Old 04-19-2007 , 07:53   bullets problem
Reply With Quote #1

i made one plugin that removes spawn equip, but how is it possible to remove bullets from given gun and then give bullets to it?
__________________
Samurai [/] is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 04-19-2007 , 10:39   Re: bullets problem
Reply With Quote #2

Yes it has something to do with:
cs_set_weapon_ammo(id , 12);
cs_get_weapon_ammo()
Styles is offline
Send a message via AIM to Styles
Old 04-19-2007, 12:04
Howdy!
This message has been deleted by Howdy!.
Silencer123
Veteran Member
Join Date: Jul 2006
Old 04-19-2007 , 14:04   Re: bullets problem
Reply With Quote #3

http://www.amxmodx.org/funcwiki.php?go=func&id=185 // Get Ammo in Backpack
http://www.amxmodx.org/funcwiki.php?go=func&id=186 // Set Ammo in Backpack
http://www.amxmodx.org/funcwiki.php?go=func&id=207 // Get Ammo in current Clip
http://www.amxmodx.org/funcwiki.php?go=func&id=208 // Set Ammo in current Clip
( Those four do not ask for players id - the entity ID of the weapon is meant )

http://www.amxmodx.org/funcwiki.php?go=module&id=4 // Weapon IDs
( NOT the Entity IDs - Entity IDs vary on every weapon on the servers instance of a map, situation and time )

http://www.amxmodx.org/funcwiki.php?go=func&id=156 // Get currently carried Weapon
http://www.amxmodx.org/funcwiki.php?go=func&id=163 // Get list of all owned Weapons
( First get the Weapons ID(s) ( NOT Entity ID(s) ) )

http://www.amxmodx.org/funcwiki.php?go=func&id=617 // Call a Function in the Engine
( This requires Fakemeta - Use this in a loop to get Weapons Entity IDs )
( Use EngFunc_FindEntityByString with "classname" and "weapon_whatever" )
Here is a list of weapon names:
Code:
weapon_knife
weapon_deagle
weapon_usp
weapon_glock
weapon_p228
weapon_elite
weapon_fiveseven
weapon_ak47 
weapon_aug
weapon_g3sg1 
weapon_m249 
weapon_m4a1 
weapon_m3 
weapon_mac10 
weapon_mp5navy 
weapon_p90 
weapon_scout 
weapon_sg552 
weapon_sg550 
weapon_ump45 
weapon_tmp
weapon_xm1014
weapon_awp
weapon_galil
weapon_famas
weapon_hegrenade
weapon_flashbang
weapon_smokegrenade
weapon_c4
Or just use this one:
http://www.amxmodx.org/funcwiki.php?go=func&id=164 // Changes a Weapons ID into its classname,
like into those shown in the code block above - probably easier to use this.

http://www.amxmodx.org/funcwiki.php?go=func&id=609 // Retrieves Keyvalues from Entities
( Use pev_owner on the Weapon Entity IDs retrieved with engfunc to get correct Players Weapon )
( Also uses Fakemeta )


If you are clever enough, you can put these functions together into
a simple function which can change the ammo of one of a players weapon.
__________________
EAT YOUR VEGGIES

Last edited by Silencer123; 04-19-2007 at 14:13.
Silencer123 is offline
Samurai [/]
Member
Join Date: Sep 2006
Old 04-19-2007 , 14:46   Re: bullets problem
Reply With Quote #4

if i use this:
cs_set_weapon_ammo ( index, newammo )
will it replace spawn clip?
__________________
Samurai [/] is offline
Samurai [/]
Member
Join Date: Sep 2006
Old 04-20-2007 , 08:46   Re: bullets problem
Reply With Quote #5

i dont know how..
__________________
Samurai [/] is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 04-20-2007 , 09:41   Re: bullets problem
Reply With Quote #6

It will change the amount of ammunition in the current clip.
For example the m4a1 can have up to 30 bullets in the current
clip and 90 ammo in backpack. You should not go above 255 as
CS can not display that then. What do you not know how to
do it? I have just written a full manual on how to do what you want.
Please be more precisely if you expect any more help, thanks.
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Samurai [/]
Member
Join Date: Sep 2006
Old 04-21-2007 , 17:17   Re: bullets problem
Reply With Quote #7

Quote:
Originally Posted by Silencer123 View Post
It will change the amount of ammunition in the current clip.
For example the m4a1 can have up to 30 bullets in the current
clip and 90 ammo in backpack. You should not go above 255 as
CS can not display that then. What do you not know how to
do it? I have just written a full manual on how to do what you want.
Please be more precisely if you expect any more help, thanks.
I dont really know how to put these together those links are pretty confusing.
__________________
Samurai [/] is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 04-22-2007 , 07:10   Re: bullets problem
Reply With Quote #8

The problem is that you can't say for sure whether this weapon recieved on spawn or not. Let's say that all weapons that you recieve for a time 0.1 sec after spawn are spawn weapons (see http://forums.alliedmods.net/showthread.php?t=42159 for more info on spawn event). Then after that delay use get_user_weapons(), loop though all player's weapons and do cs_set_weapon_ammo(fm_get_user_weapon_entity( id, weapon_id), 0). Though you should skip weapons that doesn't contain clip (knife, c4 etc).

fm_get_user_weapon_entity() function can be found here: Fakemeta Utilities

Last edited by VEN; 04-22-2007 at 07:14.
VEN is offline
Samurai [/]
Member
Join Date: Sep 2006
Old 04-22-2007 , 09:26   Re: bullets problem
Reply With Quote #9

Quote:
Originally Posted by VEN
get_user_weapons(), loop though all player's weapons
Im doing this for spawn weapons scripts which have set_task 3.0 after spawn.
(I dont get that get_user_weapons thing.. )
__________________
Samurai [/] is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 04-22-2007 , 09:48   Re: bullets problem
Reply With Quote #10

Quote:
new weapons[32], num
get_user_weapons(id, weapons, num)
for (new i = 0; i < num; ++i)
// etc
VEN is offline
Old 04-22-2007, 09:53
Howdy!
This message has been deleted by Howdy!.
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:43.


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