Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. #include amxmodx
  2. #include amxmisc
  3. #include cstrike
  4. #include fakemeta
  5. #include hamsandwich
  6. #include csx
  7. #include SpecialGeoip
  8. #include fcs
  9.  
  10. #define TASK_PRESENTS 1337
  11. #define TASK_SHOWHUD 2674
  12.  
  13. #define ID_PRESENTS (TaskIndex - TASK_PRESENTS)
  14. #define ID_SHOWHUD (TaskIndex - TASK_SHOWHUD)
  15.  
  16. new ammo[3][33],string[21],cvarShowType,ammopacks
  17.  
  18. // Variabile
  19. new MesajSync, MesajSync2
  20.  
  21.  
  22. // Cvaruri
  23. new cvar_hudenable
  24.  
  25. public plugin_init()
  26. {
  27. register_plugin("Hud Info", "1.1", "")
  28.  
  29. // Register Cvars
  30. cvar_hudenable = register_cvar("credits_hudstats", "1")
  31.  
  32. // Register Messages
  33. MesajSync = CreateHudSyncObj()
  34. MesajSync2 = CreateHudSyncObj()
  35.  
  36. register_message(get_user_msgid("SayText"), "message")
  37. register_event("DeathMsg","death_msg","a")
  38. register_logevent("round_start", 2, "1=Round_Start")
  39. cvarShowType = register_cvar("ac_show_type", "1")
  40. register_clcmd("say /change","func_change",ADMIN_ALL,"")
  41.  
  42. }
  43.  
  44. public round_start() {
  45. new players[32],num,i
  46. get_players(players,num)
  47.  
  48. for(i=1;i<num;i++) {
  49. ammo[0][players[i]] = fcs_get_user_credits(players[i])
  50. }
  51. }
  52.  
  53. public client_putinserver(id)
  54. {
  55. set_task(1.0, "MesajHUD", id+TASK_SHOWHUD, .flags = "b")
  56. set_task(3.0,"func_ammo",id)
  57.  
  58. return 1;
  59. }
  60.  
  61. public death_msg()
  62. {
  63. new iKiller = read_data ( 1 );
  64. new iVictim = read_data ( 2 );
  65.  
  66. if ( iKiller == iVictim ) return 1;
  67.  
  68. fcs_set_user_credits ( iKiller, fcs_get_user_credits ( iKiller ) + 1 );
  69.  
  70. return 1;
  71. }
  72.  
  73. public func_ammo(id) {
  74. ammopacks = fcs_get_user_credits(id)
  75.  
  76. ammo[0][id] = ammopacks
  77. ammo[1][id] = ammopacks
  78. ammo[2][id] = ammopacks
  79.  
  80. set_task(1.0,"change_ammo",id,_,_,"b")
  81. }
  82.  
  83. public change_ammo(id) {
  84. if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
  85. return PLUGIN_HANDLED
  86.  
  87. ammo[1][id] = fcs_get_user_credits(id)
  88.  
  89. if(ammo[1][id] != ammo[2][id]) {
  90. if(ammo[1][id] > ammo[2][id]) {
  91. ammopacks = ammo[1][id] - ammo[2][id]
  92. format(string,charsmax(string),"[ +%d Gold ]", ammopacks)
  93. }
  94. else {
  95. ammopacks = ammo[2][id] - ammo[1][id]
  96. format(string,charsmax(string),"[ -%d Gold ]", ammopacks)
  97. }
  98.  
  99. ammo[2][id] = ammo[1][id]
  100.  
  101. if(get_pcvar_num(cvarShowType)) {
  102. set_hudmessage(180, 180, 180, 0.51, 0.51, 0, 6.0, 3.0,_,_,3)
  103. show_hudmessage(id, "%s", string)
  104. }
  105. else
  106. client_print(id, print_center, "%s", string)
  107. }
  108.  
  109. return PLUGIN_HANDLED
  110. }
  111.  
  112. public client_disconnect(id) {
  113. ammo[0][id] = 0
  114. ammo[1][id] = 0
  115. ammo[2][id] = 0
  116.  
  117. remove_task(id)
  118. }
  119.  
  120. public MesajHUD(TaskIndex)
  121. {
  122. static id
  123. id = ID_SHOWHUD;
  124.  
  125. if (!is_user_alive(id))
  126. {
  127. id = pev(id, pev_iuser2)
  128.  
  129. if(!is_user_alive(id)) return;
  130. }
  131.  
  132. if (get_pcvar_num(cvar_hudenable))
  133. {
  134. if(id != ID_SHOWHUD)
  135. {
  136. new nume[32], szcountry[128], szcity[128];
  137. get_user_name(id, nume, 31)
  138. GetClientGeoData(id, CountryName, szcountry, 127)
  139. GetClientGeoData(id, City, szcity, 127)
  140. set_hudmessage(0, 100, 250, -1.0, 0.85, 0, 6.0, 1.1, 0.0, 0.0, -1)
  141. //ShowSyncHudMsg(ID_SHOWHUD, MesajSync, "Spectating %s^nHP: %d - Golds: %d^nFrom: %s , %s", nume, pev(id, pev_health), fcs_get_user_credits[id], szcountry, szcity)
  142. ShowSyncHudMsg(ID_SHOWHUD, MesajSync, "Spectating %s^nHP: %d - Gold: %d^nFrom: %s, %s", nume, get_user_health ( id ), fcs_get_user_credits ( id ), szcountry, szcity )
  143. }
  144. else
  145. {
  146. set_hudmessage(0, 100, 250, 0.88, 0.83, 0, 6.0, 1.1, 0.0, 0.0, -1)
  147. ShowSyncHudMsg(ID_SHOWHUD, MesajSync2, "Gold^n --%d-- ", fcs_get_user_credits(ID_SHOWHUD))
  148. }
  149. }
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement