HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <fun>
  6. #include <engine>
  7. #include <cstrike>
  8. #include <fakemeta>
  9.  
  10. #define PLUGIN "Spectator Maskepp"
  11. #define VERSION "2.0"
  12. #define AUTHOR "RsN"
  13.  
  14. #define JOG ADMIN_KICK
  15.  
  16. new prefix[] = "AMXX"
  17. new error[] = "AMXX Error"
  18. new spectator[33];
  19. new bool:duppla_ugras[33];
  20. new g_onoff;
  21.  
  22. public plugin_init() {
  23. register_plugin(PLUGIN, VERSION, AUTHOR)
  24. register_forward(FM_CmdStart, "duplaugras");
  25. register_clcmd("say /spec","spec")
  26. register_clcmd("say_team /spec","spec")
  27. register_concmd("amx_spec","givespec",JOG,"<nev> <1|0> - Jatekos szerepeben spectator")
  28. g_onoff = register_cvar("amx_spectator","1")
  29. }
  30. public spec(id)
  31. {
  32. if(get_pcvar_num(g_onoff) == 1)
  33. {
  34. new team = get_user_team(id)
  35. if(get_user_flags(id) & ADMIN_KICK)
  36. {
  37. if(is_user_alive(id))
  38. {
  39. if(team && CS_TEAM_SPECTATOR)
  40. {
  41. if(spectator[id] == 1)
  42. {
  43. cs_set_user_team(id, CS_TEAM_SPECTATOR)
  44. set_user_godmode(id,1)
  45. set_entity_visibility(id, 0);
  46. strip_user_weapons(id)
  47. set_user_footsteps(id, 0)
  48. set_hudmessage(255, 0, 255, 0.0, 0.62, 0, 6.0, 12.0)
  49. show_hudmessage(id, "[%s]: Mostantol nezo vagy!",prefix)
  50. spectator[id] = 0;
  51. }
  52. else if(spectator[id] == 0)
  53. {
  54. set_hudmessage(255, 0, 255, 0.0, 0.62, 0, 6.0, 12.0)
  55. show_hudmessage(id, "[%s]: Mostantol nem vagy jatekban!",prefix)
  56. set_entity_visibility(id, 1);
  57. set_user_godmode(id, 0)
  58. cs_set_user_team(id, CS_TEAM_UNASSIGNED)
  59. user_kill(id)
  60. set_user_frags(id, 0)
  61. set_user_footsteps(id, 1)
  62. cs_set_user_deaths(id,0)
  63. spectator[id] = 1;
  64. }
  65. }
  66. else
  67. {
  68. set_hudmessage(255, 0, 0, -1.0, -1.0)
  69. show_hudmessage(id, "[%s]: Mar spectator vagy!",error)
  70. }
  71. }
  72. }
  73. else
  74. {
  75. set_hudmessage(255, 0, 0, -1.0, -1.0)
  76. show_hudmessage(id, "[%s]: Nem vagy admin!",error)
  77. }
  78. }
  79. }
  80. public client_putinserver(id) spectator[id] = 1;
  81.  
  82. public client_PreThink(id) {
  83. if(get_pcvar_num(g_onoff) == 1)
  84. {
  85.  
  86. if(cs_get_user_team(id) != CS_TEAM_SPECTATOR)
  87. return PLUGIN_CONTINUE;
  88.  
  89. entity_set_float(id, EV_FL_fuser2, 0.0)
  90.  
  91. if (entity_get_int(id, EV_INT_button) & 2) {
  92. new flags = entity_get_int(id, EV_INT_flags)
  93.  
  94. if (flags & FL_WATERJUMP)
  95. return PLUGIN_CONTINUE
  96. if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
  97. return PLUGIN_CONTINUE
  98. if ( !(flags & FL_ONGROUND) )
  99. return PLUGIN_CONTINUE
  100.  
  101. new Float:velocity[3]
  102. entity_get_vector(id, EV_VEC_velocity, velocity)
  103. velocity[2] += 250.0
  104. entity_set_vector(id, EV_VEC_velocity, velocity)
  105.  
  106. entity_set_int(id, EV_INT_gaitsequence, 6)
  107. }
  108. }
  109. return PLUGIN_CONTINUE
  110. }
  111. public duplaugras(id, uc_handle)
  112. {
  113. if(get_pcvar_num(g_onoff) == 1)
  114. {
  115. if(cs_get_user_team(id) != CS_TEAM_SPECTATOR)
  116. return FMRES_IGNORED;
  117.  
  118. new button = get_uc(uc_handle, UC_Buttons);
  119. new oldbutton = pev(id, pev_oldbuttons);
  120. new flags = pev(id, pev_flags);
  121. if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && duppla_ugras[id])
  122. {
  123. duppla_ugras[id] = false;
  124. new Float:velocity[3];
  125. pev(id, pev_velocity, velocity);
  126. velocity[2] = random_float(265.0,285.0);
  127. set_pev(id, pev_velocity, velocity);
  128. }
  129. else if(flags & FL_ONGROUND)
  130. duppla_ugras[id] = true;
  131.  
  132. }
  133. return FMRES_IGNORED;
  134. }
  135. public givespec(id,level,cid) {
  136. if(get_pcvar_num(g_onoff) == 1)
  137. {
  138.  
  139. if(!cmd_access(id,level,cid,0)) //N?ha bugos ez?rt
  140. return PLUGIN_HANDLED
  141.  
  142. if(get_user_flags(id) & JOG) // Itt is lek?rem a jogait.
  143. {
  144. new arg1[256], arg2[256];
  145. read_argv(1,arg1,255);
  146. read_argv(2,arg2,255);
  147.  
  148. new player = cmd_target(id,arg1,2);
  149.  
  150. if (equal(arg2,"1")) {
  151. givedspec(player,1,id)
  152. }
  153.  
  154. if (equal(arg2,"0")) {
  155. givedspec(player,0,id);
  156. }
  157. }
  158. else
  159. {
  160. set_hudmessage(255, 0, 0, -1.0, -1.0)
  161. show_hudmessage(id, "[%s]: Nem vagy admin",error)
  162. }
  163. }
  164. return PLUGIN_HANDLED
  165. }
  166. public givedspec(playerID,admin,adminID) {
  167.  
  168. new name[64];
  169.  
  170. get_user_name(playerID,name,63);
  171.  
  172. if(admin==1)
  173. {
  174. set_hudmessage(255, 0, 255, 0.0, 0.62, 0, 6.0, 12.0)
  175. show_hudmessage(playerID, "[%s]: Mostantol nezo vagy!",prefix)
  176. set_entity_visibility(playerID, 0);
  177. set_user_godmode(playerID, 1)
  178. strip_user_weapons(playerID)
  179. cs_set_user_team(playerID, CS_TEAM_SPECTATOR)
  180.  
  181. }
  182. if(admin==0)
  183. {
  184. set_hudmessage(255, 0, 255, 0.0, 0.62, 0, 6.0, 12.0)
  185. show_hudmessage(playerID, "[%s]: Mostantol nem vagy jatekban!",prefix)
  186. set_entity_visibility(playerID, 1);
  187. set_user_godmode(playerID, 0)
  188. cs_set_user_team(playerID, CS_TEAM_UNASSIGNED)
  189. user_kill(playerID)
  190. set_user_frags(playerID, 0)
  191. cs_set_user_deaths(playerID,0)
  192. }
  193. }
  194. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  195. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  196. */
  197.