HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <fakemeta>
  3.  
  4. #define MAX_PLAYERS 32
  5.  
  6. new const DOOKIE_CLASSNAME[] = "amx_dookie"
  7. new const DOOKIE_MODEL1[] = "models/dookie2.mdl"
  8. new const DOOKIE_MODEL2[] = "models/dookie3.mdl"
  9. new const DOOKIE_SOUND1[] = "dookie/dookie1.wav"
  10. new const DOOKIE_SOUND2[] = "dookie/dookie3.wav"
  11. new const STEAM_SPRITE[] = "sprites/xsmoke3.spr"
  12. new const SMOKE_SPRITE[] = "sprites/steam1.spr"
  13.  
  14. new Float:pl_origins[MAX_PLAYERS+1][3]
  15. new pl_dookied[MAX_PLAYERS+1]
  16. new hs_counter[MAX_PLAYERS+1]
  17. new steamsprite
  18. new smoke
  19.  
  20. new gmsgShake
  21. new bool:g_RestartAttempt[MAX_PLAYERS+1]
  22. new amx_dookie, amx_superdookie
  23.  
  24. public plugin_precache(){
  25. engfunc(EngFunc_PrecacheSound, DOOKIE_SOUND1)
  26. engfunc(EngFunc_PrecacheSound, DOOKIE_SOUND2)
  27. engfunc(EngFunc_PrecacheModel, DOOKIE_MODEL1)
  28. engfunc(EngFunc_PrecacheModel, DOOKIE_MODEL2)
  29. steamsprite = engfunc(EngFunc_PrecacheModel, STEAM_SPRITE)
  30. smoke = engfunc(EngFunc_PrecacheModel, SMOKE_SPRITE)
  31. }
  32.  
  33. public plugin_init()
  34. {
  35. register_plugin("Urites", "2.3", "PaintLancer")
  36. register_dictionary("dookie.txt") // itt tudsz megadni egy elérési utat hogy mi jojon fel /szaras , /help parancsra
  37.  
  38. register_clcmd("takeadookie", "take_a_dookie")
  39. register_clcmd("defequer", "take_a_dookie")
  40.  
  41. register_clcmd("say /szaras", "do_help", 0, "Sugo")
  42. register_clcmd("say /help", "do_help", 0, "Sugo")
  43. register_clcmd("say", "HandleSay")
  44. register_clcmd("clcmd_fullupdate", "fullupdateCmd")
  45.  
  46. register_forward(FM_Think, "fwdThink")
  47.  
  48. register_event("TextMsg", "eRestartAttempt", "a", "2=#Game_will_restart_in")
  49. register_event("ResetHUD", "eResetHUD", "be")
  50. register_event("DeathMsg","eDeathMsg", "a")
  51.  
  52. gmsgShake = get_user_msgid("ScreenShake")
  53.  
  54. amx_dookie = register_cvar("amx_dookie", "2")
  55. amx_superdookie = register_cvar("amx_superdookie", "2")
  56. }
  57.  
  58. public fullupdateCmd() {
  59. return PLUGIN_HANDLED_MAIN
  60. }
  61.  
  62. public eRestartAttempt() {
  63. new players[32], num
  64. get_players(players, num, "a")
  65. for (new i; i < num; ++i)
  66. g_RestartAttempt[players[i]] = true
  67. }
  68.  
  69. public eResetHUD(id) {
  70. if (g_RestartAttempt[id]) {
  71. g_RestartAttempt[id] = false
  72. return
  73. }
  74. KillDookie(id)
  75. }
  76.  
  77. public take_a_dookie(id) {
  78. new dookie = get_pcvar_num(amx_dookie)
  79. if(!dookie)
  80. return PLUGIN_HANDLED
  81. if (!is_user_alive(id))
  82. return PLUGIN_HANDLED
  83.  
  84. if (pl_dookied[id] > dookie) {
  85. client_print(id, print_chat, "%L", id, "DOOKIE_ONLY", dookie)
  86. return PLUGIN_HANDLED
  87. }
  88.  
  89. new Float:cur_origin[3], players[MAX_PLAYERS], player, pl_num, Float:dist, Float:last_dist=99999.0, last_id
  90.  
  91. pev(id, pev_origin, cur_origin)
  92. get_players(players, pl_num, "b")
  93.  
  94. if(!pl_num) {
  95. client_print(id, print_chat, "%L", id, "DOOKIE_NODEADS")
  96. return PLUGIN_HANDLED
  97. }
  98.  
  99. for (new i=0;i<pl_num;i++) {
  100. player = players[i]
  101. if (player!=id) {
  102. dist = get_distance_f(cur_origin,pl_origins[player])
  103. if (dist<last_dist) {
  104. last_id = player
  105. last_dist = dist
  106. }
  107. }
  108. }
  109. if(last_dist<80.0) {
  110. new superdookie = get_pcvar_num(amx_superdookie)
  111. if(hs_counter[id] >= superdookie)
  112. {
  113. hs_counter[id] -= superdookie
  114. ++pl_dookied[id]
  115.  
  116. new Float:origin[3]
  117. pev(id, pev_origin, origin)
  118.  
  119. engfunc(EngFunc_EmitSound, id, CHAN_VOICE, DOOKIE_SOUND2, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  120.  
  121. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  122. write_byte(TE_SMOKE)
  123. engfunc(EngFunc_WriteCoord, origin[0])
  124. engfunc(EngFunc_WriteCoord, origin[1])
  125. engfunc(EngFunc_WriteCoord, origin[2])
  126. write_short(smoke)
  127. write_byte(60)
  128. write_byte(5)
  129. message_end()
  130.  
  131. new dookier[32], dookied[32]
  132. get_user_name(last_id, dookied, 31)
  133. get_user_name(id, dookier, 31)
  134. CreateSuperDookie(id)
  135. client_print(0,print_chat,"%L", LANG_PLAYER, "DOOKIE_SUPER", dookier, dookied)
  136. return PLUGIN_HANDLED
  137. }
  138. else
  139. {
  140. ++pl_dookied[id]
  141. new Float:origin[3]
  142. pev(id, pev_origin, origin)
  143.  
  144. engfunc(EngFunc_EmitSound, id, CHAN_VOICE, DOOKIE_SOUND1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  145.  
  146. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  147. write_byte(TE_SMOKE)
  148. engfunc(EngFunc_WriteCoord, origin[0])
  149. engfunc(EngFunc_WriteCoord, origin[1])
  150. engfunc(EngFunc_WriteCoord, origin[2])
  151. write_short(smoke)
  152. write_byte(60)
  153. write_byte(5)
  154. message_end()
  155.  
  156. new dookier[32], dookied[32]
  157. get_user_name(last_id, dookied, charsmax(dookied))
  158. get_user_name(id, dookier, charsmax(dookier))
  159. CreateDookie(id)
  160. client_print(0, print_chat, "%L", LANG_PLAYER, "DOOKIE_NORM", dookier, dookied)
  161. return PLUGIN_HANDLED
  162. }
  163. }
  164. else
  165. {
  166. client_print(id, print_chat, "%L", id, "DOOKIE_NODEADS_AROUND")
  167. return PLUGIN_HANDLED
  168. }
  169.  
  170. return PLUGIN_HANDLED
  171. }
  172.  
  173. public eDeathMsg() {
  174. new victim = read_data(2)
  175. pev(victim, pev_origin, pl_origins[victim])
  176. if(read_data(3))
  177. hs_counter[read_data(1)]++
  178. }
  179.  
  180. public CreateDookie(id){
  181.  
  182. new Float:origin[3]
  183. pev(id, pev_origin, origin)
  184.  
  185. new ent
  186. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  187.  
  188. if(!ent)
  189. return
  190.  
  191. set_pev(ent, pev_classname, DOOKIE_CLASSNAME)
  192.  
  193. engfunc(EngFunc_SetModel, ent, DOOKIE_MODEL1)
  194.  
  195. new Float:MinBox[3]
  196. new Float:MaxBox[3]
  197. for(new a; a<3; a++) {
  198. MinBox[a] = -1.0
  199. MaxBox[a] = 1.0
  200. }
  201. engfunc(EngFunc_SetSize, ent, MinBox, MaxBox)
  202. engfunc(EngFunc_SetOrigin, ent, origin)
  203.  
  204. set_pev(ent, pev_solid, SOLID_SLIDEBOX)
  205. set_pev(ent, pev_movetype, MOVETYPE_TOSS)
  206. set_pev(ent, pev_owner, id)
  207.  
  208. new Float:global_Time
  209. global_get(glb_time, global_Time)
  210. set_pev(ent, pev_nextthink, global_Time + 1.0)
  211. }
  212.  
  213. public CreateSuperDookie(id){
  214.  
  215. new Float:origin[3]
  216. pev(id, pev_origin, origin)
  217.  
  218. new ent
  219. ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  220.  
  221. if(!ent)
  222. return
  223.  
  224. set_pev(ent, pev_classname, DOOKIE_CLASSNAME)
  225.  
  226. engfunc(EngFunc_SetModel, ent, DOOKIE_MODEL2)
  227.  
  228. new Float:MinBox[3]
  229. new Float:MaxBox[3]
  230.  
  231. for(new a; a<3; a++) {
  232. MinBox[a] = -1.0
  233. MaxBox[a] = 1.0
  234. }
  235.  
  236. engfunc(EngFunc_SetSize, ent, MinBox, MaxBox)
  237. engfunc(EngFunc_SetOrigin, ent, origin)
  238.  
  239. set_pev(ent, pev_solid, SOLID_SLIDEBOX)
  240. set_pev(ent, pev_movetype, MOVETYPE_TOSS)
  241. set_pev(ent, pev_owner, id)
  242.  
  243. //shake
  244. new all[MAX_PLAYERS], all_num
  245. get_players(all, all_num, "a")
  246.  
  247. for (new i=0;i<all_num;i++)
  248. {
  249. message_begin(MSG_ONE, gmsgShake, _, all[i])
  250. write_short(1<<15) // shake amount
  251. write_short(1<<11) // shake lasts this long
  252. write_short(1<<15) // shake noise frequency
  253. message_end()
  254. }
  255.  
  256. //poo matter
  257. for (new j = 0; j < 10; j++)
  258. {
  259. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  260. write_byte(TE_BLOODSTREAM)
  261. engfunc(EngFunc_WriteCoord, origin[0])
  262. engfunc(EngFunc_WriteCoord, origin[1])
  263. engfunc(EngFunc_WriteCoord, origin[2] - 20.0)
  264. write_coord(random_num(-100,100)) // x
  265. write_coord(random_num(-100,100)) // y
  266. write_coord(random_num(20,300)) // z
  267. write_byte(100) // color
  268. write_byte(random_num(100,200)) // speed
  269. message_end()
  270. }
  271.  
  272. new Float:global_Time
  273. global_get(glb_time, global_Time)
  274. set_pev(ent, pev_nextthink, global_Time + 1.0)
  275.  
  276. }
  277.  
  278. public fwdThink(ent) {
  279. if(!pev_valid(ent))
  280. return FMRES_IGNORED
  281.  
  282. static classname[33]
  283. pev(ent, pev_classname, classname, charsmax(classname))
  284.  
  285. if(!equal(classname, DOOKIE_CLASSNAME))
  286. return FMRES_IGNORED
  287.  
  288. DookieSteam(ent)
  289. new Float:global_Time
  290. global_get(glb_time, global_Time)
  291. set_pev(ent, pev_nextthink, global_Time + 1.0)
  292. return FMRES_HANDLED
  293. }
  294.  
  295. public KillDookie(id){
  296. new iCurrent = -1
  297.  
  298. while((iCurrent = engfunc(EngFunc_FindEntityByString, iCurrent, "classname", DOOKIE_CLASSNAME)) > 0) {
  299. if(pev(iCurrent, pev_owner) == id)
  300. engfunc(EngFunc_RemoveEntity, iCurrent)
  301. }
  302.  
  303. pl_dookied[id] = 1
  304. }
  305.  
  306. public DookieSteam(ent)
  307. {
  308. new Float:origin[3]
  309. pev(ent, pev_origin, origin)
  310.  
  311. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  312. write_byte(TE_SPRITE)
  313. engfunc(EngFunc_WriteCoord, origin[0])
  314. engfunc(EngFunc_WriteCoord, origin[1])
  315. engfunc(EngFunc_WriteCoord, origin[2] + 10.0)
  316. write_short(steamsprite)
  317. write_byte(8)
  318. write_byte(10)
  319. message_end()
  320. }
  321.  
  322. public do_help(id){
  323.  
  324. new len = 1300
  325. new buffer[1301]
  326. new title[20]
  327. new n = 0
  328.  
  329. n += formatex( buffer[n],len-n, "<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><body><pre>")
  330.  
  331. n += formatex( buffer[n],len-n, "%L", id, "DOOKIE_MOTD1")
  332.  
  333. n += formatex( buffer[n],len-n, "%L", id, "DOOKIE_MOTD2")
  334. n += formatex( buffer[n],len-n, "%L", id, "DOOKIE_MOTD3")
  335.  
  336. n += formatex( buffer[n],len-n, "ex:^n^n")
  337. n += formatex( buffer[n],len-n, "%L", id, "DOOKIE_MOTD4")
  338.  
  339. n += formatex( buffer[n],len-n, "%L", id, "DOOKIE_MOTD5")
  340. n += formatex( buffer[n],len-n, "%L", id, "DOOKIE_MOTD6", get_pcvar_num(amx_superdookie))
  341. n += formatex( buffer[n],len-n, "%L", id, "DOOKIE_MOTD7")
  342.  
  343. n += formatex( buffer[n],len-n, "</pre></body></html>")
  344.  
  345. formatex(title, charsmax(title), "%L", id, "DOOKIE_MOTD_TITLE")
  346. show_motd(id, buffer, title)
  347. return PLUGIN_CONTINUE
  348. }
  349.  
  350. public HandleSay(id) {
  351. new Speech[192]
  352. read_args(Speech,192)
  353. remove_quotes(Speech)
  354.  
  355. if( (containi(Speech, "dookie") != -1) || (containi(Speech, "takeadookie") != -1) || (containi(Speech, "defequer") != -1) ) {
  356. client_print(id,print_chat, "%L", id, "DOOKIE_HELP")
  357. }
  358.  
  359. return PLUGIN_CONTINUE
  360. }
  361. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  362. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  363. */
  364.