hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 14:53



Jelenlévő felhasználók

Jelenleg 228 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 227 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Google [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Kick jogra átírás.
HozzászólásElküldve: 2014.02.13. 00:41 
Offline
Senior Tag
Avatar

Csatlakozott: 2014.01.20. 13:00
Hozzászólások: 216
Megköszönt másnak: 89 alkalommal
Megköszönték neki: 14 alkalommal
Sziasztok!
Valaki átírná, hogy ezt KICK jogtól lehessen használni?
SMX Forráskód: [ Mindet kijelol ]
  1. /* =============================================
  2. * - NAME:
  3. * + Shoop da Whoop Slay
  4. *
  5. * - DESCRIPTION:
  6. * +
  7. * + This plugin will spawn 'Shoop da Whoop' to slay a player with his laser.
  8. * + It's exactly like the regular amx_slay but with the added style.
  9. * +
  10. *
  11. * - CREDITS:
  12. * + Max: For making the awesome Shoop da Whoop model and testing.
  13. * + Almightynoob: For helping with demo video and testing.
  14. * + TonyCip/Tyrant/Psy/Muchez: For testing.
  15. *
  16. *
  17. * ---------------
  18. * Admin commands:
  19. * ---------------
  20. * - amx_shoopslay <name or #userid>
  21. * + Lets an admin slay players using Shoop da Whoop.
  22. *
  23. *
  24. * ----------
  25. * Changelog:
  26. * ----------
  27. * Version 1.0 ( 08-18-2009 )
  28. * -- Initial release.
  29. *
  30. * Version 1.1 ( 08-21-2009 )
  31. * -- Now using hamsandwiches think forward instead of fakemetas.
  32. * -- Fixed bug where players with god mode would not be slayed.
  33. *
  34. * Version 1.2 ( 08-21-2009 )
  35. * -- No longer using #define for strings (thanks Exolent).
  36. * -- Removed the player check in Ham_TakeDamage (thanks joaquimandrade).
  37. * -- CanShoopSpawn() now uses loop instead of code repetition (thanks joaquimandrade).
  38. * -- Now using TraceHull instead of a custom trace function (thanks joaquimandrade).
  39. *
  40. * Version 1.3 ( 08-23-2009 )
  41. * -- Fixed the god mode private data offset for Linux servers.
  42. * -- Added back a player check I removed in version 1.2 (thanks koleos).
  43. *
  44. * Version 1.4 ( 08-24-2009 )
  45. * -- Changed MSG_BROADCAST to MSG_PVS for tempents.
  46. * -- Added the ability to slay everyone at once using @all.
  47. *
  48. */
  49.  
  50. #include <amxmodx>
  51. #include <amxmisc>
  52. #include <fakemeta>
  53. #include <hamsandwich>
  54.  
  55. new const PLUGIN[] = "Shoop da Whoop Slay";
  56. new const VERSION[] = "1.4";
  57. new const AUTHOR[] = "hlstriker";
  58.  
  59. new g_iMaxplayers;
  60. #define MAX_PLAYERS 32
  61.  
  62. #define POWERUP_GOD_OFFSET 271
  63. #define POWERUP_GOD_LINUX_DIFF 3
  64.  
  65. new bool:g_bBeingShooped[MAX_PLAYERS+1];
  66. new Float:g_flAngles[MAX_PLAYERS+1][3];
  67. new Float:g_flSpawnOrigin[MAX_PLAYERS+1][3];
  68.  
  69. #define NUM_EXPLOSIONS 7
  70. #define SHOOPS_ID 9281
  71.  
  72. #define DISTANCE_SHOOP 165.0
  73. new Float:g_flShoopMins[3] = {-15.0, -15.0, -15.0}; // No smaller than: Vector(-16, -16, -18)
  74. new Float:g_flShoopMaxs[3] = {15.0, 15.0, 15.0}; // No bigger than: Vector( 16, 16, 18)
  75.  
  76. new const SHOOP_MODEL[] = "models/shoopslay/shoop_b7.mdl";
  77. new const SHOOP_SOUND[] = "shoopslay/shoop_b4.wav";
  78.  
  79. new g_iExplosion;
  80. new g_iBeam;
  81. new const EXPLOSION_SPRITE[] = "sprites/explode1.spr";
  82. new const BEAM_SPRITE[] = "sprites/xbeam3.spr";
  83.  
  84. public plugin_init()
  85. {
  86. register_plugin(PLUGIN, VERSION, AUTHOR);
  87. register_cvar("shoopslay_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY);
  88. register_forward(FM_ClientKill, "fwd_ClientKill");
  89. RegisterHam(Ham_Player_PreThink, "player", "fwd_Player_PreThink");
  90. RegisterHam(Ham_TakeDamage, "player", "fwd_TakeDamage");
  91. RegisterHam(Ham_Think, "info_target", "fwd_Think");
  92.  
  93. register_logevent("hook_RoundStart", 2, "1=Round_Start");
  94. register_event("CurWeapon", "hook_CurWeapon", "be", "1=1");
  95. register_event("ResetHUD", "hook_ResetHUD", "be");
  96. register_clcmd("fullupdate", "hook_BlockCommand");
  97.  
  98. register_concmd("amx_shoopslay", "CmdShoopSlay", ADMIN_SLAY, "<nev vagy #userid vagy @all>");
  99.  
  100. g_iMaxplayers = get_maxplayers();
  101. }
  102.  
  103. public plugin_precache()
  104. {
  105. g_iExplosion = precache_model(EXPLOSION_SPRITE);
  106. g_iBeam = precache_model(BEAM_SPRITE);
  107. precache_model(SHOOP_MODEL);
  108. precache_sound(SHOOP_SOUND);
  109. }
  110.  
  111. public client_disconnect(iClient)
  112. g_bBeingShooped[iClient] = false;
  113.  
  114. public fwd_TakeDamage(iVictim, iInflictor, iAttacker, Float:flDamage, iDmgBits)
  115. {
  116. if(g_bBeingShooped[iVictim])
  117. return HAM_SUPERCEDE;
  118.  
  119. if(1 <= iAttacker <= g_iMaxplayers)
  120. {
  121. if(g_bBeingShooped[iAttacker])
  122. return HAM_SUPERCEDE;
  123. }
  124.  
  125. return HAM_IGNORED;
  126. }
  127.  
  128. public hook_RoundStart()
  129. {
  130. for(new i=1; i<=g_iMaxplayers; i++)
  131. {
  132. if(g_bBeingShooped[i])
  133. set_task(0.1, "task_ResetSpeed", i);
  134. }
  135. }
  136.  
  137. public task_ResetSpeed(iClient)
  138. engfunc(EngFunc_SetClientMaxspeed, iClient, 0.1);
  139.  
  140. public hook_CurWeapon(iClient)
  141. {
  142. if(g_bBeingShooped[iClient])
  143. engfunc(EngFunc_SetClientMaxspeed, iClient, 0.1);
  144. }
  145.  
  146. public fwd_ClientKill(iClient)
  147. {
  148. if(g_bBeingShooped[iClient])
  149. return FMRES_SUPERCEDE;
  150. return FMRES_IGNORED;
  151. }
  152.  
  153. public hook_ResetHUD(iClient)
  154. set_task(0.4, "task_Spawn", iClient);
  155.  
  156. public task_Spawn(iClient)
  157. pev(iClient, pev_origin, g_flSpawnOrigin[iClient]);
  158.  
  159. public hook_BlockCommand()
  160. return PLUGIN_HANDLED;
  161.  
  162. public CmdShoopSlay(iClient, iLevel, iCid)
  163. {
  164. if(!cmd_access(iClient, iLevel, iCid, 2))
  165. return FMRES_IGNORED;
  166.  
  167. new szArg[32];
  168.  
  169. read_argv(1, szArg, sizeof(szArg)-1);
  170.  
  171. if(equali(szArg, "@all"))
  172. {
  173. ShoopSlayAll(iClient);
  174. return FMRES_IGNORED;
  175. }
  176.  
  177. new iVictim = cmd_target(iClient, szArg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE);
  178.  
  179. if(!iVictim)
  180. return FMRES_IGNORED;
  181.  
  182. if(g_bBeingShooped[iVictim])
  183. {
  184. console_print(iClient, "[HIBA] Mar folyamatban van a celpont likvidalasa.");
  185. return FMRES_IGNORED;
  186. }
  187.  
  188. ShoopSlay(iVictim);
  189.  
  190. new szAuthID[32], szName2[32], szAuthID2[32], szName[32];
  191. get_user_authid(iClient, szAuthID, sizeof(szAuthID)-1);
  192. get_user_name(iClient, szName, sizeof(szName)-1);
  193. get_user_authid(iVictim, szAuthID2, sizeof(szAuthID2)-1);
  194. get_user_name(iVictim, szName2, sizeof(szName2)-1);
  195.  
  196. log_amx("Cmd: ^"%s<%d><%s><>^" megutotte ^"%s<%d><%s><>^"", szName, get_user_userid(iClient), szAuthID, szName2, get_user_userid(iVictim), szAuthID2);
  197.  
  198. show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", szName, szName2);
  199.  
  200. console_print(iClient, "[AMXX] %L", iClient, "CLIENT_SLAYED", szName2);
  201.  
  202. return FMRES_IGNORED;
  203. }
  204.  
  205. ShoopSlayAll(iClient)
  206. {
  207. new bool:bSlayed;
  208. for(new i=1; i<=g_iMaxplayers; i++)
  209. {
  210. if(g_bBeingShooped[i] || i == iClient || !is_user_alive(i) || access(i, ADMIN_IMMUNITY))
  211. continue;
  212.  
  213. ShoopSlay(i);
  214. bSlayed = true;
  215. }
  216.  
  217. if(bSlayed)
  218. {
  219. new szAuthID[32], szName[32];
  220. get_user_authid(iClient, szAuthID, sizeof(szAuthID)-1);
  221. get_user_name(iClient, szName, sizeof(szName)-1);
  222.  
  223. log_amx("Cmd: ^"%s<%d><%s><>^" megutotte ^"%s<><><>^"", szName, get_user_userid(iClient), szAuthID, "@all");
  224.  
  225. show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", szName, "@all");
  226.  
  227. console_print(iClient, "[AMXX] %L", iClient, "CLIENT_SLAYED", "@all");
  228. }
  229. else
  230. console_print(iClient, "[HIBA] Ervenytelen jatekos.");
  231. }
  232.  
  233. ShoopSlay(iVictim)
  234. {
  235. // Freeze victim
  236. set_pev(iVictim, pev_movetype, MOVETYPE_NOCLIP);
  237. set_pev(iVictim, pev_solid, SOLID_NOT);
  238. set_pev(iVictim, pev_velocity, Float:{0.0,0.0,0.0});
  239. engfunc(EngFunc_SetClientMaxspeed, iVictim, 0.1);
  240.  
  241. static Float:flVictimOrigin[3];
  242. pev(iVictim, pev_origin, flVictimOrigin);
  243.  
  244. static Float:flShoopOrigin[3], bool:bShouldSpawn, bool:bMoveToSpawn;
  245. bShouldSpawn = false;
  246. bMoveToSpawn = false;
  247.  
  248. if(CanShoopSpawn(iVictim, flVictimOrigin, flShoopOrigin))
  249. bShouldSpawn = true;
  250. else
  251. {
  252. // See if Shoop can spawn near where the victim spawned, if so move victim
  253. if(CanShoopSpawn(iVictim, g_flSpawnOrigin[iVictim], flShoopOrigin))
  254. {
  255. bMoveToSpawn = true;
  256. bShouldSpawn = true;
  257. }
  258. }
  259.  
  260. static iShoop, Float:flAngles[3];
  261. if(bShouldSpawn)
  262. {
  263. // Spawn Shoop
  264. iShoop = SpawnShoop(iVictim, flShoopOrigin);
  265. }
  266.  
  267. if(iShoop)
  268. {
  269. if(bMoveToSpawn)
  270. {
  271. VectorCopy_Float(g_flSpawnOrigin[iVictim], flVictimOrigin);
  272. engfunc(EngFunc_SetOrigin, iVictim, flVictimOrigin);
  273. }
  274.  
  275. // Set shoops angles
  276. get_angles_to_origin(flShoopOrigin, flVictimOrigin, flAngles);
  277. if(flAngles[0] != 0.0)
  278. flAngles[1] += 180.0;
  279. set_pev(iShoop, pev_angles, flAngles);
  280.  
  281. // Make victim look at Shoop
  282. g_bBeingShooped[iVictim] = true;
  283.  
  284. get_angles_to_origin(flVictimOrigin, flShoopOrigin, flAngles);
  285.  
  286. if(flAngles[0] > 250)
  287. flAngles[0] = 89.0;
  288. else if(flAngles[0] > 70)
  289. flAngles[0] = -89.0;
  290.  
  291. VectorCopy_Float(flAngles, g_flAngles[iVictim]);
  292. set_pev(iVictim, pev_angles, flAngles);
  293. set_pev(iVictim, pev_fixangle, 1);
  294.  
  295. set_pev(iShoop, pev_nextthink, get_gametime() + 0.1);
  296. }
  297. else
  298. {
  299. // Slay player without using Shoop
  300. set_pdata_float(iVictim, POWERUP_GOD_OFFSET, 0.0, POWERUP_GOD_LINUX_DIFF); // Remove god in TFC when set with a power up
  301. set_pev(iVictim, pev_takedamage, DAMAGE_AIM);
  302. ExecuteHam(Ham_TakeDamage, iVictim, 0, 0, 9999.0, 0);
  303. }
  304. }
  305.  
  306. public fwd_Player_PreThink(iClient)
  307. {
  308. if(g_bBeingShooped[iClient])
  309. {
  310. set_pev(iClient, pev_angles, g_flAngles[iClient]);
  311. set_pev(iClient, pev_fixangle, 1);
  312. }
  313. }
  314.  
  315. public fwd_Think(iEnt)
  316. {
  317. if(!pev_valid(iEnt))
  318. return FMRES_IGNORED;
  319.  
  320. if(pev(iEnt, pev_iuser4) == SHOOPS_ID)
  321. {
  322. static iVictim;
  323. iVictim = pev(iEnt, pev_owner);
  324.  
  325. static Float:flShoopOrigin[3];
  326. pev(iEnt, pev_origin, flShoopOrigin);
  327.  
  328. if(!g_bBeingShooped[iVictim])
  329. {
  330. // Victim is invalid now, Remove Shoop
  331. ShoopTeleportEffect(flShoopOrigin);
  332. set_pev(iEnt, pev_flags, FL_KILLME);
  333. return FMRES_HANDLED;
  334. }
  335.  
  336. static iThinkNum;
  337. iThinkNum = pev(iEnt, pev_iuser3);
  338.  
  339. if(!iThinkNum)
  340. {
  341. // Shoops sound
  342. engfunc(EngFunc_EmitSound, iEnt, CHAN_BODY, SHOOP_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  343. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  344. set_pev(iEnt, pev_nextthink, get_gametime() + 2.6);
  345. return FMRES_HANDLED;
  346. }
  347.  
  348. if(iThinkNum == NUM_EXPLOSIONS)
  349. {
  350. // Remove Shoop on next think and slay player
  351. set_pdata_float(iVictim, POWERUP_GOD_OFFSET, 0.0, POWERUP_GOD_LINUX_DIFF); // Remove god in TFC when set with a power up
  352. set_pev(iVictim, pev_takedamage, DAMAGE_AIM);
  353. ExecuteHam(Ham_TakeDamage, iVictim, iEnt, iEnt, 9999.0, 0);
  354.  
  355. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  356. set_pev(iEnt, pev_nextthink, get_gametime() + 0.5);
  357. return FMRES_HANDLED;
  358. }
  359. else if(iThinkNum > NUM_EXPLOSIONS)
  360. {
  361. // Remove Shoop
  362. ShoopTeleportEffect(flShoopOrigin);
  363. set_pev(iEnt, pev_flags, FL_KILLME);
  364. g_bBeingShooped[iVictim] = false;
  365. return FMRES_HANDLED;
  366. }
  367.  
  368. static Float:flVictimOrigin[3];
  369. pev(iVictim, pev_origin, flVictimOrigin);
  370.  
  371. if(iThinkNum == 1)
  372. {
  373. // Shoot Beam
  374. set_pev(iEnt, pev_sequence, 0);
  375. ShoopsBeam(flVictimOrigin, flShoopOrigin);
  376. }
  377.  
  378. // Explosion
  379. ShowExplosion(g_iExplosion, 10, 12, flVictimOrigin);
  380.  
  381. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  382. set_pev(iEnt, pev_nextthink, get_gametime() + 0.1);
  383. }
  384.  
  385. return FMRES_HANDLED;
  386. }
  387.  
  388. ShoopTeleportEffect(const Float:flOrigin[3])
  389. {
  390. static iOrigin[3];
  391. iOrigin[0] = floatround(flOrigin[0]);
  392. iOrigin[1] = floatround(flOrigin[1]);
  393. iOrigin[2] = floatround(flOrigin[2]);
  394.  
  395. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
  396. write_byte(TE_TELEPORT);
  397. write_coord(iOrigin[0]);
  398. write_coord(iOrigin[1]);
  399. write_coord(iOrigin[2]);
  400. message_end();
  401. }
  402.  
  403. SpawnShoop(iVictim, const Float:flShoopOrigin[3])
  404. {
  405. // Spawn Shoop
  406. new iShoop = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
  407. dllfunc(DLLFunc_Spawn, iShoop);
  408.  
  409. set_pev(iShoop, pev_movetype, MOVETYPE_FLY);
  410. set_pev(iShoop, pev_solid, SOLID_NOT);
  411.  
  412. engfunc(EngFunc_SetModel, iShoop, SHOOP_MODEL);
  413. engfunc(EngFunc_SetSize, iShoop, g_flShoopMins, g_flShoopMaxs);
  414. engfunc(EngFunc_SetOrigin, iShoop, flShoopOrigin);
  415.  
  416. set_pev(iShoop, pev_classname, "Shoop Da Whoop");
  417.  
  418. set_pev(iShoop, pev_sequence, 3);
  419. set_pev(iShoop, pev_framerate, 1.0);
  420.  
  421. set_pev(iShoop, pev_iuser4, SHOOPS_ID);
  422. set_pev(iShoop, pev_owner, iVictim);
  423.  
  424. ShoopTeleportEffect(flShoopOrigin);
  425.  
  426. return iShoop;
  427. }
  428.  
  429. CanShoopSpawn(iVictim, const Float:flVictimOrigin[3], Float:flShoopOrigin[3])
  430. {
  431. static iAxisSequence[] = {2,0,1,0,1,2};
  432. static iAxisSign[sizeof(iAxisSequence)] = {1,1,1,-1,-1,-1};
  433. static bool:bAxisMins[sizeof(iAxisSequence)] = {false,false,false,true,true,true};
  434. new iAxis;
  435.  
  436. for(new i=0; i<sizeof(iAxisSequence); i++)
  437. {
  438. iAxis = iAxisSequence[i]
  439.  
  440. VectorCopy_Float(flVictimOrigin, flShoopOrigin);
  441. flShoopOrigin[iAxis] += (DISTANCE_SHOOP + g_flShoopMaxs[iAxis] + 1) * iAxisSign[i]
  442. if(IsShoopsHullVacant(iVictim, flVictimOrigin, flShoopOrigin, iAxis, bAxisMins[i]))
  443. return true;
  444. }
  445.  
  446. return false;
  447. }
  448.  
  449. ShoopsBeam(const Float:flStartOrigin[3], const Float:flEndOrigin[3])
  450. {
  451. static iStartOrigin[3];
  452. iStartOrigin[0] = floatround(flStartOrigin[0]);
  453. iStartOrigin[1] = floatround(flStartOrigin[1]);
  454. iStartOrigin[2] = floatround(flStartOrigin[2]);
  455.  
  456. message_begin(MSG_PVS, SVC_TEMPENTITY, iStartOrigin);
  457. write_byte(TE_BEAMPOINTS);
  458. write_coord(iStartOrigin[0]);
  459. write_coord(iStartOrigin[1]);
  460. write_coord(iStartOrigin[2]);
  461. write_coord(floatround(flEndOrigin[0]));
  462. write_coord(floatround(flEndOrigin[1]));
  463. write_coord(floatround(flEndOrigin[2]));
  464. write_short(g_iBeam);
  465. write_byte(1); // starting frame
  466. write_byte(1); // frame rate in 0.1's
  467. write_byte(NUM_EXPLOSIONS); // life in 0.1's
  468. write_byte(210); // line width in 0.1's
  469. write_byte(1); // noise amplitude in 0.01's
  470. write_byte(12); // r
  471. write_byte(109); // g
  472. write_byte(190); // b
  473. write_byte(255); // brightness
  474. write_byte(50); // scroll speed
  475. message_end();
  476. }
  477.  
  478. IsShoopsHullVacant(iVictim, const Float:flVictimOrigin[3], Float:flShoopOrigin[3], iAxis, bool:bIsMins)
  479. {
  480. TraceLine_GetEndOrigin(flVictimOrigin, iVictim, flShoopOrigin);
  481.  
  482. new Float:flDistance;
  483. if(bIsMins)
  484. flShoopOrigin[iAxis] -= g_flShoopMins[iAxis];
  485. else
  486. flShoopOrigin[iAxis] -= g_flShoopMaxs[iAxis];
  487. flDistance = get_distance_f(flVictimOrigin, flShoopOrigin);
  488.  
  489. if(flDistance < DISTANCE_SHOOP)
  490. return false;
  491.  
  492. //if(!IsBBoxHullVacant(flShoopOrigin, g_flShoopMins, g_flShoopMaxs, iVictim))
  493. // return false;
  494.  
  495. engfunc(EngFunc_TraceHull, flShoopOrigin, flShoopOrigin, 0, HULL_HEAD, iVictim, 0);
  496. if(!get_tr2(0, TR_InOpen))
  497. return false;
  498.  
  499. return true;
  500. }
  501.  
  502. stock get_angles_to_origin(const Float:flFromOrigin[3], const Float:flToOrigin[3], Float:flAngles[3])
  503. {
  504. flAngles[0] = flToOrigin[0] - flFromOrigin[0];
  505. flAngles[1] = flToOrigin[1] - flFromOrigin[1];
  506. flAngles[2] = flToOrigin[2] - flFromOrigin[2];
  507. engfunc(EngFunc_VecToAngles, flAngles, flAngles);
  508. }
  509.  
  510. stock IsBBoxHullVacant(const Float:flOrigin[3], const Float:flMins[3], const Float:flMaxs[3], iSkip)
  511. {
  512. new Float:flVerticesOrigins[8][3], i;
  513.  
  514. for(i=0; i<sizeof(flVerticesOrigins); i++)
  515. {
  516. flVerticesOrigins[i][0] = flOrigin[0];
  517. flVerticesOrigins[i][1] = flOrigin[1];
  518. flVerticesOrigins[i][2] = flOrigin[2];
  519. }
  520.  
  521. // Get the bottom vertices
  522. flVerticesOrigins[0][0] += flMins[0];
  523. flVerticesOrigins[0][1] += flMaxs[1];
  524. flVerticesOrigins[0][2] += flMins[2];
  525.  
  526. flVerticesOrigins[1][0] += flMaxs[0];
  527. flVerticesOrigins[1][1] += flMaxs[1];
  528. flVerticesOrigins[1][2] += flMins[2];
  529.  
  530. flVerticesOrigins[2][0] += flMaxs[0];
  531. flVerticesOrigins[2][1] += flMins[1];
  532. flVerticesOrigins[2][2] += flMins[2];
  533.  
  534. flVerticesOrigins[3][0] += flMins[0];
  535. flVerticesOrigins[3][1] += flMins[1];
  536. flVerticesOrigins[3][2] += flMins[2];
  537.  
  538. // Get the top vertices
  539. flVerticesOrigins[4][0] += flMins[0];
  540. flVerticesOrigins[4][1] += flMaxs[1];
  541. flVerticesOrigins[4][2] += flMaxs[2];
  542.  
  543. flVerticesOrigins[5][0] += flMaxs[0];
  544. flVerticesOrigins[5][1] += flMaxs[1];
  545. flVerticesOrigins[5][2] += flMaxs[2];
  546.  
  547. flVerticesOrigins[6][0] += flMaxs[0];
  548. flVerticesOrigins[6][1] += flMins[1];
  549. flVerticesOrigins[6][2] += flMaxs[2];
  550.  
  551. flVerticesOrigins[7][0] += flMins[0];
  552. flVerticesOrigins[7][1] += flMins[1];
  553. flVerticesOrigins[7][2] += flMaxs[2];
  554.  
  555. new Float:flFractionTotal, Float:flFraction;
  556. // Trace lines to make edges on the bottom face
  557. for(i=0; i<=3; i++)
  558. {
  559. if(i == 3)
  560. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[0], 0, iSkip, 0);
  561. else
  562. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+1], 0, iSkip, 0);
  563.  
  564. get_tr2(0, TR_flFraction, flFraction);
  565. flFractionTotal += flFraction;
  566. }
  567.  
  568. // Trace lines to make edges on the top face
  569. for(i=4; i<=7; i++)
  570. {
  571. if(i == 7)
  572. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[4], 0, iSkip, 0);
  573. else
  574. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+1], 0, iSkip, 0);
  575.  
  576. get_tr2(0, TR_flFraction, flFraction);
  577. flFractionTotal += flFraction;
  578. }
  579.  
  580. // Trace 4 lines to make the edges going from bottom vertices to top
  581. for(i=0; i<=3; i++)
  582. {
  583. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+4], 0, iSkip, 0);
  584. get_tr2(0, TR_flFraction, flFraction);
  585. flFractionTotal += flFraction;
  586. }
  587.  
  588. if(flFractionTotal < 12)
  589. return false;
  590.  
  591. return true;
  592. }
  593.  
  594. stock VectorCopy_Float(const Float:flVecOriginal[3], Float:flVecCopy[3])
  595. {
  596. flVecCopy[0] = flVecOriginal[0];
  597. flVecCopy[1] = flVecOriginal[1];
  598. flVecCopy[2] = flVecOriginal[2];
  599. }
  600.  
  601. stock TraceLine_GetEndOrigin(const Float:flStartOrigin[3], iSkip, Float:flEndOrigin[3])
  602. {
  603. engfunc(EngFunc_TraceLine, flStartOrigin, flEndOrigin, 0, iSkip, 0);
  604. get_tr2(0, TR_vecEndPos, flEndOrigin);
  605. }
  606.  
  607. stock ShowExplosion(iSprite, iScale, iFrameRate, const Float:flOrigin[3])
  608. {
  609. static iOrigin[3];
  610. iOrigin[0] = floatround(flOrigin[0]);
  611. iOrigin[1] = floatround(flOrigin[1]);
  612. iOrigin[2] = floatround(flOrigin[2]);
  613.  
  614. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
  615. write_byte(TE_EXPLOSION);
  616. write_coord(iOrigin[0]);
  617. write_coord(iOrigin[1]);
  618. write_coord(iOrigin[2]);
  619. write_short(iSprite);
  620. write_byte(iScale);
  621. write_byte(iFrameRate);
  622. write_byte(0);
  623. message_end();
  624. }

_________________
Kép
Kép
https://soundcloud.com/l-c-a-w


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Kick jogra átírás.
HozzászólásElküldve: 2014.02.13. 06:44 
Offline
Tiszteletbeli

Csatlakozott: 2010.02.04. 19:12
Hozzászólások: 3528
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 180 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. /* =============================================
  2. * - NAME:
  3. * + Shoop da Whoop Slay
  4. *
  5. * - DESCRIPTION:
  6. * +
  7. * + This plugin will spawn 'Shoop da Whoop' to slay a player with his laser.
  8. * + It's exactly like the regular amx_slay but with the added style.
  9. * +
  10. *
  11. * - CREDITS:
  12. * + Max: For making the awesome Shoop da Whoop model and testing.
  13. * + Almightynoob: For helping with demo video and testing.
  14. * + TonyCip/Tyrant/Psy/Muchez: For testing.
  15. *
  16. *
  17. * ---------------
  18. * Admin commands:
  19. * ---------------
  20. * - amx_shoopslay <name or #userid>
  21. * + Lets an admin slay players using Shoop da Whoop.
  22. *
  23. *
  24. * ----------
  25. * Changelog:
  26. * ----------
  27. * Version 1.0 ( 08-18-2009 )
  28. * -- Initial release.
  29. *
  30. * Version 1.1 ( 08-21-2009 )
  31. * -- Now using hamsandwiches think forward instead of fakemetas.
  32. * -- Fixed bug where players with god mode would not be slayed.
  33. *
  34. * Version 1.2 ( 08-21-2009 )
  35. * -- No longer using #define for strings (thanks Exolent).
  36. * -- Removed the player check in Ham_TakeDamage (thanks joaquimandrade).
  37. * -- CanShoopSpawn() now uses loop instead of code repetition (thanks joaquimandrade).
  38. * -- Now using TraceHull instead of a custom trace function (thanks joaquimandrade).
  39. *
  40. * Version 1.3 ( 08-23-2009 )
  41. * -- Fixed the god mode private data offset for Linux servers.
  42. * -- Added back a player check I removed in version 1.2 (thanks koleos).
  43. *
  44. * Version 1.4 ( 08-24-2009 )
  45. * -- Changed MSG_BROADCAST to MSG_PVS for tempents.
  46. * -- Added the ability to slay everyone at once using @all.
  47. *
  48. */
  49.  
  50. #include <amxmodx>
  51. #include <amxmisc>
  52. #include <fakemeta>
  53. #include <hamsandwich>
  54.  
  55. new const PLUGIN[] = "Shoop da Whoop Slay";
  56. new const VERSION[] = "1.4";
  57. new const AUTHOR[] = "hlstriker";
  58.  
  59. new g_iMaxplayers;
  60. #define MAX_PLAYERS 32
  61.  
  62. #define POWERUP_GOD_OFFSET 271
  63. #define POWERUP_GOD_LINUX_DIFF 3
  64.  
  65. new bool:g_bBeingShooped[MAX_PLAYERS+1];
  66. new Float:g_flAngles[MAX_PLAYERS+1][3];
  67. new Float:g_flSpawnOrigin[MAX_PLAYERS+1][3];
  68.  
  69. #define NUM_EXPLOSIONS 7
  70. #define SHOOPS_ID 9281
  71.  
  72. #define DISTANCE_SHOOP 165.0
  73. new Float:g_flShoopMins[3] = {-15.0, -15.0, -15.0}; // No smaller than: Vector(-16, -16, -18)
  74. new Float:g_flShoopMaxs[3] = {15.0, 15.0, 15.0}; // No bigger than: Vector( 16, 16, 18)
  75.  
  76. new const SHOOP_MODEL[] = "models/shoopslay/shoop_b7.mdl";
  77. new const SHOOP_SOUND[] = "shoopslay/shoop_b4.wav";
  78.  
  79. new g_iExplosion;
  80. new g_iBeam;
  81. new const EXPLOSION_SPRITE[] = "sprites/explode1.spr";
  82. new const BEAM_SPRITE[] = "sprites/xbeam3.spr";
  83.  
  84. public plugin_init()
  85. {
  86. register_plugin(PLUGIN, VERSION, AUTHOR);
  87. register_cvar("shoopslay_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY);
  88. register_forward(FM_ClientKill, "fwd_ClientKill");
  89. RegisterHam(Ham_Player_PreThink, "player", "fwd_Player_PreThink");
  90. RegisterHam(Ham_TakeDamage, "player", "fwd_TakeDamage");
  91. RegisterHam(Ham_Think, "info_target", "fwd_Think");
  92.  
  93. register_logevent("hook_RoundStart", 2, "1=Round_Start");
  94. register_event("CurWeapon", "hook_CurWeapon", "be", "1=1");
  95. register_event("ResetHUD", "hook_ResetHUD", "be");
  96. register_clcmd("fullupdate", "hook_BlockCommand");
  97.  
  98. register_concmd("amx_shoopslay", "CmdShoopSlay", ADMIN_KICK, "<nev vagy #userid vagy @all>");
  99.  
  100. g_iMaxplayers = get_maxplayers();
  101. }
  102.  
  103. public plugin_precache()
  104. {
  105. g_iExplosion = precache_model(EXPLOSION_SPRITE);
  106. g_iBeam = precache_model(BEAM_SPRITE);
  107. precache_model(SHOOP_MODEL);
  108. precache_sound(SHOOP_SOUND);
  109. }
  110.  
  111. public client_disconnect(iClient)
  112. g_bBeingShooped[iClient] = false;
  113.  
  114. public fwd_TakeDamage(iVictim, iInflictor, iAttacker, Float:flDamage, iDmgBits)
  115. {
  116. if(g_bBeingShooped[iVictim])
  117. return HAM_SUPERCEDE;
  118.  
  119. if(1 <= iAttacker <= g_iMaxplayers)
  120. {
  121. if(g_bBeingShooped[iAttacker])
  122. return HAM_SUPERCEDE;
  123. }
  124.  
  125. return HAM_IGNORED;
  126. }
  127.  
  128. public hook_RoundStart()
  129. {
  130. for(new i=1; i<=g_iMaxplayers; i++)
  131. {
  132. if(g_bBeingShooped[i])
  133. set_task(0.1, "task_ResetSpeed", i);
  134. }
  135. }
  136.  
  137. public task_ResetSpeed(iClient)
  138. engfunc(EngFunc_SetClientMaxspeed, iClient, 0.1);
  139.  
  140. public hook_CurWeapon(iClient)
  141. {
  142. if(g_bBeingShooped[iClient])
  143. engfunc(EngFunc_SetClientMaxspeed, iClient, 0.1);
  144. }
  145.  
  146. public fwd_ClientKill(iClient)
  147. {
  148. if(g_bBeingShooped[iClient])
  149. return FMRES_SUPERCEDE;
  150. return FMRES_IGNORED;
  151. }
  152.  
  153. public hook_ResetHUD(iClient)
  154. set_task(0.4, "task_Spawn", iClient);
  155.  
  156. public task_Spawn(iClient)
  157. pev(iClient, pev_origin, g_flSpawnOrigin[iClient]);
  158.  
  159. public hook_BlockCommand()
  160. return PLUGIN_HANDLED;
  161.  
  162. public CmdShoopSlay(iClient, iLevel, iCid)
  163. {
  164. if(!cmd_access(iClient, iLevel, iCid, 2))
  165. return FMRES_IGNORED;
  166.  
  167. new szArg[32];
  168.  
  169. read_argv(1, szArg, sizeof(szArg)-1);
  170.  
  171. if(equali(szArg, "@all"))
  172. {
  173. ShoopSlayAll(iClient);
  174. return FMRES_IGNORED;
  175. }
  176.  
  177. new iVictim = cmd_target(iClient, szArg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE);
  178.  
  179. if(!iVictim)
  180. return FMRES_IGNORED;
  181.  
  182. if(g_bBeingShooped[iVictim])
  183. {
  184. console_print(iClient, "[HIBA] Mar folyamatban van a celpont likvidalasa.");
  185. return FMRES_IGNORED;
  186. }
  187.  
  188. ShoopSlay(iVictim);
  189.  
  190. new szAuthID[32], szName2[32], szAuthID2[32], szName[32];
  191. get_user_authid(iClient, szAuthID, sizeof(szAuthID)-1);
  192. get_user_name(iClient, szName, sizeof(szName)-1);
  193. get_user_authid(iVictim, szAuthID2, sizeof(szAuthID2)-1);
  194. get_user_name(iVictim, szName2, sizeof(szName2)-1);
  195.  
  196. log_amx("Cmd: ^"%s<%d><%s><>^" megutotte ^"%s<%d><%s><>^"", szName, get_user_userid(iClient), szAuthID, szName2, get_user_userid(iVictim), szAuthID2);
  197.  
  198. show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", szName, szName2);
  199.  
  200. console_print(iClient, "[AMXX] %L", iClient, "CLIENT_SLAYED", szName2);
  201.  
  202. return FMRES_IGNORED;
  203. }
  204.  
  205. ShoopSlayAll(iClient)
  206. {
  207. new bool:bSlayed;
  208. for(new i=1; i<=g_iMaxplayers; i++)
  209. {
  210. if(g_bBeingShooped[i] || i == iClient || !is_user_alive(i) || access(i, ADMIN_IMMUNITY))
  211. continue;
  212.  
  213. ShoopSlay(i);
  214. bSlayed = true;
  215. }
  216.  
  217. if(bSlayed)
  218. {
  219. new szAuthID[32], szName[32];
  220. get_user_authid(iClient, szAuthID, sizeof(szAuthID)-1);
  221. get_user_name(iClient, szName, sizeof(szName)-1);
  222.  
  223. log_amx("Cmd: ^"%s<%d><%s><>^" megutotte ^"%s<><><>^"", szName, get_user_userid(iClient), szAuthID, "@all");
  224.  
  225. show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", szName, "@all");
  226.  
  227. console_print(iClient, "[AMXX] %L", iClient, "CLIENT_SLAYED", "@all");
  228. }
  229. else
  230. console_print(iClient, "[HIBA] Ervenytelen jatekos.");
  231. }
  232.  
  233. ShoopSlay(iVictim)
  234. {
  235. // Freeze victim
  236. set_pev(iVictim, pev_movetype, MOVETYPE_NOCLIP);
  237. set_pev(iVictim, pev_solid, SOLID_NOT);
  238. set_pev(iVictim, pev_velocity, Float:{0.0,0.0,0.0});
  239. engfunc(EngFunc_SetClientMaxspeed, iVictim, 0.1);
  240.  
  241. static Float:flVictimOrigin[3];
  242. pev(iVictim, pev_origin, flVictimOrigin);
  243.  
  244. static Float:flShoopOrigin[3], bool:bShouldSpawn, bool:bMoveToSpawn;
  245. bShouldSpawn = false;
  246. bMoveToSpawn = false;
  247.  
  248. if(CanShoopSpawn(iVictim, flVictimOrigin, flShoopOrigin))
  249. bShouldSpawn = true;
  250. else
  251. {
  252. // See if Shoop can spawn near where the victim spawned, if so move victim
  253. if(CanShoopSpawn(iVictim, g_flSpawnOrigin[iVictim], flShoopOrigin))
  254. {
  255. bMoveToSpawn = true;
  256. bShouldSpawn = true;
  257. }
  258. }
  259.  
  260. static iShoop, Float:flAngles[3];
  261. if(bShouldSpawn)
  262. {
  263. // Spawn Shoop
  264. iShoop = SpawnShoop(iVictim, flShoopOrigin);
  265. }
  266.  
  267. if(iShoop)
  268. {
  269. if(bMoveToSpawn)
  270. {
  271. VectorCopy_Float(g_flSpawnOrigin[iVictim], flVictimOrigin);
  272. engfunc(EngFunc_SetOrigin, iVictim, flVictimOrigin);
  273. }
  274.  
  275. // Set shoops angles
  276. get_angles_to_origin(flShoopOrigin, flVictimOrigin, flAngles);
  277. if(flAngles[0] != 0.0)
  278. flAngles[1] += 180.0;
  279. set_pev(iShoop, pev_angles, flAngles);
  280.  
  281. // Make victim look at Shoop
  282. g_bBeingShooped[iVictim] = true;
  283.  
  284. get_angles_to_origin(flVictimOrigin, flShoopOrigin, flAngles);
  285.  
  286. if(flAngles[0] > 250)
  287. flAngles[0] = 89.0;
  288. else if(flAngles[0] > 70)
  289. flAngles[0] = -89.0;
  290.  
  291. VectorCopy_Float(flAngles, g_flAngles[iVictim]);
  292. set_pev(iVictim, pev_angles, flAngles);
  293. set_pev(iVictim, pev_fixangle, 1);
  294.  
  295. set_pev(iShoop, pev_nextthink, get_gametime() + 0.1);
  296. }
  297. else
  298. {
  299. // Slay player without using Shoop
  300. set_pdata_float(iVictim, POWERUP_GOD_OFFSET, 0.0, POWERUP_GOD_LINUX_DIFF); // Remove god in TFC when set with a power up
  301. set_pev(iVictim, pev_takedamage, DAMAGE_AIM);
  302. ExecuteHam(Ham_TakeDamage, iVictim, 0, 0, 9999.0, 0);
  303. }
  304. }
  305.  
  306. public fwd_Player_PreThink(iClient)
  307. {
  308. if(g_bBeingShooped[iClient])
  309. {
  310. set_pev(iClient, pev_angles, g_flAngles[iClient]);
  311. set_pev(iClient, pev_fixangle, 1);
  312. }
  313. }
  314.  
  315. public fwd_Think(iEnt)
  316. {
  317. if(!pev_valid(iEnt))
  318. return FMRES_IGNORED;
  319.  
  320. if(pev(iEnt, pev_iuser4) == SHOOPS_ID)
  321. {
  322. static iVictim;
  323. iVictim = pev(iEnt, pev_owner);
  324.  
  325. static Float:flShoopOrigin[3];
  326. pev(iEnt, pev_origin, flShoopOrigin);
  327.  
  328. if(!g_bBeingShooped[iVictim])
  329. {
  330. // Victim is invalid now, Remove Shoop
  331. ShoopTeleportEffect(flShoopOrigin);
  332. set_pev(iEnt, pev_flags, FL_KILLME);
  333. return FMRES_HANDLED;
  334. }
  335.  
  336. static iThinkNum;
  337. iThinkNum = pev(iEnt, pev_iuser3);
  338.  
  339. if(!iThinkNum)
  340. {
  341. // Shoops sound
  342. engfunc(EngFunc_EmitSound, iEnt, CHAN_BODY, SHOOP_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  343. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  344. set_pev(iEnt, pev_nextthink, get_gametime() + 2.6);
  345. return FMRES_HANDLED;
  346. }
  347.  
  348. if(iThinkNum == NUM_EXPLOSIONS)
  349. {
  350. // Remove Shoop on next think and slay player
  351. set_pdata_float(iVictim, POWERUP_GOD_OFFSET, 0.0, POWERUP_GOD_LINUX_DIFF); // Remove god in TFC when set with a power up
  352. set_pev(iVictim, pev_takedamage, DAMAGE_AIM);
  353. ExecuteHam(Ham_TakeDamage, iVictim, iEnt, iEnt, 9999.0, 0);
  354.  
  355. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  356. set_pev(iEnt, pev_nextthink, get_gametime() + 0.5);
  357. return FMRES_HANDLED;
  358. }
  359. else if(iThinkNum > NUM_EXPLOSIONS)
  360. {
  361. // Remove Shoop
  362. ShoopTeleportEffect(flShoopOrigin);
  363. set_pev(iEnt, pev_flags, FL_KILLME);
  364. g_bBeingShooped[iVictim] = false;
  365. return FMRES_HANDLED;
  366. }
  367.  
  368. static Float:flVictimOrigin[3];
  369. pev(iVictim, pev_origin, flVictimOrigin);
  370.  
  371. if(iThinkNum == 1)
  372. {
  373. // Shoot Beam
  374. set_pev(iEnt, pev_sequence, 0);
  375. ShoopsBeam(flVictimOrigin, flShoopOrigin);
  376. }
  377.  
  378. // Explosion
  379. ShowExplosion(g_iExplosion, 10, 12, flVictimOrigin);
  380.  
  381. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  382. set_pev(iEnt, pev_nextthink, get_gametime() + 0.1);
  383. }
  384.  
  385. return FMRES_HANDLED;
  386. }
  387.  
  388. ShoopTeleportEffect(const Float:flOrigin[3])
  389. {
  390. static iOrigin[3];
  391. iOrigin[0] = floatround(flOrigin[0]);
  392. iOrigin[1] = floatround(flOrigin[1]);
  393. iOrigin[2] = floatround(flOrigin[2]);
  394.  
  395. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
  396. write_byte(TE_TELEPORT);
  397. write_coord(iOrigin[0]);
  398. write_coord(iOrigin[1]);
  399. write_coord(iOrigin[2]);
  400. message_end();
  401. }
  402.  
  403. SpawnShoop(iVictim, const Float:flShoopOrigin[3])
  404. {
  405. // Spawn Shoop
  406. new iShoop = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
  407. dllfunc(DLLFunc_Spawn, iShoop);
  408.  
  409. set_pev(iShoop, pev_movetype, MOVETYPE_FLY);
  410. set_pev(iShoop, pev_solid, SOLID_NOT);
  411.  
  412. engfunc(EngFunc_SetModel, iShoop, SHOOP_MODEL);
  413. engfunc(EngFunc_SetSize, iShoop, g_flShoopMins, g_flShoopMaxs);
  414. engfunc(EngFunc_SetOrigin, iShoop, flShoopOrigin);
  415.  
  416. set_pev(iShoop, pev_classname, "Shoop Da Whoop");
  417.  
  418. set_pev(iShoop, pev_sequence, 3);
  419. set_pev(iShoop, pev_framerate, 1.0);
  420.  
  421. set_pev(iShoop, pev_iuser4, SHOOPS_ID);
  422. set_pev(iShoop, pev_owner, iVictim);
  423.  
  424. ShoopTeleportEffect(flShoopOrigin);
  425.  
  426. return iShoop;
  427. }
  428.  
  429. CanShoopSpawn(iVictim, const Float:flVictimOrigin[3], Float:flShoopOrigin[3])
  430. {
  431. static iAxisSequence[] = {2,0,1,0,1,2};
  432. static iAxisSign[sizeof(iAxisSequence)] = {1,1,1,-1,-1,-1};
  433. static bool:bAxisMins[sizeof(iAxisSequence)] = {false,false,false,true,true,true};
  434. new iAxis;
  435.  
  436. for(new i=0; i<sizeof(iAxisSequence); i++)
  437. {
  438. iAxis = iAxisSequence[i]
  439.  
  440. VectorCopy_Float(flVictimOrigin, flShoopOrigin);
  441. flShoopOrigin[iAxis] += (DISTANCE_SHOOP + g_flShoopMaxs[iAxis] + 1) * iAxisSign[i]
  442. if(IsShoopsHullVacant(iVictim, flVictimOrigin, flShoopOrigin, iAxis, bAxisMins[i]))
  443. return true;
  444. }
  445.  
  446. return false;
  447. }
  448.  
  449. ShoopsBeam(const Float:flStartOrigin[3], const Float:flEndOrigin[3])
  450. {
  451. static iStartOrigin[3];
  452. iStartOrigin[0] = floatround(flStartOrigin[0]);
  453. iStartOrigin[1] = floatround(flStartOrigin[1]);
  454. iStartOrigin[2] = floatround(flStartOrigin[2]);
  455.  
  456. message_begin(MSG_PVS, SVC_TEMPENTITY, iStartOrigin);
  457. write_byte(TE_BEAMPOINTS);
  458. write_coord(iStartOrigin[0]);
  459. write_coord(iStartOrigin[1]);
  460. write_coord(iStartOrigin[2]);
  461. write_coord(floatround(flEndOrigin[0]));
  462. write_coord(floatround(flEndOrigin[1]));
  463. write_coord(floatround(flEndOrigin[2]));
  464. write_short(g_iBeam);
  465. write_byte(1); // starting frame
  466. write_byte(1); // frame rate in 0.1's
  467. write_byte(NUM_EXPLOSIONS); // life in 0.1's
  468. write_byte(210); // line width in 0.1's
  469. write_byte(1); // noise amplitude in 0.01's
  470. write_byte(12); // r
  471. write_byte(109); // g
  472. write_byte(190); // b
  473. write_byte(255); // brightness
  474. write_byte(50); // scroll speed
  475. message_end();
  476. }
  477.  
  478. IsShoopsHullVacant(iVictim, const Float:flVictimOrigin[3], Float:flShoopOrigin[3], iAxis, bool:bIsMins)
  479. {
  480. TraceLine_GetEndOrigin(flVictimOrigin, iVictim, flShoopOrigin);
  481.  
  482. new Float:flDistance;
  483. if(bIsMins)
  484. flShoopOrigin[iAxis] -= g_flShoopMins[iAxis];
  485. else
  486. flShoopOrigin[iAxis] -= g_flShoopMaxs[iAxis];
  487. flDistance = get_distance_f(flVictimOrigin, flShoopOrigin);
  488.  
  489. if(flDistance < DISTANCE_SHOOP)
  490. return false;
  491.  
  492. //if(!IsBBoxHullVacant(flShoopOrigin, g_flShoopMins, g_flShoopMaxs, iVictim))
  493. // return false;
  494.  
  495. engfunc(EngFunc_TraceHull, flShoopOrigin, flShoopOrigin, 0, HULL_HEAD, iVictim, 0);
  496. if(!get_tr2(0, TR_InOpen))
  497. return false;
  498.  
  499. return true;
  500. }
  501.  
  502. stock get_angles_to_origin(const Float:flFromOrigin[3], const Float:flToOrigin[3], Float:flAngles[3])
  503. {
  504. flAngles[0] = flToOrigin[0] - flFromOrigin[0];
  505. flAngles[1] = flToOrigin[1] - flFromOrigin[1];
  506. flAngles[2] = flToOrigin[2] - flFromOrigin[2];
  507. engfunc(EngFunc_VecToAngles, flAngles, flAngles);
  508. }
  509.  
  510. stock IsBBoxHullVacant(const Float:flOrigin[3], const Float:flMins[3], const Float:flMaxs[3], iSkip)
  511. {
  512. new Float:flVerticesOrigins[8][3], i;
  513.  
  514. for(i=0; i<sizeof(flVerticesOrigins); i++)
  515. {
  516. flVerticesOrigins[i][0] = flOrigin[0];
  517. flVerticesOrigins[i][1] = flOrigin[1];
  518. flVerticesOrigins[i][2] = flOrigin[2];
  519. }
  520.  
  521. // Get the bottom vertices
  522. flVerticesOrigins[0][0] += flMins[0];
  523. flVerticesOrigins[0][1] += flMaxs[1];
  524. flVerticesOrigins[0][2] += flMins[2];
  525.  
  526. flVerticesOrigins[1][0] += flMaxs[0];
  527. flVerticesOrigins[1][1] += flMaxs[1];
  528. flVerticesOrigins[1][2] += flMins[2];
  529.  
  530. flVerticesOrigins[2][0] += flMaxs[0];
  531. flVerticesOrigins[2][1] += flMins[1];
  532. flVerticesOrigins[2][2] += flMins[2];
  533.  
  534. flVerticesOrigins[3][0] += flMins[0];
  535. flVerticesOrigins[3][1] += flMins[1];
  536. flVerticesOrigins[3][2] += flMins[2];
  537.  
  538. // Get the top vertices
  539. flVerticesOrigins[4][0] += flMins[0];
  540. flVerticesOrigins[4][1] += flMaxs[1];
  541. flVerticesOrigins[4][2] += flMaxs[2];
  542.  
  543. flVerticesOrigins[5][0] += flMaxs[0];
  544. flVerticesOrigins[5][1] += flMaxs[1];
  545. flVerticesOrigins[5][2] += flMaxs[2];
  546.  
  547. flVerticesOrigins[6][0] += flMaxs[0];
  548. flVerticesOrigins[6][1] += flMins[1];
  549. flVerticesOrigins[6][2] += flMaxs[2];
  550.  
  551. flVerticesOrigins[7][0] += flMins[0];
  552. flVerticesOrigins[7][1] += flMins[1];
  553. flVerticesOrigins[7][2] += flMaxs[2];
  554.  
  555. new Float:flFractionTotal, Float:flFraction;
  556. // Trace lines to make edges on the bottom face
  557. for(i=0; i<=3; i++)
  558. {
  559. if(i == 3)
  560. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[0], 0, iSkip, 0);
  561. else
  562. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+1], 0, iSkip, 0);
  563.  
  564. get_tr2(0, TR_flFraction, flFraction);
  565. flFractionTotal += flFraction;
  566. }
  567.  
  568. // Trace lines to make edges on the top face
  569. for(i=4; i<=7; i++)
  570. {
  571. if(i == 7)
  572. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[4], 0, iSkip, 0);
  573. else
  574. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+1], 0, iSkip, 0);
  575.  
  576. get_tr2(0, TR_flFraction, flFraction);
  577. flFractionTotal += flFraction;
  578. }
  579.  
  580. // Trace 4 lines to make the edges going from bottom vertices to top
  581. for(i=0; i<=3; i++)
  582. {
  583. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+4], 0, iSkip, 0);
  584. get_tr2(0, TR_flFraction, flFraction);
  585. flFractionTotal += flFraction;
  586. }
  587.  
  588. if(flFractionTotal < 12)
  589. return false;
  590.  
  591. return true;
  592. }
  593.  
  594. stock VectorCopy_Float(const Float:flVecOriginal[3], Float:flVecCopy[3])
  595. {
  596. flVecCopy[0] = flVecOriginal[0];
  597. flVecCopy[1] = flVecOriginal[1];
  598. flVecCopy[2] = flVecOriginal[2];
  599. }
  600.  
  601. stock TraceLine_GetEndOrigin(const Float:flStartOrigin[3], iSkip, Float:flEndOrigin[3])
  602. {
  603. engfunc(EngFunc_TraceLine, flStartOrigin, flEndOrigin, 0, iSkip, 0);
  604. get_tr2(0, TR_vecEndPos, flEndOrigin);
  605. }
  606.  
  607. stock ShowExplosion(iSprite, iScale, iFrameRate, const Float:flOrigin[3])
  608. {
  609. static iOrigin[3];
  610. iOrigin[0] = floatround(flOrigin[0]);
  611. iOrigin[1] = floatround(flOrigin[1]);
  612. iOrigin[2] = floatround(flOrigin[2]);
  613.  
  614. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
  615. write_byte(TE_EXPLOSION);
  616. write_coord(iOrigin[0]);
  617. write_coord(iOrigin[1]);
  618. write_coord(iOrigin[2]);
  619. write_short(iSprite);
  620. write_byte(iScale);
  621. write_byte(iFrameRate);
  622. write_byte(0);
  623. message_end();
  624. }

_________________
http://www.ebateam.eu/

Ők köszönték meg IrOn nek ezt a hozzászólást: bencike (2014.02.13. 10:10)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Kick jogra átírás.
HozzászólásElküldve: 2014.02.13. 10:20 
Offline
Senior Tag
Avatar

Csatlakozott: 2014.01.20. 13:00
Hozzászólások: 216
Megköszönt másnak: 89 alkalommal
Megköszönték neki: 14 alkalommal
Kick jogos admminal tesztelve.

"Nincs elérhetőséged ehez a parancshoz.."

_________________
Kép
Kép
https://soundcloud.com/l-c-a-w


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Kick jogra átírás.
HozzászólásElküldve: 2014.02.13. 16:40 
Offline
Őskövület
Avatar

Csatlakozott: 2012.02.27. 09:42
Hozzászólások: 2588
Megköszönt másnak: 25 alkalommal
Megköszönték neki: 418 alkalommal
Próbáld
SMA Forráskód: [ Mindet kijelol ]
  1. /* =============================================
  2. * - NAME:
  3. * + Shoop da Whoop Slay
  4. *
  5. * - DESCRIPTION:
  6. * +
  7. * + This plugin will spawn 'Shoop da Whoop' to slay a player with his laser.
  8. * + It's exactly like the regular amx_slay but with the added style.
  9. * +
  10. *
  11. * - CREDITS:
  12. * + Max: For making the awesome Shoop da Whoop model and testing.
  13. * + Almightynoob: For helping with demo video and testing.
  14. * + TonyCip/Tyrant/Psy/Muchez: For testing.
  15. *
  16. *
  17. * ---------------
  18. * Admin commands:
  19. * ---------------
  20. * - amx_shoopslay <name or #userid>
  21. * + Lets an admin slay players using Shoop da Whoop.
  22. *
  23. *
  24. * ----------
  25. * Changelog:
  26. * ----------
  27. * Version 1.0 ( 08-18-2009 )
  28. * -- Initial release.
  29. *
  30. * Version 1.1 ( 08-21-2009 )
  31. * -- Now using hamsandwiches think forward instead of fakemetas.
  32. * -- Fixed bug where players with god mode would not be slayed.
  33. *
  34. * Version 1.2 ( 08-21-2009 )
  35. * -- No longer using #define for strings (thanks Exolent).
  36. * -- Removed the player check in Ham_TakeDamage (thanks joaquimandrade).
  37. * -- CanShoopSpawn() now uses loop instead of code repetition (thanks joaquimandrade).
  38. * -- Now using TraceHull instead of a custom trace function (thanks joaquimandrade).
  39. *
  40. * Version 1.3 ( 08-23-2009 )
  41. * -- Fixed the god mode private data offset for Linux servers.
  42. * -- Added back a player check I removed in version 1.2 (thanks koleos).
  43. *
  44. * Version 1.4 ( 08-24-2009 )
  45. * -- Changed MSG_BROADCAST to MSG_PVS for tempents.
  46. * -- Added the ability to slay everyone at once using @all.
  47. *
  48. */
  49.  
  50. #include <amxmodx>
  51. #include <amxmisc>
  52. #include <fakemeta>
  53. #include <hamsandwich>
  54.  
  55. new const PLUGIN[] = "Shoop da Whoop Slay";
  56. new const VERSION[] = "1.4";
  57. new const AUTHOR[] = "hlstriker";
  58.  
  59. new g_iMaxplayers;
  60. #define MAX_PLAYERS 32
  61.  
  62. #define POWERUP_GOD_OFFSET 271
  63. #define POWERUP_GOD_LINUX_DIFF 3
  64.  
  65. new bool:g_bBeingShooped[MAX_PLAYERS+1];
  66. new Float:g_flAngles[MAX_PLAYERS+1][3];
  67. new Float:g_flSpawnOrigin[MAX_PLAYERS+1][3];
  68.  
  69. #define NUM_EXPLOSIONS 7
  70. #define SHOOPS_ID 9281
  71.  
  72. #define DISTANCE_SHOOP 165.0
  73. new Float:g_flShoopMins[3] = {-15.0, -15.0, -15.0}; // No smaller than: Vector(-16, -16, -18)
  74. new Float:g_flShoopMaxs[3] = {15.0, 15.0, 15.0}; // No bigger than: Vector( 16, 16, 18)
  75.  
  76. new const SHOOP_MODEL[] = "models/shoopslay/shoop_b7.mdl";
  77. new const SHOOP_SOUND[] = "shoopslay/shoop_b4.wav";
  78.  
  79. new g_iExplosion;
  80. new g_iBeam;
  81. new const EXPLOSION_SPRITE[] = "sprites/explode1.spr";
  82. new const BEAM_SPRITE[] = "sprites/xbeam3.spr";
  83.  
  84. public plugin_init()
  85. {
  86. register_plugin(PLUGIN, VERSION, AUTHOR);
  87. register_cvar("shoopslay_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY);
  88. register_forward(FM_ClientKill, "fwd_ClientKill");
  89. RegisterHam(Ham_Player_PreThink, "player", "fwd_Player_PreThink");
  90. RegisterHam(Ham_TakeDamage, "player", "fwd_TakeDamage");
  91. RegisterHam(Ham_Think, "info_target", "fwd_Think");
  92.  
  93. register_logevent("hook_RoundStart", 2, "1=Round_Start");
  94. register_event("CurWeapon", "hook_CurWeapon", "be", "1=1");
  95. register_event("ResetHUD", "hook_ResetHUD", "be");
  96. register_clcmd("fullupdate", "hook_BlockCommand");
  97.  
  98. register_concmd("amx_shoopslay", "CmdShoopSlay");
  99.  
  100. g_iMaxplayers = get_maxplayers();
  101. }
  102.  
  103. public plugin_precache()
  104. {
  105. g_iExplosion = precache_model(EXPLOSION_SPRITE);
  106. g_iBeam = precache_model(BEAM_SPRITE);
  107. precache_model(SHOOP_MODEL);
  108. precache_sound(SHOOP_SOUND);
  109. }
  110.  
  111. public client_disconnect(iClient)
  112. g_bBeingShooped[iClient] = false;
  113.  
  114. public fwd_TakeDamage(iVictim, iInflictor, iAttacker, Float:flDamage, iDmgBits)
  115. {
  116. if(g_bBeingShooped[iVictim])
  117. return HAM_SUPERCEDE;
  118.  
  119. if(1 <= iAttacker <= g_iMaxplayers)
  120. {
  121. if(g_bBeingShooped[iAttacker])
  122. return HAM_SUPERCEDE;
  123. }
  124.  
  125. return HAM_IGNORED;
  126. }
  127.  
  128. public hook_RoundStart()
  129. {
  130. for(new i=1; i<=g_iMaxplayers; i++)
  131. {
  132. if(g_bBeingShooped[i])
  133. set_task(0.1, "task_ResetSpeed", i);
  134. }
  135. }
  136.  
  137. public task_ResetSpeed(iClient)
  138. engfunc(EngFunc_SetClientMaxspeed, iClient, 0.1);
  139.  
  140. public hook_CurWeapon(iClient)
  141. {
  142. if(g_bBeingShooped[iClient])
  143. engfunc(EngFunc_SetClientMaxspeed, iClient, 0.1);
  144. }
  145.  
  146. public fwd_ClientKill(iClient)
  147. {
  148. if(g_bBeingShooped[iClient])
  149. return FMRES_SUPERCEDE;
  150. return FMRES_IGNORED;
  151. }
  152.  
  153. public hook_ResetHUD(iClient)
  154. set_task(0.4, "task_Spawn", iClient);
  155.  
  156. public task_Spawn(iClient)
  157. pev(iClient, pev_origin, g_flSpawnOrigin[iClient]);
  158.  
  159. public hook_BlockCommand()
  160. return PLUGIN_HANDLED;
  161.  
  162. public CmdShoopSlay(iClient)
  163. {
  164. if(get_user_flags(iClient) & ADMIN_KICK)
  165. {
  166.  
  167. new szArg[32];
  168.  
  169. read_argv(1, szArg, sizeof(szArg)-1);
  170.  
  171. if(equali(szArg, "@all"))
  172. {
  173. ShoopSlayAll(iClient);
  174. return FMRES_IGNORED;
  175. }
  176.  
  177. new iVictim = cmd_target(iClient, szArg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE);
  178.  
  179. if(!iVictim)
  180. return FMRES_IGNORED;
  181.  
  182. if(g_bBeingShooped[iVictim])
  183. {
  184. console_print(iClient, "[HIBA] Mar folyamatban van a celpont likvidalasa.");
  185. return FMRES_IGNORED;
  186. }
  187.  
  188. ShoopSlay(iVictim);
  189.  
  190. new szAuthID[32], szName2[32], szAuthID2[32], szName[32];
  191. get_user_authid(iClient, szAuthID, sizeof(szAuthID)-1);
  192. get_user_name(iClient, szName, sizeof(szName)-1);
  193. get_user_authid(iVictim, szAuthID2, sizeof(szAuthID2)-1);
  194. get_user_name(iVictim, szName2, sizeof(szName2)-1);
  195.  
  196. log_amx("Cmd: ^"%s<%d><%s><>^" megutotte ^"%s<%d><%s><>^"", szName, get_user_userid(iClient), szAuthID, szName2, get_user_userid(iVictim), szAuthID2);
  197.  
  198. show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", szName, szName2);
  199.  
  200. console_print(iClient, "[AMXX] %L", iClient, "CLIENT_SLAYED", szName2);
  201.  
  202.  
  203. }
  204. return FMRES_IGNORED;
  205. }
  206.  
  207.  
  208. ShoopSlayAll(iClient)
  209. {
  210. new bool:bSlayed;
  211. for(new i=1; i<=g_iMaxplayers; i++)
  212. {
  213. if(g_bBeingShooped[i] || i == iClient || !is_user_alive(i) || access(i, ADMIN_IMMUNITY))
  214. continue;
  215.  
  216. ShoopSlay(i);
  217. bSlayed = true;
  218. }
  219.  
  220. if(bSlayed)
  221. {
  222. new szAuthID[32], szName[32];
  223. get_user_authid(iClient, szAuthID, sizeof(szAuthID)-1);
  224. get_user_name(iClient, szName, sizeof(szName)-1);
  225.  
  226. log_amx("Cmd: ^"%s<%d><%s><>^" megutotte ^"%s<><><>^"", szName, get_user_userid(iClient), szAuthID, "@all");
  227.  
  228. show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", szName, "@all");
  229.  
  230. console_print(iClient, "[AMXX] %L", iClient, "CLIENT_SLAYED", "@all");
  231. }
  232. else
  233. console_print(iClient, "[HIBA] Ervenytelen jatekos.");
  234. }
  235.  
  236. ShoopSlay(iVictim)
  237. {
  238. // Freeze victim
  239. set_pev(iVictim, pev_movetype, MOVETYPE_NOCLIP);
  240. set_pev(iVictim, pev_solid, SOLID_NOT);
  241. set_pev(iVictim, pev_velocity, Float:{0.0,0.0,0.0});
  242. engfunc(EngFunc_SetClientMaxspeed, iVictim, 0.1);
  243.  
  244. static Float:flVictimOrigin[3];
  245. pev(iVictim, pev_origin, flVictimOrigin);
  246.  
  247. static Float:flShoopOrigin[3], bool:bShouldSpawn, bool:bMoveToSpawn;
  248. bShouldSpawn = false;
  249. bMoveToSpawn = false;
  250.  
  251. if(CanShoopSpawn(iVictim, flVictimOrigin, flShoopOrigin))
  252. bShouldSpawn = true;
  253. else
  254. {
  255. // See if Shoop can spawn near where the victim spawned, if so move victim
  256. if(CanShoopSpawn(iVictim, g_flSpawnOrigin[iVictim], flShoopOrigin))
  257. {
  258. bMoveToSpawn = true;
  259. bShouldSpawn = true;
  260. }
  261. }
  262.  
  263. static iShoop, Float:flAngles[3];
  264. if(bShouldSpawn)
  265. {
  266. // Spawn Shoop
  267. iShoop = SpawnShoop(iVictim, flShoopOrigin);
  268. }
  269.  
  270. if(iShoop)
  271. {
  272. if(bMoveToSpawn)
  273. {
  274. VectorCopy_Float(g_flSpawnOrigin[iVictim], flVictimOrigin);
  275. engfunc(EngFunc_SetOrigin, iVictim, flVictimOrigin);
  276. }
  277.  
  278. // Set shoops angles
  279. get_angles_to_origin(flShoopOrigin, flVictimOrigin, flAngles);
  280. if(flAngles[0] != 0.0)
  281. flAngles[1] += 180.0;
  282. set_pev(iShoop, pev_angles, flAngles);
  283.  
  284. // Make victim look at Shoop
  285. g_bBeingShooped[iVictim] = true;
  286.  
  287. get_angles_to_origin(flVictimOrigin, flShoopOrigin, flAngles);
  288.  
  289. if(flAngles[0] > 250)
  290. flAngles[0] = 89.0;
  291. else if(flAngles[0] > 70)
  292. flAngles[0] = -89.0;
  293.  
  294. VectorCopy_Float(flAngles, g_flAngles[iVictim]);
  295. set_pev(iVictim, pev_angles, flAngles);
  296. set_pev(iVictim, pev_fixangle, 1);
  297. set_pev(iShoop, pev_nextthink, get_gametime() + 0.1);
  298. }
  299. else
  300. {
  301. // Slay player without using Shoop
  302. set_pdata_float(iVictim, POWERUP_GOD_OFFSET, 0.0, POWERUP_GOD_LINUX_DIFF); // Remove god in TFC when set with a power up
  303. set_pev(iVictim, pev_takedamage, DAMAGE_AIM);
  304. ExecuteHam(Ham_TakeDamage, iVictim, 0, 0, 9999.0, 0);
  305. }
  306. }
  307.  
  308. public fwd_Player_PreThink(iClient)
  309. {
  310. if(g_bBeingShooped[iClient])
  311. {
  312. set_pev(iClient, pev_angles, g_flAngles[iClient]);
  313. set_pev(iClient, pev_fixangle, 1);
  314. }
  315. }
  316.  
  317. public fwd_Think(iEnt)
  318. {
  319. if(!pev_valid(iEnt))
  320. return FMRES_IGNORED;
  321.  
  322. if(pev(iEnt, pev_iuser4) == SHOOPS_ID)
  323. {
  324. static iVictim;
  325. iVictim = pev(iEnt, pev_owner);
  326.  
  327. static Float:flShoopOrigin[3];
  328. pev(iEnt, pev_origin, flShoopOrigin);
  329.  
  330. if(!g_bBeingShooped[iVictim])
  331. {
  332. // Victim is invalid now, Remove Shoop
  333. ShoopTeleportEffect(flShoopOrigin);
  334. set_pev(iEnt, pev_flags, FL_KILLME);
  335. return FMRES_HANDLED;
  336. }
  337.  
  338. static iThinkNum;
  339. iThinkNum = pev(iEnt, pev_iuser3);
  340.  
  341. if(!iThinkNum)
  342. {
  343. // Shoops sound
  344. engfunc(EngFunc_EmitSound, iEnt, CHAN_BODY, SHOOP_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  345. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  346. set_pev(iEnt, pev_nextthink, get_gametime() + 2.6);
  347. return FMRES_HANDLED;
  348. }
  349.  
  350. if(iThinkNum == NUM_EXPLOSIONS)
  351. {
  352. // Remove Shoop on next think and slay player
  353. set_pdata_float(iVictim, POWERUP_GOD_OFFSET, 0.0, POWERUP_GOD_LINUX_DIFF); // Remove god in TFC when set with a power up
  354. set_pev(iVictim, pev_takedamage, DAMAGE_AIM);
  355. ExecuteHam(Ham_TakeDamage, iVictim, iEnt, iEnt, 9999.0, 0);
  356.  
  357. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  358. set_pev(iEnt, pev_nextthink, get_gametime() + 0.5);
  359. return FMRES_HANDLED;
  360. }
  361. else if(iThinkNum > NUM_EXPLOSIONS)
  362. {
  363. // Remove Shoop
  364. ShoopTeleportEffect(flShoopOrigin);
  365. set_pev(iEnt, pev_flags, FL_KILLME);
  366. g_bBeingShooped[iVictim] = false;
  367. return FMRES_HANDLED;
  368. }
  369.  
  370. static Float:flVictimOrigin[3];
  371. pev(iVictim, pev_origin, flVictimOrigin);
  372.  
  373. if(iThinkNum == 1)
  374. {
  375. // Shoot Beam
  376. set_pev(iEnt, pev_sequence, 0);
  377. ShoopsBeam(flVictimOrigin, flShoopOrigin);
  378. }
  379.  
  380. // Explosion
  381. ShowExplosion(g_iExplosion, 10, 12, flVictimOrigin);
  382.  
  383. set_pev(iEnt, pev_iuser3, iThinkNum+1);
  384. set_pev(iEnt, pev_nextthink, get_gametime() + 0.1);
  385. }
  386.  
  387. return FMRES_HANDLED;
  388. }
  389.  
  390. ShoopTeleportEffect(const Float:flOrigin[3])
  391. {
  392. static iOrigin[3];
  393. iOrigin[0] = floatround(flOrigin[0]);
  394. iOrigin[1] = floatround(flOrigin[1]);
  395. iOrigin[2] = floatround(flOrigin[2]);
  396.  
  397. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
  398. write_byte(TE_TELEPORT);
  399. write_coord(iOrigin[0]);
  400. write_coord(iOrigin[1]);
  401. write_coord(iOrigin[2]);
  402. message_end();
  403. }
  404.  
  405. SpawnShoop(iVictim, const Float:flShoopOrigin[3])
  406. {
  407. // Spawn Shoop
  408. new iShoop = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
  409. dllfunc(DLLFunc_Spawn, iShoop);
  410.  
  411. set_pev(iShoop, pev_movetype, MOVETYPE_FLY);
  412. set_pev(iShoop, pev_solid, SOLID_NOT);
  413.  
  414. engfunc(EngFunc_SetModel, iShoop, SHOOP_MODEL);
  415. engfunc(EngFunc_SetSize, iShoop, g_flShoopMins, g_flShoopMaxs);
  416. engfunc(EngFunc_SetOrigin, iShoop, flShoopOrigin);
  417.  
  418. set_pev(iShoop, pev_classname, "Shoop Da Whoop");
  419.  
  420. set_pev(iShoop, pev_sequence, 3);
  421. set_pev(iShoop, pev_framerate, 1.0);
  422.  
  423. set_pev(iShoop, pev_iuser4, SHOOPS_ID);
  424. set_pev(iShoop, pev_owner, iVictim);
  425.  
  426. ShoopTeleportEffect(flShoopOrigin);
  427.  
  428. return iShoop;
  429. }
  430.  
  431. CanShoopSpawn(iVictim, const Float:flVictimOrigin[3], Float:flShoopOrigin[3])
  432. {
  433. static iAxisSequence[] = {2,0,1,0,1,2};
  434. static iAxisSign[sizeof(iAxisSequence)] = {1,1,1,-1,-1,-1};
  435. static bool:bAxisMins[sizeof(iAxisSequence)] = {false,false,false,true,true,true};
  436. new iAxis;
  437.  
  438. for(new i=0; i<sizeof(iAxisSequence); i++)
  439. {
  440. iAxis = iAxisSequence[i]
  441.  
  442. VectorCopy_Float(flVictimOrigin, flShoopOrigin);
  443. flShoopOrigin[iAxis] += (DISTANCE_SHOOP + g_flShoopMaxs[iAxis] + 1) * iAxisSign[i]
  444. if(IsShoopsHullVacant(iVictim, flVictimOrigin, flShoopOrigin, iAxis, bAxisMins[i]))
  445. return true;
  446. }
  447.  
  448. return false;
  449. }
  450.  
  451. ShoopsBeam(const Float:flStartOrigin[3], const Float:flEndOrigin[3])
  452. {
  453. static iStartOrigin[3];
  454. iStartOrigin[0] = floatround(flStartOrigin[0]);
  455. iStartOrigin[1] = floatround(flStartOrigin[1]);
  456. iStartOrigin[2] = floatround(flStartOrigin[2]);
  457.  
  458. message_begin(MSG_PVS, SVC_TEMPENTITY, iStartOrigin);
  459. write_byte(TE_BEAMPOINTS);
  460. write_coord(iStartOrigin[0]);
  461. write_coord(iStartOrigin[1]);
  462. write_coord(iStartOrigin[2]);
  463. write_coord(floatround(flEndOrigin[0]));
  464. write_coord(floatround(flEndOrigin[1]));
  465. write_coord(floatround(flEndOrigin[2]));
  466. write_short(g_iBeam);
  467. write_byte(1); // starting frame
  468. write_byte(1); // frame rate in 0.1's
  469. write_byte(NUM_EXPLOSIONS); // life in 0.1's
  470. write_byte(210); // line width in 0.1's
  471. write_byte(1); // noise amplitude in 0.01's
  472. write_byte(12); // r
  473. write_byte(109); // g
  474. write_byte(190); // b
  475. write_byte(255); // brightness
  476. write_byte(50); // scroll speed
  477. message_end();
  478. }
  479.  
  480. IsShoopsHullVacant(iVictim, const Float:flVictimOrigin[3], Float:flShoopOrigin[3], iAxis, bool:bIsMins)
  481. {
  482. TraceLine_GetEndOrigin(flVictimOrigin, iVictim, flShoopOrigin);
  483.  
  484. new Float:flDistance;
  485. if(bIsMins)
  486. flShoopOrigin[iAxis] -= g_flShoopMins[iAxis];
  487. else
  488. flShoopOrigin[iAxis] -= g_flShoopMaxs[iAxis];
  489. flDistance = get_distance_f(flVictimOrigin, flShoopOrigin);
  490.  
  491. if(flDistance < DISTANCE_SHOOP)
  492. return false;
  493.  
  494. //if(!IsBBoxHullVacant(flShoopOrigin, g_flShoopMins, g_flShoopMaxs, iVictim))
  495. // return false;
  496.  
  497. engfunc(EngFunc_TraceHull, flShoopOrigin, flShoopOrigin, 0, HULL_HEAD, iVictim, 0);
  498. if(!get_tr2(0, TR_InOpen))
  499. return false;
  500.  
  501. return true;
  502. }
  503.  
  504. stock get_angles_to_origin(const Float:flFromOrigin[3], const Float:flToOrigin[3], Float:flAngles[3])
  505. {
  506. flAngles[0] = flToOrigin[0] - flFromOrigin[0];
  507. flAngles[1] = flToOrigin[1] - flFromOrigin[1];
  508. flAngles[2] = flToOrigin[2] - flFromOrigin[2];
  509. engfunc(EngFunc_VecToAngles, flAngles, flAngles);
  510. }
  511.  
  512. stock IsBBoxHullVacant(const Float:flOrigin[3], const Float:flMins[3], const Float:flMaxs[3], iSkip)
  513. {
  514. new Float:flVerticesOrigins[8][3], i;
  515.  
  516. for(i=0; i<sizeof(flVerticesOrigins); i++)
  517. {
  518. flVerticesOrigins[i][0] = flOrigin[0];
  519. flVerticesOrigins[i][1] = flOrigin[1];
  520. flVerticesOrigins[i][2] = flOrigin[2];
  521. }
  522.  
  523. // Get the bottom vertices
  524. flVerticesOrigins[0][0] += flMins[0];
  525. flVerticesOrigins[0][1] += flMaxs[1];
  526. flVerticesOrigins[0][2] += flMins[2];
  527.  
  528. flVerticesOrigins[1][0] += flMaxs[0];
  529. flVerticesOrigins[1][1] += flMaxs[1];
  530. flVerticesOrigins[1][2] += flMins[2];
  531.  
  532. flVerticesOrigins[2][0] += flMaxs[0];
  533. flVerticesOrigins[2][1] += flMins[1];
  534. flVerticesOrigins[2][2] += flMins[2];
  535.  
  536. flVerticesOrigins[3][0] += flMins[0];
  537. flVerticesOrigins[3][1] += flMins[1];
  538. flVerticesOrigins[3][2] += flMins[2];
  539.  
  540. // Get the top vertices
  541. flVerticesOrigins[4][0] += flMins[0];
  542. flVerticesOrigins[4][1] += flMaxs[1];
  543. flVerticesOrigins[4][2] += flMaxs[2];
  544.  
  545. flVerticesOrigins[5][0] += flMaxs[0];
  546. flVerticesOrigins[5][1] += flMaxs[1];
  547. flVerticesOrigins[5][2] += flMaxs[2];
  548.  
  549. flVerticesOrigins[6][0] += flMaxs[0];
  550. flVerticesOrigins[6][1] += flMins[1];
  551. flVerticesOrigins[6][2] += flMaxs[2];
  552.  
  553. flVerticesOrigins[7][0] += flMins[0];
  554. flVerticesOrigins[7][1] += flMins[1];
  555. flVerticesOrigins[7][2] += flMaxs[2];
  556.  
  557. new Float:flFractionTotal, Float:flFraction;
  558. // Trace lines to make edges on the bottom face
  559. for(i=0; i<=3; i++)
  560. {
  561. if(i == 3)
  562. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[0], 0, iSkip, 0);
  563. else
  564. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+1], 0, iSkip, 0);
  565.  
  566. get_tr2(0, TR_flFraction, flFraction);
  567. flFractionTotal += flFraction;
  568. }
  569.  
  570. // Trace lines to make edges on the top face
  571. for(i=4; i<=7; i++)
  572. {
  573. if(i == 7)
  574. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[4], 0, iSkip, 0);
  575. else
  576. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+1], 0, iSkip, 0);
  577.  
  578. get_tr2(0, TR_flFraction, flFraction);
  579. flFractionTotal += flFraction;
  580. }
  581.  
  582. // Trace 4 lines to make the edges going from bottom vertices to top
  583. for(i=0; i<=3; i++)
  584. {
  585. engfunc(EngFunc_TraceLine, flVerticesOrigins[i], flVerticesOrigins[i+4], 0, iSkip, 0);
  586. get_tr2(0, TR_flFraction, flFraction);
  587. flFractionTotal += flFraction;
  588. }
  589.  
  590. if(flFractionTotal < 12)
  591. return false;
  592.  
  593. return true;
  594. }
  595.  
  596. stock VectorCopy_Float(const Float:flVecOriginal[3], Float:flVecCopy[3])
  597. {
  598. flVecCopy[0] = flVecOriginal[0];
  599. flVecCopy[1] = flVecOriginal[1];
  600. flVecCopy[2] = flVecOriginal[2];
  601. }
  602.  
  603. stock TraceLine_GetEndOrigin(const Float:flStartOrigin[3], iSkip, Float:flEndOrigin[3])
  604. {
  605. engfunc(EngFunc_TraceLine, flStartOrigin, flEndOrigin, 0, iSkip, 0);
  606. get_tr2(0, TR_vecEndPos, flEndOrigin);
  607. }
  608.  
  609. stock ShowExplosion(iSprite, iScale, iFrameRate, const Float:flOrigin[3])
  610. {
  611. static iOrigin[3];
  612. iOrigin[0] = floatround(flOrigin[0]);
  613. iOrigin[1] = floatround(flOrigin[1]);
  614. iOrigin[2] = floatround(flOrigin[2]);
  615.  
  616. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
  617. write_byte(TE_EXPLOSION);
  618. write_coord(iOrigin[0]);
  619. write_coord(iOrigin[1]);
  620. write_coord(iOrigin[2]);
  621. write_short(iSprite);
  622. write_byte(iScale);
  623. write_byte(iFrameRate);
  624. write_byte(0);
  625. message_end();
  626. }

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 4 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 11 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole