Advertisement
Guest User

Untitled

a guest
Apr 20th, 2016
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.41 KB | None | 0 0
  1. /*
  2. Plugin: Amx Ejaculate
  3. Version: 0.1
  4. Author: KRoTaL
  5.  
  6. 0.1 Release
  7.  
  8.  
  9. Commands:
  10.  
  11. To ejaculate on a dead body you have to bind a key to: ejaculate
  12. Open your console and type: bind "key" "ejaculate"
  13. ex: bind "x" "ejaculate"
  14. Then stand still above a dead player (cs/cz only), press your key and you'll ejaculate on them !
  15. You can control the direction of the stream with your mouse.
  16.  
  17. Players can say "/ejaculate" in the chat to get some help.
  18.  
  19. Cvars:
  20.  
  21. amx_maxejaculations 6 - Maximum number of times a player is allowed to ejaculate per round.
  22.  
  23. amx_ejaculate_admin 0 - 0 : All the players are allowed to ejaculate
  24. 1 : Only admins with ADMIN_LEVEL_A flag are allowed to ejaculate
  25.  
  26. Setup:
  27.  
  28. You need to put these files on your server:
  29.  
  30. sound/ejaculate/ejaculate.wav
  31. addons/amx/lang/ejaculate.txt
  32.  
  33. */
  34.  
  35. // UNCOMMENT IF YOU USE ANOTHER MOD THAN CS and CS-CZ
  36. //#define NO_CS_CZ
  37.  
  38.  
  39.  
  40.  
  41. /***************************************************************************************************/
  42.  
  43. #include <amxmodx>
  44.  
  45. new count_ejaculate[33]
  46. new bool:EjaculateFlag[33]
  47. new bool:aim[33]
  48. new counter[33]
  49. #if !defined NO_CS_CZ
  50. new player_origins[33][3]
  51. #endif
  52.  
  53. public ejaculate_on_player(id)
  54. {
  55.  
  56. if (get_cvar_num("amx_maxejaculations")==0)
  57. return PLUGIN_HANDLED
  58. if (!is_user_alive(id))
  59. return PLUGIN_HANDLED
  60. if ( (get_cvar_num("amx_ejaculate_admin")==1) && !(get_user_flags(id) & ADMIN_LEVEL_A) )
  61. {
  62. console_print(id,"[AMXX] You now have access to the command")
  63. return PLUGIN_HANDLED
  64. }
  65. if(EjaculateFlag[id])
  66. return PLUGIN_HANDLED
  67.  
  68. #if !defined NO_CS_CZ
  69. new player_origin[3], players[32], inum=0, dist, last_dist=99999, last_id
  70.  
  71. get_user_origin(id,player_origin,0)
  72. get_players(players,inum,"b")
  73. if (inum>0) {
  74. for (new i=0;i<inum;i++) {
  75. if (players[i]!=id) {
  76. dist = get_distance(player_origin,player_origins[players[i]])
  77. if (dist<last_dist) {
  78. last_id = players[i]
  79. last_dist = dist
  80. }
  81. }
  82. }
  83. if (last_dist<80) {
  84. #endif
  85. if (count_ejaculate[id] > get_cvar_num("amx_maxejaculations")) {
  86. client_print(id,print_chat,"You can ejaculate on a player only %d per round !", get_cvar_num("amx_maxejaculations"))
  87. return PLUGIN_CONTINUE
  88. }
  89. new player_name[32]
  90. get_user_name(id, player_name, 31)
  91. #if !defined NO_CS_CZ
  92. new dead_name[32]
  93. get_user_name(last_id, dead_name, 31)
  94. client_print(0,print_chat,"%s ejaculates on his body %s ! BwHaHaHaHa!", player_name, dead_name)
  95. #else
  96. client_print(0,print_chat,"%s ejaculates!", player_name)
  97. #endif
  98. count_ejaculate[id]+=1
  99. new ids[1]
  100. ids[0]=id
  101. EjaculateFlag[id]=true
  102. aim[id]=false
  103. counter[id]=0
  104. emit_sound(id, CHAN_VOICE, "ejaculate/ejaculate.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  105. set_task(1.0,"make_ejaculate",4210+id,ids,1,"a",10)
  106. #if !defined NO_CS_CZ
  107. }
  108. else
  109. {
  110. client_print(id,print_chat,"Where's my body?")
  111. return PLUGIN_HANDLED
  112. }
  113. }
  114. #endif
  115.  
  116. return PLUGIN_HANDLED
  117. }
  118.  
  119. public sqrt(num)
  120. {
  121. new div = num
  122. new result = 1
  123. while (div > result) {
  124. div = (div + result) / 2
  125. result = num / div
  126. }
  127. return div
  128. }
  129.  
  130. public make_ejaculate(ids[])
  131. {
  132. new id=ids[0]
  133. new vec[3]
  134. new aimvec[3]
  135. new velocityvec[3]
  136. new length
  137. get_user_origin(id,vec)
  138. get_user_origin(id,aimvec,3)
  139. new distance = get_distance(vec,aimvec)
  140. new speed = floatround(distance*1.9)
  141.  
  142. velocityvec[0]=aimvec[0]-vec[0]
  143. velocityvec[1]=aimvec[1]-vec[1]
  144. velocityvec[2]=aimvec[2]-vec[2]
  145.  
  146. length=sqrt(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityvec[1]+velocityvec[2]*velocityvec[2])
  147.  
  148. velocityvec[0]=velocityvec[0]*speed/length
  149. velocityvec[1]=velocityvec[1]*speed/length
  150. velocityvec[2]=velocityvec[2]*speed/length
  151.  
  152. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  153. write_byte(101)
  154. write_coord(vec[0])
  155. write_coord(vec[1])
  156. write_coord(vec[2])
  157. write_coord(velocityvec[0])
  158. write_coord(velocityvec[1])
  159. write_coord(velocityvec[2])
  160. write_byte(6) // color
  161. write_byte(160) // speed
  162. message_end()
  163.  
  164. counter[id]++
  165. if(counter[id]==10)
  166. EjaculateFlag[id]=false
  167. }
  168.  
  169. public death_event()
  170. {
  171. new victim = read_data(2)
  172. #if !defined NO_CS_CZ
  173. get_user_origin(victim,player_origins[victim],0)
  174. #endif
  175.  
  176. if(EjaculateFlag[victim])
  177. reset_ejaculate(victim)
  178.  
  179. return PLUGIN_CONTINUE
  180. }
  181.  
  182. public reset_ejaculate(id)
  183. {
  184. if(task_exists(4210+id))
  185. remove_task(4210+id)
  186. emit_sound(id,CHAN_VOICE,"ejaculate/ejaculate.wav", 0.0, ATTN_NORM, 0, PITCH_NORM)
  187. EjaculateFlag[id]=false
  188.  
  189. return PLUGIN_CONTINUE
  190. }
  191.  
  192. public reset_hud(id)
  193. {
  194. if(task_exists(4210+id))
  195. remove_task(4210+id)
  196. emit_sound(id,CHAN_VOICE,"ejaculate/ejaculate.wav", 0.0, ATTN_NORM, 0, PITCH_NORM)
  197. EjaculateFlag[id]=false
  198.  
  199. count_ejaculate[id]=1
  200.  
  201. return PLUGIN_CONTINUE
  202. }
  203.  
  204. public ejaculate_help(id)
  205. {
  206. client_print(id, print_chat, "To ejaculate on a dead body you have to bind a key to ejaculate")
  207. client_print(id, print_chat, "Open console and type: bind ^"key^" ^"ejaculate^"")
  208. client_print(id, print_chat, "example: bind ^"x^" ^"ejaculate^"")
  209.  
  210. return PLUGIN_CONTINUE
  211. }
  212.  
  213. public handle_say(id)
  214. {
  215. new said[192]
  216. read_args(said,192)
  217. remove_quotes(said)
  218.  
  219. if( ((containi(said, "ejaculate") != -1) && !(containi(said, "/ejaculate") != -1))
  220. || ((containi(said, "ejaculer") != -1) && !(containi(said, "/ejaculer") != -1)) )
  221. {
  222. client_print(id, print_chat, "[AMX] To ejaculate, Type /ejaculate")
  223. }
  224.  
  225. return PLUGIN_CONTINUE
  226. }
  227.  
  228. public plugin_precache()
  229. {
  230. if (file_exists("sound/ejaculate/ejaculate.wav"))
  231. precache_sound("ejaculate/ejaculate.wav")
  232.  
  233. return PLUGIN_CONTINUE
  234. }
  235.  
  236. public client_connect(id)
  237. {
  238. EjaculateFlag[id]=false
  239. count_ejaculate[id]=1
  240.  
  241. return PLUGIN_CONTINUE
  242. }
  243.  
  244. public client_disconnect(id)
  245. {
  246. reset_hud(id)
  247.  
  248. return PLUGIN_CONTINUE
  249. }
  250.  
  251. public plugin_init()
  252. {
  253. register_plugin("AMX Ejaculate","0.1","KRoTaL")
  254. register_clcmd("ejaculate","ejaculate_on_player",0,"- Ejaculate on a dead player")
  255. register_clcmd("ejaculer","ejaculate_on_player",0,"- Ejaculate on a dead player")
  256. register_clcmd("say /ejaculate","ejaculate_help",0,"- Displays Ejaculate help")
  257. register_clcmd("say /ejaculer","ejaculate_help",0,"- Displays Ejaculate help")
  258. register_clcmd("say","handle_say")
  259. register_cvar("amx_maxejaculations","6")
  260. register_cvar("amx_ejaculate_admin","0")
  261. register_event("DeathMsg","death_event","a")
  262. register_event("ResetHUD", "reset_hud", "be")
  263.  
  264. return PLUGIN_CONTINUE
  265. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement