Raised This Month: $32 Target: $400
 8% 

getting grenade count in csgo


Post New Thread Reply   
 
Thread Tools Display Modes
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 12-30-2014 , 22:03   Re: getting grenade count in csgo
Reply With Quote #11

8guawong: I tested with bots because I only had server access - I did not have client access. But now I see what you're talking about. It is not grabbing good results
__________________
View my Plugins | Donate

Last edited by TnTSCS; 12-30-2014 at 22:17.
TnTSCS is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 12-30-2014 , 22:39   Re: getting grenade count in csgo
Reply With Quote #12

Update the #defines to the new values and it works... Prop_Data vs Prop_Send wasn't the issue.

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

#define     HEGrenadeOffset        14    // (14 * 4)
#define     FlashbangOffset        15    // (15 * 4)
#define     SmokegrenadeOffset        16    // (16 * 4)
#define     IncenderyGrenadesOffset    17    // (17 * 4) Also Molotovs
#define     DecoyGrenadeOffset        18    // (18 * 4)

public OnPluginStart()
{
    
RegConsoleCmd("sm_test"test"show # of grenades");
}

public 
Action:test(clientarg)
{
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
ReplyToCommand(client"%L has the following nades: IncGrenade [%d] | HEGrenade [%d] | Smokers [%d] | Flashbangs [%d] | Decoys [%d]"iGetEntProp(iProp_Send"m_iAmmo"_IncenderyGrenadesOffset), GetEntProp(iProp_Send"m_iAmmo"_HEGrenadeOffset), GetEntProp(iProp_Send"m_iAmmo"_SmokegrenadeOffset), GetEntProp(iProp_Send"m_iAmmo"_FlashbangOffset), GetEntProp(iProp_Send"m_iAmmo"_DecoyGrenadeOffset));
        }
    }

__________________
View my Plugins | Donate

Last edited by TnTSCS; 12-30-2014 at 22:44.
TnTSCS is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-31-2014 , 02:13   Re: getting grenade count in csgo
Reply With Quote #13

Quote:
Originally Posted by TnTSCS View Post
Update the #defines to the new values and it works... Prop_Data vs Prop_Send wasn't the issue.

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

#define     HEGrenadeOffset        14    // (14 * 4)
#define     FlashbangOffset        15    // (15 * 4)
#define     SmokegrenadeOffset        16    // (16 * 4)
#define     IncenderyGrenadesOffset    17    // (17 * 4) Also Molotovs
#define     DecoyGrenadeOffset        18    // (18 * 4)

public OnPluginStart()
{
    
RegConsoleCmd("sm_test"test"show # of grenades");
}

public 
Action:test(clientarg)
{
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
ReplyToCommand(client"%L has the following nades: IncGrenade [%d] | HEGrenade [%d] | Smokers [%d] | Flashbangs [%d] | Decoys [%d]"iGetEntProp(iProp_Send"m_iAmmo"_IncenderyGrenadesOffset), GetEntProp(iProp_Send"m_iAmmo"_HEGrenadeOffset), GetEntProp(iProp_Send"m_iAmmo"_SmokegrenadeOffset), GetEntProp(iProp_Send"m_iAmmo"_FlashbangOffset), GetEntProp(iProp_Send"m_iAmmo"_DecoyGrenadeOffset));
        }
    }

yes this work now
how do you find the offset??
just incase it ever changes again..
8guawong is offline
SanKen
Senior Member
Join Date: Oct 2012
Location: /var/logs
Old 12-31-2014 , 16:10   Re: getting grenade count in csgo
Reply With Quote #14

work, thx for your help.
__________________
SanKen is offline
SanKen
Senior Member
Join Date: Oct 2012
Location: /var/logs
Old 01-17-2015 , 10:29   Re: getting grenade count in csgo
Reply With Quote #15

after last update csgo not working... anyone have solution how to fix this ?
__________________

Last edited by SanKen; 01-17-2015 at 10:30.
SanKen is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-17-2015 , 11:37   Re: getting grenade count in csgo
Reply With Quote #16

Quote:
Originally Posted by SanKen View Post
after last update csgo not working... anyone have solution how to fix this ?
Quote:
Originally Posted by Bacardi View Post
__________________
Do not Private Message @me
Bacardi is offline
SanKen
Senior Member
Join Date: Oct 2012
Location: /var/logs
Old 01-17-2015 , 13:43   Re: getting grenade count in csgo
Reply With Quote #17

Sorry, cannot seek to understand? Can you explain me?

Quote:
L 01/17/2015 - 1998: [test.smx] ent 259 weapon_flashbang, ammotype 16, ammo 2
L 01/17/2015 - 1998: [test.smx] ent 269 weapon_hegrenade, ammotype 15, ammo 1
L 01/17/2015 - 1998: [test.smx] ent 220 weapon_smokegrenade, ammotype 17, ammo 1
L 01/17/2015 - 1998: [test.smx] ent 277 weapon_flashbang, ammotype 16, ammo 1
L 01/17/2015 - 1998: [test.smx] ent 337 weapon_hegrenade, ammotype 15, ammo 1
L 01/17/2015 - 1998: [test.smx] ent 338 weapon_flashbang, ammotype 16, ammo 2
L 01/17/2015 - 1998: [test.smx] ent 256 weapon_smokegrenade, ammotype 17, ammo 1
edit
Ignore this post.
__________________

Last edited by SanKen; 01-17-2015 at 13:45.
SanKen is offline
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 01-17-2015 , 15:11   Re: getting grenade count in csgo
Reply With Quote #18

Use this. Offsets updated some times. HE 15, flashbang 16, smoke 17, molotov and incendiary grenade 18, decoy 19. And type Prop_Send for use net edicts.
PHP Code:
#include <sourcemod>
#include <sdktools>

#define     HEGrenadeOffset         15
#define     FlashbangOffset         16
#define     SmokegrenadeOffset        17
#define     IncenderyGrenadesOffset    18    // Also Molotovs
#define     DecoyGrenadeOffset        18

public OnPluginStart()
{
    
RegConsoleCmd("sm_test"test"show # of grenades");
}

public 
Action:test(clientarg)
{
    new 
String:sWeaponName[64];
    
GetClientWeapon(clientsWeaponNamesizeof(sWeaponName));
    
PrintToChat(client"%s"sWeaponName);
    
PrintToChat(client"IncGrendae: %d"GetEntProp(clientProp_Send"m_iAmmo"_IncenderyGrenadesOffset));
    
PrintToChat(client"HEGrenade: %d"GetEntProp(clientProp_Send"m_iAmmo"_HEGrenadeOffset));
    
PrintToChat(client"SmokeGrenade: %d"GetEntProp(clientProp_Send"m_iAmmo"_SmokegrenadeOffset));


Last edited by Kailo; 01-17-2015 at 15:41.
Kailo is offline
Cruze
Veteran Member
Join Date: May 2017
Old 04-02-2021 , 09:31   Re: getting grenade count in csgo
Reply With Quote #19

Tested and working for CSGO
PHP Code:
#include <sourcemod>
#include <sdktools>

#define HEGRENADE_OFFSET 14
#define FLASHBANG_OFFSET 15
#define SMOKE_OFFSET 16
#define MOLOTOV_OFFSET 17
#define DECOY_OFFSET 18

public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test"show # of grenades");
}

public 
Action test(int clientint args)
{
    
char sWeaponName[64];
    
GetClientWeapon(clientsWeaponNamesizeof(sWeaponName));
    
PrintToChat(client"%s"sWeaponName);
    
PrintToChat(client"HEGrenade: %d"GetEntProp(clientProp_Data"m_iAmmo"_HEGRENADE_OFFSET));
    
PrintToChat(client"Flashbang: %d"GetEntProp(clientProp_Send"m_iAmmo"_FLASHBANG_OFFSET));
    
PrintToChat(client"SmokeGrenade: %d"GetEntProp(clientProp_Send"m_iAmmo"_SMOKE_OFFSET));
    
PrintToChat(client"IncGrenade: %d"GetEntProp(clientProp_Send"m_iAmmo"_MOLOTOV_OFFSET));
    
PrintToChat(client"DecoyGrenade: %d"GetEntProp(clientProp_Send"m_iAmmo"_DECOY_OFFSET));
    return 
Plugin_Handled;

__________________
Taking paid private requests! Contact me
Cruze is offline
Reply


Thread Tools
Display Modes

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 16:31.


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