Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #define PLUGIN_VERSION "1.0.2"
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- #include <store>
- #pragma newdecls required
- public Plugin myinfo =
- {
- name = "Store - Coins",
- author = "Hallucinogenic Troll",
- description = "Coins plugin for Zephyrus Store",
- version = PLUGIN_VERSION,
- url = "htt://PTFun.net/newsite"
- };
- ArrayList g_aCoins;
- public void OnPluginStart()
- {
- g_aCoins = new ArrayList(PLATFORM_MAX_PATH);
- Store_RegisterHandler("coins", "coins", Coins_OnMapStart, Coins_Reset, Coins_Config, Coins_Equip, Coins_Remove, true);
- }
- public void Coins_OnMapStart()
- {
- int iIndex = FindEntityByClassname(MaxClients+1, "cs_player_manager");
- if (iIndex == -1)
- {
- SetFailState("Unable to find cs_player_manager entity");
- }
- SDKHook(iIndex, SDKHook_ThinkPost, Hook_OnThinkPost);
- }
- public void Coins_Reset()
- {
- }
- public bool Coins_Config(Handle &kv, int itemid)
- {
- char sModel[PLATFORM_MAX_PATH];
- KvGetString(kv, "coinid", sModel, sizeof(sModel));
- Store_SetDataIndex(itemid, g_aCoins.PushString(sModel));
- return true;
- }
- public int Coins_Equip(int client, int itemid)
- {
- }
- public int Coins_Remove(int client, int itemid)
- {
- }
- public void Hook_OnThinkPost(int iEnt)
- {
- int Offset = -1;
- if (Offset == -1)
- {
- Offset = FindSendPropInfo("CCSPlayerResource", "m_nActiveCoinRank");
- }
- int tempCoin[MAXPLAYERS+1];
- GetEntDataArray(iEnt, Offset, tempCoin, MAXPLAYERS+1);
- for (int i = 1; i <= MaxClients; i++)
- {
- int m_iEquipped = Store_GetEquippedItem(i, "coins");
- if(m_iEquipped > 0)
- {
- int m_iData = Store_GetDataIndex(m_iEquipped);
- char sModel[PLATFORM_MAX_PATH];
- g_aCoins.GetString(m_iData, sModel, sizeof(sModel));
- int coin = StringToInt(sModel);
- tempCoin[i] = coin;
- }
- }
- SetEntDataArray(iEnt, Offset, tempCoin, MAXPLAYERS+1, _, true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement