Raised This Month: $7 Target: $400
 1% 

CSGO Items API


Post New Thread Reply   
 
Thread Tools Display Modes
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 02-21-2016 , 19:49   Re: CSGO Items API
Reply With Quote #11

Heres the first example plugin guys, https://bitbucket.org/SM91337/csgo-i...e-view-default

This is a dynamic weapon menu which is always up to date with new weapons valve may add to the game, could be very useful for a Deathmatch plugin or something. I am still working on improving and extending internals of the Item Core so Natives and Forwards may get changed, added and removed. Just a heads up one that one

Last edited by SM9; 02-21-2016 at 20:01.
SM9 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-28-2016 , 17:38   Re: CSGO Items API
Reply With Quote #12

Quote:
Originally Posted by xCoderx View Post
similar to TF2Item
Quote:
Originally Posted by xCoderx View Post
lets bring TF2Items to CSGO, Its about time eh?!
This literally doesn't have a single piece of functionality in common with TF2Items (which is good, because a TF2Items-equivalent would trigger the auto-ban detection), you're probably thinking of plugins like "TF2 Item DB" and TF2ItemsInfo.
__________________
asherkin is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-03-2016 , 05:22   Re: CSGO Items API
Reply With Quote #13

can't compile the code on first post...

//// test3.sp
//
// C:\Users\xxx\Dropbox\sm 1.8\test3.sp(1) : error 010: invalid function or decl
aration
// C:\Users\xxx\Dropbox\sm 1.8\test3.sp(30) : error 017: undefined symbol "CSGOI
tems_GetActiveWeaponDefIndex"
// C:\Users\xxx\Dropbox\sm 1.8\test3.sp(31) : error 017: undefined symbol "CSGOI
tems_GetWeaponClipAmmoByDefIndex"
//
// 3 Errors.
//
// Compilation Time: 0.12 sec
// ----------------------------------------
__________________

Last edited by 8guawong; 08-03-2016 at 05:26.
8guawong is offline
root88
Senior Member
Join Date: May 2016
Old 08-08-2016 , 06:22   Re: CSGO Items API
Reply With Quote #14

#include <csgoitems>
__________________
root88 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-08-2016 , 06:50   Re: CSGO Items API
Reply With Quote #15

Does this still read all the items data after Valve split the keys over multiple sections of games_items.txt?
__________________
Neuro Toxin is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 08-10-2016 , 19:53   Re: CSGO Items API
Reply With Quote #16

will this ever support reading weapon's spread values etc?
Mitchell is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-10-2016 , 21:45   Re: CSGO Items API
Reply With Quote #17

Quote:
Originally Posted by root88 View Post
#include <csgoitems>
already included
__________________
8guawong is offline
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 08-11-2016 , 07:12   Re: CSGO Items API
Reply With Quote #18

Quote:
Originally Posted by Neuro Toxin View Post
Does this still read all the items data after Valve split the keys over multiple sections of games_items.txt?
Indeed

Quote:
Originally Posted by Mitchell View Post
will this ever support reading weapon's spread values etc?
Sure, I can get round to doing that at some point.

Quote:
Originally Posted by 8guawong View Post
already included
Thats odd, you must be doing something wrong since it works fine on my end, can you show me contents of the csgoitems.inc you have?

Also just pushed an update to fix some stuff which valve broke in last csgo update.

Last edited by SM9; 08-11-2016 at 07:12.
SM9 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-11-2016 , 10:09   Re: CSGO Items API
Reply With Quote #19

Quote:
Originally Posted by xCoderx View Post
Indeed


Sure, I can get round to doing that at some point.


Thats odd, you must be doing something wrong since it works fine on my end, can you show me contents of the csgoitems.inc you have?

Also just pushed an update to fix some stuff which valve broke in last csgo update.
PHP Code:
#if defined _csgoitems_included_
#endinput
#endif
#define _csgoitems_included_

native int CSGOItems_GetWeaponCount();
native int CSGOItems_GetMusicKitCount();
native int CSGOItems_GetSkinCount();
native int CSGOItems_GetActiveWeaponCount(const char[] chClassNameint iTeam 0);

// WEAPONS
native int CSGOItems_GetWeaponNumByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponNumByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponDefIndexByWeaponNum(int iWeaponNum);
native bool CSGOItems_GetWeaponDefIndexByClassName(const char[] chClassName);
native bool CSGOItems_GetWeaponClassNameByWeaponNum(int iWeaponNumchar[] chBufferint iLengh);
native bool CSGOItems_GetWeaponClassNameByDefIndex(int iDefIndexchar[] chBufferint iLengh);
native bool CSGOItems_GetWeaponDisplayNameByDefIndex(int iDefIndexchar[] chBufferint iLengh);
native bool CSGOItems_GetWeaponDisplayNameByClassName(const char[] chClassNamechar[] chBufferint iLengh);
native bool CSGOItems_GetWeaponDisplayNameByWeaponNum(int iWeaponNumchar[] chBufferint iLengh);
native bool CSGOItems_IsDefIndexKnife(int iDefIndex);
native int CSGOItems_GetWeaponDefIndexByWeapon(int iWeapon);
native bool CSGOItems_GetWeaponClassNameByWeapon(int iWeaponchar[] chBufferint iLengh);
native int CSGOItems_GetActiveWeapon(int iClient);
native int CSGOItems_GetActiveWeaponDefIndex(int iClient);
native bool CSGOItems_GetActiveClassName(int iClientchar[] chBufferint iLengh);
native bool CSGOItems_IsSkinnableDefIndex(int iDefIndex);
native int CSGOItems_FindWeaponByClassName(int iClient, const char[] chClassName);
native int CSGOItems_GetActiveWeaponNum(int iClient);
native int CSGOItems_GetWeaponSlotByWeaponNum(int iWeaponNum);
native int CSGOItems_GetWeaponSlotByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponSlotByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponTeamByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponTeamByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponTeamByWeaponNum(int iWeaponNum);
native int CSGOItems_GetWeaponClipAmmoByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponClipAmmoByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponClipAmmoByWeaponNum(int iWeaponNum);
native int CSGOItems_GetWeaponReserveAmmoByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponReserveAmmoByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponReserveAmmoByWeaponNum(int iWeaponNum);
native int CSGOItems_GetWeaponKillAwardByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponKillAwardByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponKillAwardByWeaponNum(int iWeaponNum);
native bool CSGOItems_GetItemSetNumByClassName(const char[] chClassNamechar[] chBufferint iLengh);
native bool CSGOItems_GetItemSetDisplayNameByClassName(const char[] chClassNamechar[] chBufferint iLengh);
native bool CSGOItems_GetItemSetDisplayNameByItemSetNum(int iSetNumchar[] chBufferint iLengh);
native bool CSGOItems_RefillClipAmmo(int iWeapon);
native bool CSGOItems_RefillReserveAmmo(int iWeapon);
native bool CSGOItems_IsValidWeapon(int iWeapon);
native int CSGOItems_GiveWeapon(int iClient, const char[] chClassNameint iReserveAmmo = -1int iClipAmmo = -1int iSwitchTo = -1);
native bool CSGOItems_RemoveKnife(int iClient);
native bool CSGOItems_RemoveWeapon(int iClientint iWeapon);
native int CSGOItems_RemoveAllWeapons(int iClientint iSkipSlot = -1);
native bool CSGOItems_SetWeaponAmmo(int iWeaponint iReserveAmmo = -1int iClipAmmo = -1);
native int CSGOItems_SetAllWeaponsAmmo(const char[] chClassNameint iReserveAmmo = -1int iClipAmmo = -1);
native bool CSGOItems_SetActiveWeapon(int iClientint iWeapon);
native int CSGOItems_GetActiveWeaponSlot(int iClient);
native bool CSGOItems_AreItemsSynced();
native bool CSGOItems_AreItemsSyncing();
native bool CSGOItems_ReSync();
native int CSGOItems_GetRandomSkin();

// SKINS
native int CSGOItems_GetSkinNumByDefIndex(int iDefIndex);
native int CSGOItems_GetSkinDefIndexBySkinNum(int iSkinNum);
native bool CSGOItems_GetSkinDisplayNameByDefIndex(int iDefIndexchar[] chBufferint iLengh);
native bool CSGOItems_GetSkinDisplayNameBySkinNum(int iSkinNumchar[] chBufferint iLengh);

// MUSIC KITS
native int CSGOItems_GetMusicKitNumByDefIndex(int iDefIndex);
native int CSGOItems_GetMusicKitDefIndexByMusicKitNum(int iMusicKitNum);
native bool CSGOItems_GetMusicKitDisplayNameByDefIndex(int iDefIndexchar[] chBufferint iLengh);
native bool CSGOItems_GetMusicKitDisplayNameByMusicKitNum(int iMusicKitNumchar[] chBufferint iLengh); 
the test code
PHP Code:
#include <csgoitems>

public Plugin myinfo 
{
    
name "Test Plugin"
    
author "SM9"
    
version "0.1"
    
url "http://www.fragdeluxe.com"
};

public 
void OnPluginStart()
{
    if (
GetEngineVersion() != Engine_CSGO) {
        
SetFailState("This plugin is for CSGO only.");
    }
    
//AddCommandListener(EventCommandHook, "buyammo1");
    //AddCommandListener(EventCommandHook, "buyammo2");
}

public 
Action:EventCommandHook(client, const String:command[], args
{
    if(
StrEqual(command"buyammo1") || StrEqual(command"buyammo2"))
    {
        
PrintToChat(client"default ammo: %d"GetActiveDefaultClipAmmo(client));
    }
}

stock int GetActiveDefaultClipAmmo(int iClient
{
    
int iDefIndex CSGOItems_GetActiveWeaponDefIndex(iClient);
    return 
CSGOItems_GetWeaponClipAmmoByDefIndex(iDefIndex);
}

stock bool RefillActiveWeapon(int iClient
{
    
int iWeapon CSGOItems_GetActiveWeaponIndex(iClient);
    return 
CSGOItems_RefillClipAmmo(iWeapon); // true on success.

__________________

Last edited by 8guawong; 08-11-2016 at 10:10.
8guawong is offline
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 08-11-2016 , 13:44   Re: CSGO Items API
Reply With Quote #20

Quote:
Originally Posted by 8guawong View Post
PHP Code:
#if defined _csgoitems_included_
#endinput
#endif
#define _csgoitems_included_

native int CSGOItems_GetWeaponCount();
native int CSGOItems_GetMusicKitCount();
native int CSGOItems_GetSkinCount();
native int CSGOItems_GetActiveWeaponCount(const char[] chClassNameint iTeam 0);

// WEAPONS
native int CSGOItems_GetWeaponNumByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponNumByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponDefIndexByWeaponNum(int iWeaponNum);
native bool CSGOItems_GetWeaponDefIndexByClassName(const char[] chClassName);
native bool CSGOItems_GetWeaponClassNameByWeaponNum(int iWeaponNumchar[] chBufferint iLengh);
native bool CSGOItems_GetWeaponClassNameByDefIndex(int iDefIndexchar[] chBufferint iLengh);
native bool CSGOItems_GetWeaponDisplayNameByDefIndex(int iDefIndexchar[] chBufferint iLengh);
native bool CSGOItems_GetWeaponDisplayNameByClassName(const char[] chClassNamechar[] chBufferint iLengh);
native bool CSGOItems_GetWeaponDisplayNameByWeaponNum(int iWeaponNumchar[] chBufferint iLengh);
native bool CSGOItems_IsDefIndexKnife(int iDefIndex);
native int CSGOItems_GetWeaponDefIndexByWeapon(int iWeapon);
native bool CSGOItems_GetWeaponClassNameByWeapon(int iWeaponchar[] chBufferint iLengh);
native int CSGOItems_GetActiveWeapon(int iClient);
native int CSGOItems_GetActiveWeaponDefIndex(int iClient);
native bool CSGOItems_GetActiveClassName(int iClientchar[] chBufferint iLengh);
native bool CSGOItems_IsSkinnableDefIndex(int iDefIndex);
native int CSGOItems_FindWeaponByClassName(int iClient, const char[] chClassName);
native int CSGOItems_GetActiveWeaponNum(int iClient);
native int CSGOItems_GetWeaponSlotByWeaponNum(int iWeaponNum);
native int CSGOItems_GetWeaponSlotByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponSlotByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponTeamByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponTeamByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponTeamByWeaponNum(int iWeaponNum);
native int CSGOItems_GetWeaponClipAmmoByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponClipAmmoByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponClipAmmoByWeaponNum(int iWeaponNum);
native int CSGOItems_GetWeaponReserveAmmoByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponReserveAmmoByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponReserveAmmoByWeaponNum(int iWeaponNum);
native int CSGOItems_GetWeaponKillAwardByDefIndex(int iDefIndex);
native int CSGOItems_GetWeaponKillAwardByClassName(const char[] chClassName);
native int CSGOItems_GetWeaponKillAwardByWeaponNum(int iWeaponNum);
native bool CSGOItems_GetItemSetNumByClassName(const char[] chClassNamechar[] chBufferint iLengh);
native bool CSGOItems_GetItemSetDisplayNameByClassName(const char[] chClassNamechar[] chBufferint iLengh);
native bool CSGOItems_GetItemSetDisplayNameByItemSetNum(int iSetNumchar[] chBufferint iLengh);
native bool CSGOItems_RefillClipAmmo(int iWeapon);
native bool CSGOItems_RefillReserveAmmo(int iWeapon);
native bool CSGOItems_IsValidWeapon(int iWeapon);
native int CSGOItems_GiveWeapon(int iClient, const char[] chClassNameint iReserveAmmo = -1int iClipAmmo = -1int iSwitchTo = -1);
native bool CSGOItems_RemoveKnife(int iClient);
native bool CSGOItems_RemoveWeapon(int iClientint iWeapon);
native int CSGOItems_RemoveAllWeapons(int iClientint iSkipSlot = -1);
native bool CSGOItems_SetWeaponAmmo(int iWeaponint iReserveAmmo = -1int iClipAmmo = -1);
native int CSGOItems_SetAllWeaponsAmmo(const char[] chClassNameint iReserveAmmo = -1int iClipAmmo = -1);
native bool CSGOItems_SetActiveWeapon(int iClientint iWeapon);
native int CSGOItems_GetActiveWeaponSlot(int iClient);
native bool CSGOItems_AreItemsSynced();
native bool CSGOItems_AreItemsSyncing();
native bool CSGOItems_ReSync();
native int CSGOItems_GetRandomSkin();

// SKINS
native int CSGOItems_GetSkinNumByDefIndex(int iDefIndex);
native int CSGOItems_GetSkinDefIndexBySkinNum(int iSkinNum);
native bool CSGOItems_GetSkinDisplayNameByDefIndex(int iDefIndexchar[] chBufferint iLengh);
native bool CSGOItems_GetSkinDisplayNameBySkinNum(int iSkinNumchar[] chBufferint iLengh);

// MUSIC KITS
native int CSGOItems_GetMusicKitNumByDefIndex(int iDefIndex);
native int CSGOItems_GetMusicKitDefIndexByMusicKitNum(int iMusicKitNum);
native bool CSGOItems_GetMusicKitDisplayNameByDefIndex(int iDefIndexchar[] chBufferint iLengh);
native bool CSGOItems_GetMusicKitDisplayNameByMusicKitNum(int iMusicKitNumchar[] chBufferint iLengh); 
the test code
PHP Code:
#include <csgoitems>

public Plugin myinfo 
{
    
name "Test Plugin"
    
author "SM9"
    
version "0.1"
    
url "http://www.fragdeluxe.com"
};

public 
void OnPluginStart()
{
    if (
GetEngineVersion() != Engine_CSGO) {
        
SetFailState("This plugin is for CSGO only.");
    }
    
//AddCommandListener(EventCommandHook, "buyammo1");
    //AddCommandListener(EventCommandHook, "buyammo2");
}

public 
Action:EventCommandHook(client, const String:command[], args
{
    if(
StrEqual(command"buyammo1") || StrEqual(command"buyammo2"))
    {
        
PrintToChat(client"default ammo: %d"GetActiveDefaultClipAmmo(client));
    }
}

stock int GetActiveDefaultClipAmmo(int iClient
{
    
int iDefIndex CSGOItems_GetActiveWeaponDefIndex(iClient);
    return 
CSGOItems_GetWeaponClipAmmoByDefIndex(iDefIndex);
}

stock bool RefillActiveWeapon(int iClient
{
    
int iWeapon CSGOItems_GetActiveWeaponIndex(iClient);
    return 
CSGOItems_RefillClipAmmo(iWeapon); // true on success.

Compiles fine on my end, are you sure you have the include file in the right directory?
SM9 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 22:15.


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