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

Solved [CS:GO] How to get client's loadout preference?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DexonRL
Junior Member
Join Date: Jul 2020
Location: Israel
Old 08-25-2020 , 14:55   [CS:GO] How to get client's loadout preference?
Reply With Quote #1

Hey, i made a plugin that gives client a pistol in a certain situation,
and I have no idea with how get the client preference about guns.

for example USP-S or P2000...

thx

Last edited by DexonRL; 08-25-2020 at 21:40.
DexonRL is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-25-2020 , 15:35   Re: [CS:GO] How to get client's loadout preference?
Reply With Quote #2

With server command you can dump entity net props.
Code:
"sm_dump_netprops"
- Dumps the networkable property table as a text file
ex. sm_dump_netprops Prop_Send.txt

You can find this from weapons (csgo)
Code:
m_iItemDefinitionIndex
When you get weapon entity item definition index, you can translate that to weapon ID, using cstrike extension.
https://sm.alliedmods.net/new-api/cstrike

CS_ItemDefIndexToID()
- you can look CSWeaponID's here https://sm.alliedmods.net/new-api/cstrike/__raw

Then you can translate CSWeaponID to alias with
CS_WeaponIDToAlias()

PHP Code:
#include <cstrike>

public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action test(int clientint args)
{
    if(
client == || !IsClientInGame(client)) return Plugin_Handled;

    
int weaponm_iItemDefinitionIndex;
    
int m_hMyWeapons_size GetEntPropArraySize(clientProp_Send"m_hMyWeapons");
    
    
CSWeaponID WeaponID;
    
char WeaponAlias[50];

    for(
int index 0index m_hMyWeapons_sizeindex++)
    {
        
weapon GetEntPropEnt(clientProp_Send"m_hMyWeapons"index);
        
        if(
weapon == -1) continue;
        
        
m_iItemDefinitionIndex GetEntProp(weaponProp_Send"m_iItemDefinitionIndex");
        
WeaponID CS_ItemDefIndexToID(m_iItemDefinitionIndex);
        
CS_WeaponIDToAlias(WeaponIDWeaponAliassizeof(WeaponAlias));
        
        
PrintToChat(client"You have %s"WeaponAlias);

    }

    return 
Plugin_Handled;

__________________
Do not Private Message @me

Last edited by Bacardi; 08-25-2020 at 15:37.
Bacardi is offline
DexonRL
Junior Member
Join Date: Jul 2020
Location: Israel
Old 08-25-2020 , 16:42   Re: [CS:GO] How to get client's loadout preference?
Reply With Quote #3

Still cant understand how can i use that to find out what the client choosed in his invetory to play with.

and i want to use that with
Code:
GivePlayerItem
.
DexonRL is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-25-2020 , 17:03   Re: [CS:GO] How to get client's loadout preference?
Reply With Quote #4

GivePlayerItem(client, "weapon_hkp2000") will do what you asked. players will receive usp if they have choosed that in their inventories
__________________

Last edited by Ilusion9; 08-25-2020 at 17:03.
Ilusion9 is offline
DexonRL
Junior Member
Join Date: Jul 2020
Location: Israel
Old 08-25-2020 , 17:11   Re: [CS:GO] How to get client's loadout preference?
Reply With Quote #5

Quote:
Originally Posted by Ilusion9 View Post
GivePlayerItem(client, "weapon_hkp2000") will do what you asked. players will receive usp if they have choosed that in their inventories
well, seems like it not working for me like that anymore.

i tried that with GivePlayerItem, and the 'give' console command and both gave me P2000.

Last edited by DexonRL; 08-25-2020 at 17:12.
DexonRL is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-25-2020 , 17:51   Re: [CS:GO] How to get client's loadout preference?
Reply With Quote #6

Quote:
Originally Posted by DexonRL View Post
well, seems like it not working for me like that anymore.

i tried that with GivePlayerItem, and the 'give' console command and both gave me P2000.
You must be at CT. It doesnt work for Terrorists
__________________
Ilusion9 is offline
DexonRL
Junior Member
Join Date: Jul 2020
Location: Israel
Old 08-25-2020 , 18:33   Re: [CS:GO] How to get client's loadout preference?
Reply With Quote #7

Quote:
Originally Posted by Ilusion9 View Post
You must be at CT. It doesnt work for Terrorists
woww i'm so fucking dumb... sorry for the whole complication.

thanks for helping tho (:
DexonRL is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-26-2020 , 05:48   Re: [CS:GO] How to get client's loadout preference?
Reply With Quote #8

weapon_usp_silencer

Just add weapon_* part to Weapon Aliases
__________________
Do not Private Message @me
Bacardi 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 17:58.


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