Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.97 KB | None | 0 0
  1. /* Sublime AMXX Editor v2.2 */
  2.  
  3. #include <amxmodx>
  4. #include <cstrike>
  5. #include <hamsandwich>
  6. #include <fakemeta_util>
  7. #include <fun>
  8. #include <vip>
  9.  
  10. #pragma tabsize 0
  11. #pragma compress 1
  12.  
  13. #define PLUGIN "VIP SYSTEM"
  14. #define VERSION "1.0"
  15. #define AUTHOR "deprale"
  16. new gMenu
  17. new Round = 0
  18. new g_hudmsg1, g_hudmsg2, g_hudmsg3
  19. new Three = 3
  20.  
  21. public plugin_init()
  22. {
  23. register_plugin(PLUGIN, VERSION, AUTHOR)
  24. //VERIFICA DACA E JEGOASA MAPA
  25. set_task(1.0, "CheckMap")
  26. //HOOKS
  27. RegisterHam(Ham_Spawn, "player", "playerSpawn", 1)
  28. register_event("HLTV", "newRound", "a", "1=0", "2=0")
  29. register_event( "DeathMsg", "Event_Death", "a" )
  30. register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")
  31. //MENIU JEGOS
  32. gMenu = menu_create("\rMeniu ARME(VIP) :", "handlerMenu")
  33.  
  34. menu_additem(gMenu, "\wM4A1 + Deagle + Utilitati", "1")
  35. menu_additem(gMenu, "\wAK47 + Deagle + Utilitati", "2")
  36. menu_additem(gMenu, "\wAWP + Deagle + Utilitati", "3")
  37. //CHANNELURILE DE LA DAMAGE
  38. g_hudmsg1 = CreateHudSyncObj()
  39. g_hudmsg2 = CreateHudSyncObj()
  40. g_hudmsg3 = CreateHudSyncObj()
  41.  
  42. }
  43.  
  44. public CheckMap()
  45. {
  46. new MapName[32]
  47. get_mapname(MapName, charsmax(MapName))
  48.  
  49. if(containi(MapName, "cs_") != -1 || containi(MapName, "awp_") != -1 || containi(MapName, "fy_") != -1 || containi(MapName, "2x2") != -1 || containi(MapName, "hp") != -1 )
  50. set_fail_state("[VIP SYSTEM] PLUGINUL S-A OPRIT DIN CAUZA CA HARTA E MICA/NE-POTRIVITA PENTRU PLUGIN.")
  51.  
  52.  
  53. return PLUGIN_HANDLED;
  54. }
  55.  
  56. public newRound(id)
  57. {
  58. set_task(0.1, "setVip")
  59.  
  60. if ( Round < Three )
  61. Round++
  62. }
  63.  
  64. public on_damage(id)
  65. {
  66. static attacker; attacker = get_user_attacker(id)
  67. static damage; damage = read_data(2)
  68. if(is_user_connected(attacker))
  69. {
  70. if(fm_is_ent_visible(attacker,id) && !is_user_vip(attacker))
  71. {
  72. set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, 1)
  73. ShowSyncHudMsg(attacker, g_hudmsg1, "%i^n", damage)
  74. }
  75. else if(fm_is_ent_visible(attacker,id) && is_user_vip(attacker) )
  76. {
  77. set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, 2)
  78. ShowSyncHudMsg(attacker, g_hudmsg2, "%i^n", damage)
  79. }
  80. else if(!fm_is_ent_visible(attacker,id) && is_user_vip(attacker))
  81. {
  82. set_hudmessage(178, 34, 34, -1.0, 0.55, 0, 0.1, 1.0, 0.00, 0.00, 3)
  83. ShowSyncHudMsg(attacker, g_hudmsg3, "%i^n", damage)
  84. }
  85. }
  86. }
  87.  
  88. public handlerMenu(id, menu, item)
  89. {
  90. if ( item == MENU_EXIT )
  91. {
  92. return PLUGIN_HANDLED;
  93. }
  94.  
  95. switch(item)
  96. {
  97. case 0:
  98. {
  99. if(cs_get_user_team(id) == CS_TEAM_T && user_has_weapon(id, CSW_C4)) {
  100. fm_strip_user_weapons(id)
  101. give_item(id, "weapon_c4")
  102. }
  103.  
  104. if(cs_get_user_team(id) == CS_TEAM_T && !user_has_weapon(id, CSW_C4))
  105. fm_strip_user_weapons(id)
  106.  
  107. if(cs_get_user_team(id) == CS_TEAM_CT)
  108. fm_strip_user_weapons(id)
  109.  
  110. cs_set_user_armor(id, 100, CsArmorType:2)
  111. give_item(id, "weapon_knife")
  112. cs_give_user_weapon(id, "weapon_deagle", CSW_DEAGLE, 35)
  113. cs_give_user_weapon(id, "weapon_m4a1", CSW_M4A1, 90)
  114.  
  115. if(cs_get_user_team(id) == CS_TEAM_CT)
  116. give_item(id, "item_thighpack");
  117.  
  118. give_item(id, "weapon_flashbang")
  119. give_item(id, "weapon_flashbang")
  120. give_item(id, "weapon_hegrenade")
  121.  
  122. }
  123. case 1:
  124. {
  125. if(cs_get_user_team(id) == CS_TEAM_T && user_has_weapon(id, CSW_C4)) {
  126. fm_strip_user_weapons(id)
  127. give_item(id, "weapon_c4")
  128. }
  129.  
  130. if(cs_get_user_team(id) == CS_TEAM_T && !user_has_weapon(id, CSW_C4))
  131. fm_strip_user_weapons(id)
  132.  
  133. if(cs_get_user_team(id) == CS_TEAM_CT)
  134. fm_strip_user_weapons(id)
  135.  
  136. cs_set_user_armor(id, 100, CsArmorType:2)
  137. give_item(id, "weapon_knife")
  138. cs_give_user_weapon(id, "weapon_deagle", CSW_DEAGLE, 35)
  139. cs_give_user_weapon(id, "weapon_ak47", CSW_AK47, 90)
  140.  
  141. if(cs_get_user_team(id) == CS_TEAM_CT)
  142. give_item(id, "item_thighpack");
  143.  
  144. give_item(id, "weapon_flashbang")
  145. give_item(id, "weapon_flashbang")
  146. give_item(id, "weapon_hegrenade")
  147.  
  148. }
  149. case 2:
  150. {
  151. if(cs_get_user_team(id) == CS_TEAM_T && user_has_weapon(id, CSW_C4)) {
  152. fm_strip_user_weapons(id)
  153. give_item(id, "weapon_c4")
  154. }
  155.  
  156. if(cs_get_user_team(id) == CS_TEAM_T && !user_has_weapon(id, CSW_C4))
  157. fm_strip_user_weapons(id)
  158.  
  159. if(cs_get_user_team(id) == CS_TEAM_CT)
  160. fm_strip_user_weapons(id)
  161.  
  162. cs_set_user_armor(id, 100, CsArmorType:2)
  163. give_item(id, "weapon_knife")
  164. cs_give_user_weapon(id, "weapon_deagle", CSW_DEAGLE, 35)
  165. cs_give_user_weapon(id, "weapon_awp", CSW_AWP, 30)
  166.  
  167. if(cs_get_user_team(id) == CS_TEAM_CT)
  168. give_item(id, "item_thighpack");
  169.  
  170. give_item(id, "weapon_flashbang")
  171. give_item(id, "weapon_flashbang")
  172. give_item(id, "weapon_hegrenade")
  173.  
  174. }
  175. }
  176.  
  177. return PLUGIN_HANDLED;
  178. }
  179.  
  180. public vip_putinserver(id) {
  181. ShowMessage(id, "conectat");
  182. }
  183.  
  184. public vip_disconnect(id) {
  185. ShowMessage(id, "deconectat");
  186. }
  187.  
  188. ShowMessage(id, action[]) {
  189. // grab user's name
  190. new name[32];
  191. get_user_name(id, name, charsmax(name));
  192.  
  193. set_hudmessage(0, 255, 0, 0.2, 0.6, .channel = -1);
  194. show_hudmessage(0, "[VIP] %s s-a %s!", name, action);
  195. }
  196.  
  197. public playerSpawn(id) {
  198. if(is_user_alive(id) && is_user_vip(id) && Round>=3) {
  199. menu_display(id, gMenu, 0)
  200. }
  201.  
  202. else if(is_user_alive(id) && is_vip_hour(22, 10) && Round>=3){
  203. menu_display(id, gMenu, 0)
  204. }
  205.  
  206. return PLUGIN_HANDLED;
  207. }
  208.  
  209. public Event_Death()
  210. {
  211. new iVictimID = read_data(2)
  212. new headshot = read_data(3)
  213. new iWeapon, iAttackerID = get_user_attacker( iVictimID, iWeapon )
  214.  
  215. if( !is_user_connected(iVictimID) )
  216. return PLUGIN_CONTINUE
  217.  
  218. if( !is_user_connected(iAttackerID) || iVictimID == iAttackerID )
  219. return PLUGIN_CONTINUE
  220.  
  221. if(is_user_vip(iAttackerID))
  222. {
  223. if(headshot && get_user_health(iAttackerID) < 85)
  224. {
  225. set_user_health( iAttackerID, get_user_health( iAttackerID ) + 15 )
  226. }
  227.  
  228. if(!headshot && get_user_health(iAttackerID) < 90)
  229. {
  230. set_user_health( iAttackerID, get_user_health( iAttackerID ) + 10 )
  231. }
  232. }
  233. return PLUGIN_CONTINUE
  234. }
  235.  
  236. public setVip()
  237. {
  238. new players[32], pNum
  239. get_players(players, pNum, "a")
  240.  
  241. for (new i = 0; i < pNum; i++)
  242. {
  243. new id = players[i]
  244.  
  245. if ( is_user_vip(id) )
  246. {
  247. message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"))
  248. write_byte(id)
  249. write_byte(4)
  250. message_end()
  251. }
  252. }
  253.  
  254. return PLUGIN_HANDLED
  255. }
  256.  
  257.  
  258. //STOCK GIVE WEAPON
  259. cs_give_user_weapon(id, szWeapon[], iWeapon, iBpAmmo)
  260. {
  261. give_item(id, szWeapon)
  262. cs_set_user_bpammo(id, iWeapon, iBpAmmo)
  263. }
  264. //STOCK GET TIME
  265. bool:is_vip_hour(iStart, iEnd)
  266. {
  267. new iHour; time(iHour)
  268. return bool:(iStart < iEnd ? (iStart <= iHour < iEnd) : (iStart <= iHour || iHour < iEnd))
  269. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement