Raised This Month: $51 Target: $400
 12% 

[CS:GO] Weapons ammo


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pavillion
Junior Member
Join Date: Feb 2015
Old 02-09-2015 , 11:15   [CS:GO] Weapons ammo
Reply With Quote #1

Hi,

Why this doesn't work ?

I want to set secondary ammo, but i cannot found the problem :/

PHP Code:

public OnEntityCreated(entity, const String:classname[])
{    
    if(
StrContains(classname"weapon_") != -&& !StrEqual(classname"weapon_knife"))
    {
        
SDKHook(entitySDKHook_SpawnHook_OnEntitySpawn);
        
PrintToChatAll("%s"classname);
    }
}

public 
Action:Hook_OnEntitySpawn(entity
{
    
Weapon_SetSecondaryAmmoCount(entity0);

Thankss !
Pavillion is offline
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 02-09-2015 , 17:01   Re: [CS:GO] Weapons ammo
Reply With Quote #2

You should hook weapon equip for that, or wait one frame after spawn (or a timer). Because it seems that weapon never has owner on spawn, and secondary ammo is not set on weapon entity but on its owner props.
h3bus is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 02-09-2015 , 21:58   Re: [CS:GO] Weapons ammo
Reply With Quote #3

Use the SDKHook_SpawnPost instead
Mathias. is offline
Pavillion
Junior Member
Join Date: Feb 2015
Old 02-10-2015 , 08:42   Re: [CS:GO] Weapons ammo
Reply With Quote #4

Quote:
Use the SDKHook_SpawnPost instead
Already tested.

How i can remove secondary ammo on any weapons in world map ?
Pavillion is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-10-2015 , 10:48   Re: [CS:GO] Weapons ammo
Reply With Quote #5

Quote:
Originally Posted by h3bus View Post
You should hook weapon equip for that, or wait one frame after spawn (or a timer). Because it seems that weapon never has owner on spawn, and secondary ammo is not set on weapon entity but on its owner props.
That is for weapon entities that are already attached to the player. weapons with no owner can store ammo. Setting the ammo before the player equips it is much easier than doing it properly after. (i think)

Take a look at this:
https://github.com/Zipcore/AmmoManag...mmo_manager.sp

Last edited by Mitchell; 02-10-2015 at 10:56.
Mitchell 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 05:15.


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