seroff

Elf Random 1.0 By Seroff

Jan 10th, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta_util>
  3. #include <fm_cstrike>
  4.  
  5. #pragma tabsize 4
  6.  
  7. new szcrand=0,sztrand=0,sccounts=0,stcounts=0,g_syncHudMessage
  8.  
  9. public plugin_init(){
  10. register_plugin("Elf Random","1.0","Seroff");
  11. register_event("HLTV", "se_Rounds", "a", "1=0", "2=0");
  12. register_event("TextMsg", "se_RRs", "a", "2&#Game_C", "2&#Game_w");
  13. szcrand=0;
  14. sztrand=0;
  15. sccounts=0;
  16. stcounts=0;
  17. g_syncHudMessage = CreateHudSyncObj();
  18. }
  19.  
  20. public plugin_precache() {
  21. precache_model("models/player/elf_xmas/elf_xmas.mdl");
  22. return PLUGIN_CONTINUE;
  23. }
  24.  
  25. public se_Rounds(){
  26. szcrand++;
  27. sztrand++;
  28. set_task(2.0,"user_random",0);
  29. }
  30.  
  31. public se_RRs(){
  32. szcrand=0;
  33. sztrand=0;
  34. }
  35.  
  36. public user_random(){
  37. new users[32],team[32],id;
  38. static Count, i,iPlayer;
  39. get_players(users, Count, "h")
  40. if(Count>=10){
  41. for(new is = 1; is <= Count; is++)
  42. {
  43. iPlayer=users[is];
  44. get_user_team(iPlayer,team,31);
  45. switch(team[0]){
  46. case 'C':{
  47. sccounts++;
  48. }
  49. case 'T':{
  50. stcounts++;
  51. }
  52. }
  53. }
  54. if(sccounts>=5 && stcounts>=5){
  55. for (i=0; i<Count; i++) {
  56. id = users[i];
  57. if(!is_user_admin(id)){
  58. fm_cs_reset_user_model(id);
  59. set_task(1.0,"rUsers",id);
  60. }
  61. }
  62. }else{
  63. szcrand=0;
  64. sztrand=0;
  65. }
  66. }else{
  67. szcrand=0;
  68. sztrand=0;
  69. }
  70. }
  71.  
  72. public rUsers(id){
  73. new team[32],name[32];
  74. get_user_team(id,team,31);
  75. get_user_team(id,name,31);
  76. ClearSyncHud(id, g_syncHudMessage);
  77. switch(team[0]){
  78. case 'C':{
  79. if(szcrand==1){
  80. szcrand--;
  81. fm_cs_set_user_model(id, "elf_xmas");
  82. fm_set_user_health(id,200);
  83. fm_cs_set_user_armor(id,200,CS_ARMOR_VESTHELM);
  84. set_hudmessage(0, 0, 255, -1.0, -1.0, 2, 1.0, 1.0, 0.1, 1.0, -1);
  85. ShowSyncHudMsg(0, g_syncHudMessage, "Игрок [%s] стал эльфом",name);
  86. }
  87. }
  88. case 'T':{
  89. if(sztrand==1){
  90. sztrand--;
  91. //fm_cs_set_user_model(id, "elf_xmas");
  92. // Тест
  93. engfunc(EngFunc_SetModel, id, "models/elf_xmas/elf_xmas.mdl");
  94. fm_set_user_health(id,200);
  95. fm_cs_set_user_armor(id,200,CS_ARMOR_VESTHELM);
  96. set_hudmessage(255, 0, 0, -1.0, -1.0, 2, 1.0, 1.0, 0.1, 1.0, -1);
  97. ShowSyncHudMsg(0, g_syncHudMessage, "Игрок [%s] стал эльфом",name);
  98. }
  99. }
  100. }
  101. }
  102.  
  103. stock is_user_admin(id){
  104. new __flags=get_user_flags(id);
  105. return (__flags>0 && !(__flags&ADMIN_USER));
  106. }
Advertisement
Add Comment
Please, Sign In to add comment