Thread: CSGO Items API
View Single Post
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