Advertisement
Guest User

Lel

a guest
Jun 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #define PLUGIN_VERSION "1.0.2"
  4.  
  5. #include <sourcemod>
  6. #include <sdktools>
  7. #include <sdkhooks>
  8. #include <store>
  9.  
  10. #pragma newdecls required
  11.  
  12. public Plugin myinfo =
  13. {
  14. name = "Store - Coins",
  15. author = "Hallucinogenic Troll",
  16. description = "Coins plugin for Zephyrus Store",
  17. version = PLUGIN_VERSION,
  18. url = "htt://PTFun.net/newsite"
  19. };
  20.  
  21. ArrayList g_aCoins;
  22.  
  23. public void OnPluginStart()
  24. {
  25. g_aCoins = new ArrayList(PLATFORM_MAX_PATH);
  26. Store_RegisterHandler("coins", "coins", Coins_OnMapStart, Coins_Reset, Coins_Config, Coins_Equip, Coins_Remove, true);
  27. }
  28.  
  29. public void Coins_OnMapStart()
  30. {
  31. int iIndex = FindEntityByClassname(MaxClients+1, "cs_player_manager");
  32. if (iIndex == -1)
  33. {
  34. SetFailState("Unable to find cs_player_manager entity");
  35. }
  36. SDKHook(iIndex, SDKHook_ThinkPost, Hook_OnThinkPost);
  37. }
  38.  
  39. public void Coins_Reset()
  40. {
  41. }
  42.  
  43. public bool Coins_Config(Handle &kv, int itemid)
  44. {
  45.  
  46. char sModel[PLATFORM_MAX_PATH];
  47. KvGetString(kv, "coinid", sModel, sizeof(sModel));
  48. Store_SetDataIndex(itemid, g_aCoins.PushString(sModel));
  49. return true;
  50. }
  51.  
  52. public int Coins_Equip(int client, int itemid)
  53. {
  54. }
  55.  
  56. public int Coins_Remove(int client, int itemid)
  57. {
  58. }
  59.  
  60. public void Hook_OnThinkPost(int iEnt)
  61. {
  62. int Offset = -1;
  63.  
  64. if (Offset == -1)
  65. {
  66. Offset = FindSendPropInfo("CCSPlayerResource", "m_nActiveCoinRank");
  67. }
  68.  
  69. int tempCoin[MAXPLAYERS+1];
  70. GetEntDataArray(iEnt, Offset, tempCoin, MAXPLAYERS+1);
  71. for (int i = 1; i <= MaxClients; i++)
  72. {
  73. int m_iEquipped = Store_GetEquippedItem(i, "coins");
  74. if(m_iEquipped > 0)
  75. {
  76. int m_iData = Store_GetDataIndex(m_iEquipped);
  77. char sModel[PLATFORM_MAX_PATH];
  78. g_aCoins.GetString(m_iData, sModel, sizeof(sModel));
  79. int coin = StringToInt(sModel);
  80. tempCoin[i] = coin;
  81. }
  82.  
  83. }
  84. SetEntDataArray(iEnt, Offset, tempCoin, MAXPLAYERS+1, _, true);
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement