Advertisement
Guest User

Untitled

a guest
May 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.06 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <fun>
  5. #include <hamsandwich>
  6. #include <fakemeta_util>
  7. #include <stripweapons>
  8. #include <colorchat>
  9.  
  10. static const COLOR[] = "^x04" //green
  11. static const CONTACT[] = ""
  12. new maxplayers
  13. new gmsgSayText
  14. new g_type, g_hudmsg
  15. new mpd, mkb, mhb
  16. new health_add
  17. new health_hs_add
  18. new health_max
  19. new nKiller
  20. new nKiller_hp
  21. new nHp_add
  22. new round;
  23. new nHp_max
  24. new g_menu_active
  25. #define VIP_LEVEL_ACCES ADMIN_LEVEL_F
  26. #define REMOVE_FLAGS "r"
  27. #define Keysrod (1<<0)|(1<<1)|(1<<2)|(1<<9)
  28.  
  29. new const RMaps [ ] [ ] =
  30. {
  31. "35hp",
  32. "35hp_2",
  33. "31hp",
  34. "1hp",
  35. "100hp"
  36. };
  37.  
  38.  
  39. public plugin_init()
  40. {
  41. register_plugin("VIP", "3.0", "Hasky")
  42. mpd = register_cvar("vip_money_damage","3")
  43. mkb = register_cvar("vip_money_kill","500")
  44. mhb = register_cvar("vip_money_hs","1000")
  45. health_add = register_cvar("vip_hp_kill", "10")
  46. health_hs_add = register_cvar("vip_hp_hs", "25")
  47. health_max = register_cvar("vip_hp_max", "100")
  48. g_menu_active = register_cvar("vip_guns_menu", "1")
  49. register_event("Damage","Damage","b")
  50. register_event("DeathMsg","death_msg","a")
  51. register_clcmd("say /vip","ShowMotd")
  52. maxplayers = get_maxplayers()
  53. gmsgSayText = get_user_msgid("SayText")
  54. register_clcmd("say", "handle_say")
  55. register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)
  56. register_event("TextMsg","Event_RoundRestart","a","2&#Game_w")
  57. register_event("DeathMsg", "hook_death", "a", "1>0")
  58. register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")
  59. register_menucmd(register_menuid("rod"), Keysrod, "Pressedrod")
  60. g_type = register_cvar("vip_bulletdamage","1")
  61. g_hudmsg = CreateHudSyncObj()
  62. register_event("ResetHUD", "resetModel", "b")
  63. register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
  64.  
  65. RegisterHam(Ham_Spawn, "player", "Spawn", 1)
  66.  
  67.  
  68. }
  69. public plugin_precache()
  70. {
  71.  
  72. precache_model("models/player/vip_ct/vip_ct1.mdl")
  73. precache_model("models/player/vip_te/vip_te2.mdl")
  74. return PLUGIN_CONTINUE
  75. }
  76.  
  77. public resetModel(id, level, cid)
  78. {
  79. if (get_user_flags(id) & ADMIN_LEVEL_H)
  80. {
  81. new CsTeams:userTeam = cs_get_user_team(id)
  82. if (userTeam == CS_TEAM_T)
  83. {
  84. cs_set_user_model(id, "vip_te")
  85. }
  86. else if(userTeam == CS_TEAM_CT)
  87. {
  88. cs_set_user_model(id, "vip_ct")
  89. }
  90. else
  91. {
  92. cs_reset_user_model(id)
  93. }
  94. }
  95.  
  96. return PLUGIN_CONTINUE
  97. }
  98. public on_damage(id)
  99. {
  100. if(get_pcvar_num(g_type))
  101. {
  102. static attacker; attacker = get_user_attacker(id)
  103. static damage; damage = read_data(2)
  104.  
  105. if(get_user_flags(attacker) & ADMIN_LEVEL_H)
  106. {
  107. if(is_user_connected(attacker))
  108. {
  109. if(fm_is_ent_visible(attacker,id))
  110. {
  111. set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
  112. ShowSyncHudMsg(attacker, g_hudmsg, "%i^n", damage)
  113. }
  114.  
  115.  
  116. }
  117. }
  118. }
  119. }
  120.  
  121. public Damage(id)
  122. {
  123. new weapon, hitpoint, attacker = get_user_attacker(id,weapon,hitpoint)
  124. if(attacker<=maxplayers && is_user_alive(attacker) && attacker!=id)
  125. if (get_user_flags(attacker) & ADMIN_LEVEL_H)
  126. {
  127. new money = read_data(2) * get_pcvar_num(mpd)
  128. if(hitpoint==1) money += get_pcvar_num(mhb)
  129. cs_set_user_money(attacker,cs_get_user_money(attacker) + money)
  130. }
  131. }
  132.  
  133. public death_msg()
  134. {
  135. if(read_data(1)<=maxplayers && read_data(1) && read_data(1)!=read_data(2)) cs_set_user_money(read_data(1),cs_get_user_money(read_data(1)) + get_pcvar_num(mkb) - 300)
  136. }
  137. public event_new_round()
  138. {
  139. round++
  140. new players[32], player, pnum;
  141. get_players(players, pnum, "a");
  142. for(new i = 0; i < pnum; i++)
  143. {
  144. player = players[i];
  145. if(get_user_flags(player) & ADMIN_LEVEL_H)
  146. {
  147.  
  148. if (!get_pcvar_num(g_menu_active))
  149. return PLUGIN_CONTINUE
  150.  
  151. if(round > 2)
  152. Showrod(player);
  153.  
  154. }
  155. }
  156. return PLUGIN_HANDLED
  157. }
  158.  
  159. public Event_RoundRestart(id)
  160. {
  161. round=0;
  162. }
  163.  
  164. public hook_death()
  165. {
  166. // Killer id
  167. nKiller = read_data(1)
  168.  
  169. if ( (read_data(3) == 1) && (read_data(5) == 0) )
  170. {
  171. nHp_add = get_pcvar_num (health_hs_add)
  172. }
  173. else
  174. nHp_add = get_pcvar_num (health_add)
  175. nHp_max = get_pcvar_num (health_max)
  176. // Updating Killer HP
  177. if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
  178. return;
  179.  
  180. nKiller_hp = get_user_health(nKiller)
  181. nKiller_hp += nHp_add
  182. // Maximum HP check
  183. if (nKiller_hp > nHp_max) nKiller_hp = nHp_max
  184. set_user_health(nKiller, nKiller_hp)
  185. // Hud message "Healed +15/+30 hp"
  186. set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
  187. show_hudmessage(nKiller, "Healed +%d hp", nHp_add)
  188. // Screen fading
  189. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, nKiller)
  190. write_short(1<<10)
  191. write_short(1<<10)
  192. write_short(0x0000)
  193. write_byte(0)
  194. write_byte(0)
  195. write_byte(200)
  196. write_byte(75)
  197. message_end()
  198.  
  199. }
  200.  
  201. public Showrod(id)
  202. {
  203. show_menu(id, Keysrod, "Guns Menu^n\w1. M4a1+Deagle^n\w2. AK47+Deagle^n\w3. Grenades^n0. Exit^n", -1, "rod") // Display menu
  204. }
  205. public Pressedrod(id, key)
  206. {
  207.  
  208. switch (key) {
  209. case 0: {
  210. StripWeapons(id, Primary)
  211. StripWeapons(id, Secondary);
  212. give_item(id,"weapon_m4a1")
  213. give_item(id,"weapon_deagle")
  214. give_item(id, "item_assaultsuit");
  215. give_item(id, "item_thighpack");
  216. cs_set_user_bpammo(id, CSW_M4A1, 90 );
  217. cs_set_user_bpammo(id, CSW_DEAGLE, 35 );
  218. client_print(id, print_center, "You Taked Free M4A1 and Deagle")
  219. ColorChat(id, GREEN, "[VIP]^x01 Ai primit un^x04 M4a1^x01 si un^x04 Deagle")
  220. }
  221.  
  222. case 1: {
  223. StripWeapons(id, Primary)
  224. StripWeapons(id, Secondary);
  225. give_item(id,"weapon_ak47")
  226. give_item(id,"weapon_deagle")
  227. give_item(id, "item_assaultsuit");
  228. give_item(id, "item_thighpack");
  229. cs_set_user_bpammo(id, CSW_AK47, 90);
  230. cs_set_user_bpammo(id, CSW_DEAGLE, 35 );
  231. ColorChat(id, GREEN, "[VIP]^x01 Ai primit un^x04 Ak47^x01 si un^x04 Deagle")
  232. }
  233.  
  234. case 2: {
  235. StripWeapons(id, Grenades)
  236. give_item(id, "weapon_hegrenade");
  237. give_item(id, "weapon_flashbang");
  238. give_item(id, "weapon_flashbang");
  239. give_item(id, "weapon_smokegrenade");
  240. give_item(id, "item_assaultsuit");
  241. give_item(id, "item_thighpack");
  242. ColorChat(id, GREEN, "[VIP]^x01 Ai primit un ^x04set de grenazi")
  243. }
  244.  
  245. case 9: {
  246. }
  247. }
  248. return PLUGIN_CONTINUE
  249. }
  250.  
  251.  
  252. public ShowMotd(id)
  253. {
  254. show_motd(id, "vip.txt")
  255. }
  256.  
  257. public handle_say(id) {
  258. new said[192]
  259. read_args(said,192)
  260. if( contain(said, "/vips") != -1 )
  261. set_task(0.1,"print_adminlist",id)
  262. return PLUGIN_CONTINUE
  263. }
  264.  
  265. public print_adminlist(user)
  266. {
  267. new adminnames[33][32]
  268. new message[256]
  269. new contactinfo[256], contact[112]
  270. new id, count, x, len
  271.  
  272. for(id = 1 ; id <= maxplayers ; id++)
  273. if(is_user_connected(id))
  274. if(get_user_flags(id) & ADMIN_LEVEL_H)
  275. get_user_name(id, adminnames[count++], 31)
  276.  
  277. len = format(message, 255, "%s VIP Online: ",COLOR)
  278. if(count > 0) {
  279. for(x = 0 ; x < count ; x++) {
  280. len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
  281. if(len > 96 ) {
  282. print_message(user, message)
  283. len = format(message, 255, "%s ",COLOR)
  284. }
  285. }
  286. print_message(user, message)
  287. }
  288. else {
  289. len += format(message[len], 255-len, "No VIP online.")
  290. print_message(user, message)
  291. }
  292.  
  293. get_cvar_string("amx_contactinfo", contact, 63)
  294. if(contact[0]) {
  295. format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact)
  296. print_message(user, contactinfo)
  297. }
  298. }
  299.  
  300. print_message(id, msg[]) {
  301. message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
  302. write_byte(id)
  303. write_string(msg)
  304. message_end()
  305. }
  306.  
  307. public Spawn(id)
  308. {
  309. if(!is_user_alive(id))
  310. return;
  311.  
  312. new CsTeams:team = cs_get_user_team(id)
  313. if(get_user_flags(id) & VIP_LEVEL_ACCES)
  314. {
  315. new MapName[32]; get_mapname(MapName, sizeof(MapName));
  316. for (new i = 0; i < sizeof (RMaps); i ++)
  317. }
  318. {
  319. if(equali (MapName, RMaps[i]))
  320. {
  321. remove_user_flags (id, read_flags(REMOVE_FLAGS));
  322. }
  323. }
  324. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement