Guest User

Untitled

a guest
Oct 30th, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.07 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <colorchat>
  3. #include <cstrike>
  4. #include <engine>
  5. #include <fun>
  6. #include <hamsandwich>
  7. #include <stripweapons>
  8.  
  9. #define g_Buffer 1536
  10.  
  11. forward amxbans_admin_connect(id);
  12.  
  13. new Array:g_Array, bool:g_Vip[33], gRound=0, g_Hudmsg, menu,
  14. menu_callback_handler, skoki[33], weapon_id;
  15.  
  16. new const g_Langcmd[][]={"say /vips","say_team /vips","say /vipy","say_team /vipy"};
  17. new const g_Prefix[] = "Vip Chat";
  18.  
  19. public plugin_init(){
  20. register_plugin("VIP Ultimate", "12.3.0.2", "benio101 & speedkill");
  21. register_forward(FM_CmdStart, "CmdStartPre");
  22. RegisterHam(Ham_Spawn, "player", "SpawnedEventPre", 1);
  23. register_event("HLTV", "event_new_round", "a", "1=0", "2=0");
  24. register_logevent("GameCommencing", 2, "1=Game_Commencing");
  25. register_message(get_user_msgid("ScoreAttrib"), "VipStatus");
  26. g_Array=ArrayCreate(64,32);
  27. for(new i;i<sizeof g_Langcmd;i++){
  28. register_clcmd(g_Langcmd[i], "ShowVips");
  29. }
  30. register_clcmd("say /vip", "ShowMotd");
  31. set_task(30.0, "ShowAdv",.flags = "b");
  32. register_clcmd("say_team", "VipChat");
  33. register_message(get_user_msgid("SayText"),"handleSayText");
  34. g_Hudmsg=CreateHudSyncObj();
  35. }
  36. public client_authorized(id){
  37. if(get_user_flags(id) & 524288 == 524288){
  38. client_authorized_vip(id);
  39. }
  40. }
  41. public client_authorized_vip(id){
  42. g_Vip[id]=true;
  43. new g_Name[64];
  44. get_user_name(id,g_Name,charsmax(g_Name));
  45.  
  46. new g_Size = ArraySize(g_Array);
  47. new szName[64];
  48.  
  49. for(new i = 0; i < g_Size; i++){
  50. ArrayGetString(g_Array, i, szName, charsmax(szName));
  51.  
  52. if(equal(g_Name, szName)){
  53. return 0;
  54. }
  55. }
  56. ArrayPushString(g_Array,g_Name);
  57. set_hudmessage(255, 255, 0, -1.0, 0.07, 0, 6.0, 6.0);
  58. ShowSyncHudMsg(0, g_Hudmsg, "Wchodzi VIP (%s)",g_Name);
  59.  
  60. return PLUGIN_CONTINUE;
  61. }
  62. public client_disconnect(id){
  63. if(g_Vip[id]){
  64. client_disconnect_vip(id);
  65. }
  66. }
  67. public client_disconnect_vip(id){
  68. g_Vip[id]=false;
  69. new Name[64];
  70. get_user_name(id,Name,charsmax(Name));
  71.  
  72. new g_Size = ArraySize(g_Array);
  73. new g_Name[64];
  74.  
  75. for(new i = 0; i < g_Size; i++){
  76. ArrayGetString(g_Array, i, g_Name, charsmax(g_Name));
  77.  
  78. if(equal(g_Name,Name)){
  79. ArrayDeleteItem(g_Array,i);
  80. break;
  81. }
  82. }
  83. }
  84. public CmdStartPre(id, uc_handle){
  85. if(g_Vip[id]){
  86. if(is_user_alive(id)){
  87. CmdStartPreVip(id, uc_handle);
  88. }
  89. }
  90. }
  91. public CmdStartPreVip(id, uc_handle){
  92. new flags = pev(id, pev_flags);
  93. if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id]>0){
  94. --skoki[id];
  95. new Float:velocity[3];
  96. pev(id, pev_velocity,velocity);
  97. velocity[2] = random_float(265.0,285.0);
  98. set_pev(id,pev_velocity,velocity);
  99. } else if(flags & FL_ONGROUND && skoki[id]!=-1){
  100. skoki[id] = 0;
  101. }
  102. }
  103. public SpawnedEventPre(id){
  104. skoki[id]=1;
  105. if(g_Vip[id]){
  106. if(is_user_alive(id)){
  107. SpawnedEventPreVip(id);
  108. }
  109. }
  110. }
  111. public SpawnedEventPreVip(id){
  112. set_user_armor(id, 100)
  113. if(gRound>=3){
  114. new henum=(user_has_weapon(id,CSW_HEGRENADE)?cs_get_user_bpammo(id,CSW_HEGRENADE):0);
  115. give_item(id, "weapon_hegrenade");
  116. ++henum;
  117. new fbnum=(user_has_weapon(id,CSW_FLASHBANG)?cs_get_user_bpammo(id,CSW_FLASHBANG):0);
  118. give_item(id, "weapon_flashbang");
  119. ++fbnum;
  120. cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
  121. new sgnum=(user_has_weapon(id,CSW_SMOKEGRENADE)?cs_get_user_bpammo(id,CSW_SMOKEGRENADE):0);
  122. give_item(id, "weapon_smokegrenade");
  123. ++sgnum;
  124. }
  125. show_vip_menu(id);
  126. set_task(10.0, "close", id+677);
  127. }
  128. public close(task_id){
  129. new id=task_id-677
  130. show_menu(id, 0, "^n", 1);
  131. return PLUGIN_HANDLED;
  132. }
  133. public menu_1_handler(id){
  134. StripWeapons(id, Primary);
  135. give_item(id, "weapon_ak47");
  136. give_item(id, "weapon_deagle");
  137. give_item(id, "ammo_762nato");
  138. weapon_id=find_ent_by_owner(-1, "weapon_ak47", id);
  139. if(weapon_id)cs_set_weapon_ammo(weapon_id, 30);
  140. cs_set_user_bpammo(id, CSW_AK47, 90);
  141. weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
  142. if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
  143. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  144. }
  145. public menu_2_handler(id){
  146. StripWeapons(id, Primary);
  147. give_item(id, "weapon_m4a1");
  148. give_item(id, "weapon_deagle");
  149. give_item(id, "ammo_556nato");
  150. weapon_id=find_ent_by_owner(-1, "weapon_m4a1", id);
  151. if(weapon_id)cs_set_weapon_ammo(weapon_id, 30);
  152. cs_set_user_bpammo(id, CSW_M4A1, 90);
  153. weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
  154. if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
  155. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  156. }
  157. public menu_3_handler(id){
  158. StripWeapons(id, Primary);
  159. give_item(id, "weapon_m4a1");
  160. give_item(id, "weapon_deagle");
  161. give_item(id, "ammo_338magnum");
  162. weapon_id=find_ent_by_owner(-1, "weapon_awp", id);
  163. if(weapon_id)cs_set_weapon_ammo(weapon_id, 10);
  164. cs_set_user_bpammo(id, CSW_M4A1, 30);
  165. weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
  166. if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
  167. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  168. }
  169. public menu_4_handler(id){
  170. StripWeapons(id, Primary);
  171. give_item(id, "weapon_m4a1");
  172. give_item(id, "weapon_deagle");
  173. give_item(id, "ammo_338magnum");
  174. weapon_id=find_ent_by_owner(-1, "weapon_famas", id);
  175. if(weapon_id)cs_set_weapon_ammo(weapon_id, 25);
  176. cs_set_user_bpammo(id, CSW_M4A1, 90);
  177. weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
  178. if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
  179. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  180. }
  181. public menu_5_handler(id){
  182. StripWeapons(id, Primary);
  183. give_item(id, "weapon_m249");
  184. give_item(id, "ammo_556natobox");
  185. give_item(id, "weapon_deagle");
  186. give_item(id, "ammo_338magnum");
  187. weapon_id=find_ent_by_owner(-1, "weapon_m249", id);
  188. if(weapon_id)cs_set_weapon_ammo(weapon_id, 100);
  189. cs_set_user_bpammo(id, CSW_M249, 300);
  190. weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
  191. if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
  192. cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  193. }
  194. public show_vip_menu(id){
  195. menu=menu_create("\d(\rNa wybranie broni:\y 10 sekund\d)^n\dMenu broni VIPa:","menu_handler");
  196. menu_callback_handler=menu_makecallback("menu_callback");
  197. new bool:active=false, num=-1;
  198. menu_additem(menu,"\wAK47 + Deagle + \r(\dZestaw Granatów\r)","",0,menu_callback_handler);
  199. if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
  200. active=true;
  201. }
  202. menu_additem(menu,"\wM4A1 + Deagle + \r(\dZestaw Granatów\r)","",0,menu_callback_handler);
  203. if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
  204. active=true;
  205. }
  206. if(active){
  207. menu_setprop(menu,MPROP_EXITNAME,"\rWyjdz");
  208. menu_setprop(menu,MPROP_TITLE,"\d(\rNa wybranie broni:\y 20 sekund\d)^n\r** \dMenu broni VIPa:");
  209. menu_setprop(menu,MPROP_NUMBER_COLOR,"\r");
  210. menu_display(id, menu);
  211. } else {
  212. menu_destroy(menu);
  213. }
  214. }
  215. public event_new_round(){
  216. ++gRound;
  217. }
  218. public GameCommencing(){
  219. gRound=0;
  220. }
  221. public menu_callback(id, menu, item){
  222. if(is_user_alive(id)){
  223. if(gRound>=3){
  224. if(item==0){
  225. return ITEM_ENABLED;
  226. }
  227. if(item==1){
  228. return ITEM_ENABLED;
  229. }
  230. if(item==2){
  231. return ITEM_ENABLED;
  232. }
  233. if(item==3){
  234. return ITEM_ENABLED;
  235. }
  236. if(item==4){
  237. return ITEM_ENABLED;
  238. }
  239. }
  240. }
  241. return ITEM_DISABLED;
  242. }
  243. public menu_handler(id, menu, item){
  244. if(is_user_alive(id)){
  245. if(gRound>=3){
  246. if(item==0){
  247. menu_1_handler(id);
  248. }
  249. if(item==1){
  250. menu_2_handler(id);
  251. }
  252. if(item==2){
  253. menu_3_handler(id);
  254. }
  255. if(item==3){
  256. menu_4_handler(id);
  257. }
  258. if(item==5){
  259. menu_5_handler(id);
  260. }
  261. }
  262. }
  263. remove_task(id+677);
  264. menu_destroy(menu);
  265. return PLUGIN_HANDLED;
  266. }
  267. public VipStatus(){
  268. new id=get_msg_arg_int(1);
  269. if(is_user_alive(id) && g_Vip[id]){
  270. set_msg_arg_int(2, ARG_BYTE, get_msg_arg_int(2)|4);
  271. }
  272. }
  273. public ShowVips(id){
  274. new g_Name[64],g_Message[192];
  275.  
  276. new g_Size=ArraySize(g_Array);
  277.  
  278. for(new i = 0; i < g_Size; i++){
  279. ArrayGetString(g_Array, i, g_Name, charsmax(g_Name));
  280.  
  281. add(g_Message, charsmax(g_Message), g_Name);
  282.  
  283. if(i == g_Size - 1){
  284. add(g_Message, charsmax(g_Message), ".");
  285. }
  286. else{
  287. add(g_Message, charsmax(g_Message), ", ");
  288. }
  289. }
  290. ColorChat(id,RED,"^x04[DD2]^x01 Gracze z ranga VIP:^x03 %s", g_Message);
  291. ShowVipsMotd(id);
  292. return PLUGIN_CONTINUE;
  293. }
  294. public ShowVipsMotd(id){
  295. new Data[g_Buffer],Len,g_Name[64];
  296.  
  297. Len = formatex(Data[Len], g_Buffer - Len, "<html><body bgcolor=Black><br>");
  298. Len += formatex(Data[Len], g_Buffer - Len, "<center><table frame=^"border^" width=^"600^" cellspacing=^"0^" bordercolor=#4A4344 style=^"color:#56A5EC;text-align:center;^">");
  299. Len += formatex(Data[Len], g_Buffer- Len, "<tr><td><b>[V.I.P]</b></td><td><b>Nick</b></td></td></tr>");
  300.  
  301. new g_Size=ArraySize(g_Array);
  302.  
  303. for(new i = 0; i < g_Size; i++){
  304. ArrayGetString(g_Array, i, g_Name, charsmax(g_Name));
  305.  
  306. Len += formatex(Data[Len], g_Buffer - Len, "<tr>");
  307. Len += formatex(Data[Len], g_Buffer - Len, "<td><font color=Red>%d</font></td>", i + 1);
  308. Len += formatex(Data[Len], g_Buffer - Len, "<td>%s</td>", g_Name);
  309. Len += formatex(Data[Len], g_Buffer - Len, "</tr>");
  310. }
  311. Len += formatex(Data[Len],g_Buffer - Len,"</center></body></html>");
  312.  
  313. show_motd(id, Data, "**** VIPy ****");
  314. }
  315. public client_infochanged(id){
  316. if(g_Vip[id]){
  317. new szName[64];
  318. get_user_info(id,"name",szName,charsmax(szName));
  319.  
  320. new Name[64];
  321. get_user_name(id,Name,charsmax(Name));
  322.  
  323. if(!equal(szName,Name)){
  324. ArrayPushString(g_Array,szName);
  325.  
  326. new g_Size=ArraySize(g_Array);
  327. new g_Name[64];
  328. for(new i = 0; i < g_Size; i++){
  329. ArrayGetString(g_Array, i, g_Name, charsmax(g_Name));
  330.  
  331. if(equal(g_Name,Name)){
  332. ArrayDeleteItem(g_Array,i);
  333. break;
  334. }
  335. }
  336. }
  337. }
  338. }
  339. public plugin_end(){
  340. ArrayDestroy(g_Array);
  341. }
  342. public ShowMotd(id){
  343. show_motd(id, "vip.txt", "**** VIP ****");
  344. }
  345. public ShowAdv(){
  346. ColorChat(0, RED, "^x04[DD2]^x01 Co posiada VIP^x03 /vip^x01 oraz kto nim jest^x03 /vips^x01!");
  347. }
  348. public VipChat(id){
  349. if(g_Vip[id]){
  350. new g_Msg[256],
  351. g_Text[256];
  352.  
  353. read_args(g_Msg,charsmax(g_Msg));
  354. remove_quotes(g_Msg);
  355.  
  356. if(g_Msg[0] == '*' && g_Msg[1]){
  357. new g_Name[64];
  358. get_user_name(id,g_Name,charsmax(g_Name));
  359.  
  360. formatex(g_Text,charsmax(g_Text),"^x01(%s) ^x03%s : ^x04%s",g_Prefix, g_Name, g_Msg[1]);
  361.  
  362. for(new i=1;i<33;i++){
  363. if(is_user_connected(i) && g_Vip[i])
  364. ColorChat(i, GREEN, "%s", g_Text);
  365. }
  366. return PLUGIN_HANDLED_MAIN;
  367. }
  368. }
  369. return PLUGIN_CONTINUE;
  370. }
  371. public handleSayText(msgId,msgDest,msgEnt){
  372. new id = get_msg_arg_int(1);
  373.  
  374. if(is_user_connected(id) && g_Vip[id]){
  375. new szTmp[256],szTmp2[256];
  376. get_msg_arg_string(2,szTmp, charsmax(szTmp))
  377.  
  378. new szPrefix[64] = "^x03[^x04VIP^x03]";
  379.  
  380. if(!equal(szTmp,"#Cstrike_Chat_All")){
  381. add(szTmp2,charsmax(szTmp2),szPrefix);
  382. add(szTmp2,charsmax(szTmp2)," ");
  383. add(szTmp2,charsmax(szTmp2),szTmp);
  384. }
  385. else{
  386. add(szTmp2,charsmax(szTmp2),szPrefix);
  387. add(szTmp2,charsmax(szTmp2),"^x03 %s1^x01 : %s2");
  388. }
  389. set_msg_arg_string(2,szTmp2);
  390. }
  391. return PLUGIN_CONTINUE;
  392. }
  393. public amxbans_admin_connect(id){
  394. client_authorized(id,"");
  395. }
  396. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  397. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
  398. */
  399.  
Advertisement
Add Comment
Please, Sign In to add comment