Advertisement
Guest User

Untitled

a guest
Jun 15th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 22.69 KB | None | 0 0
  1. /*==================================================================================================
  2. LIBRARIES.
  3. ==================================================================================================*/
  4.  
  5. #include <amxmodx>
  6. #include <engine>
  7. #include <hamsandwich>
  8. #include <xs>
  9.  
  10. #include <ipci/Ascend>
  11. #include <ipci/Core>
  12. #include <ipci/FXLib>
  13.  
  14. #include <xtension/Special>
  15.  
  16.  
  17.  
  18.  
  19. /*==================================================================================================
  20. ADDITIONAL MATERIAL.
  21. ==================================================================================================*/
  22.  
  23. #define SPECIAL_VALREQSTATE 1
  24. #define SPECIAL_NULREQSTATE 0
  25.  
  26. stock SpecialXtension:__sx_Mafuba;
  27.  
  28. // Sequence
  29. static __int_Sequence[2], __int_Capsule;
  30.  
  31. // Effects
  32. static __int_Gibs[3], __int_Trail, __int_Lightning;
  33.  
  34. // Conditions
  35.  
  36. /*==================================================================================================
  37. START OF THE SPECIAL.
  38. ==================================================================================================*/
  39.  
  40. public plugin_init()
  41. {
  42.     register_forward(FM_AddToFullPack, "@FM_AddToFullPack", ._post = true);
  43.    
  44.     RegisterHam(Ham_Use, "func_button", "@Ham_Use");
  45.     RegisterHam(Ham_TakeDamage, "info_target", "@Ham_TakeDamage");
  46.    
  47.     register_clcmd("say c", "@CreateMafubaBeamEntity");
  48.    
  49.     register_think("capsule_jar", "@Think_Jar");
  50.    
  51.     register_touch("worldspawn", "capsule_jar", "@Touch_Jar");
  52.    
  53.     //register_forward( FM_Touch, "@EntityTouch" );   For touching the beam entity
  54. }
  55.  
  56. public plugin_precache()
  57. {
  58.     precache_model("models/capsule.mdl");
  59.     precache_model("models/ricecooker.mdl");
  60.    
  61.     precache_model("sprites/mafuba.spr");
  62.    
  63.     __int_Trail = precache_model("sprites/auratrail.spr");
  64.    
  65.     __int_Lightning = precache_model("sprites/lgtning.spr");
  66.    
  67.     __int_Gibs[0] = precache_model("models/teil1.mdl");
  68.     __int_Gibs[1] = precache_model("models/teil2.mdl");
  69.     __int_Gibs[2] = precache_model("models/teil3.mdl");
  70.    
  71.     precache_sound("weapons/mafuba/capsule_click.wav");
  72.     precache_sound("weapons/mafuba/capsule_bounce.wav");
  73.     precache_sound("weapons/mafuba/capsule_decompression.wav");
  74.    
  75.     precache_sound("weapons/mafuba/jar_use.wav");
  76.     precache_sound("weapons/mafuba/jar_break.wav");
  77.    
  78.     precache_sound("weapons/powerup.wav");
  79.     precache_sound("weapons/mafuba/player_scream.wav");
  80.    
  81.     precache_sound("common/wpn_select.wav");
  82. }
  83.  
  84. public @CreateMafubaBeamEntity(__int_Entity, const __int_Owner, const Float:__float_Scale, const __int_Velocity)
  85. {
  86.     __int_Entity = create_entity("env_sprite");
  87.    
  88.     entity_set_model(__int_Entity, "sprites/mafuba.spr");
  89.    
  90.     entity_set_int(__int_Entity, EV_INT_spawnflags, SF_SPRITE_STARTON);
  91.    
  92.     DispatchSpawn(__int_Entity);
  93.    
  94.     entity_set_int(__int_Entity, EV_INT_renderfx, kRenderFxGlowShell);
  95.     entity_set_int(__int_Entity, EV_INT_rendermode, kRenderTransAdd);
  96.  
  97.     entity_set_float(__int_Entity, EV_FL_animtime, get_gametime());
  98.     entity_set_float(__int_Entity, EV_FL_framerate, float(10));
  99.    
  100.     entity_set_string(__int_Entity, EV_SZ_classname, "mafuba");
  101.    
  102.     entity_set_float(__int_Entity, EV_FL_renderamt, float(254));
  103.    
  104.     entity_set_float(__int_Entity, EV_FL_scale, __float_Scale);
  105.    
  106.     entity_set_int(__int_Entity, EV_INT_movetype, MOVETYPE_FLY);
  107.    
  108.     entity_set_size(__int_Entity, Float:{-8.000_000, -8.000_000, -8.000_000}, Float:{8.000_000, 8.000_000, 8.000_000});
  109.    
  110.     entity_set_int(__int_Entity, EV_INT_solid, SOLID_TRIGGER);
  111.    
  112.     entity_set_edict(__int_Entity, EV_ENT_owner, __int_Owner);
  113.     entity_set_edict(__int_Entity, EV_ENT_pContainingEntity, __int_Entity);
  114.    
  115.     static Float:__float_Origin[3];
  116.     entity_get_vector(__int_Owner, EV_VEC_origin, __float_Origin);
  117.    
  118.     entity_set_origin(__int_Entity, __float_Origin);
  119.    
  120.     static Float:__float_Velocity[3];
  121.     velocity_by_aim(__int_Owner, __int_Velocity, __float_Velocity);
  122.    
  123.     entity_set_vector(__int_Entity, EV_VEC_velocity, __float_Velocity);
  124. }
  125.  
  126. public client_connect(__int_Index)
  127. {
  128.     @RemoveData(__int_Index);
  129. }
  130.  
  131. public client_disconnect(__int_Index)
  132. {
  133.     @RemoveData(__int_Index);
  134. }
  135.  
  136. public @ClientReSpawned(__int_Index)
  137. {
  138.     if(is_user_alive(__int_Index))
  139.     {
  140.         __int_Capsule |= (1 << __int_Index);
  141.     }
  142. }
  143.  
  144. public @SpecialCreation()
  145. {
  146.     beginSpecialCreation("Mafuba", "", "@CallBackMafuba", "special_mafuba");
  147.    
  148.     addSpecialCharge(   .ControlSequence = IN_ATTACK,
  149.                 .SecsForFullCharge = float(8),
  150.                 .KiPerStep = float(6),
  151.                 .CanMove = false);
  152.    
  153.     addSpecialCharge(   .ControlSequence = IN_ATTACK2,
  154.                 .SecsForFullCharge = float(1),
  155.                 .KiPerStep = float(0),
  156.                 .CanMove = true);
  157.    
  158.     __sx_Mafuba = endSpecialCreation();
  159. }
  160.  
  161. public @CallBackMafuba(__int_Index, CSpecialState:__Status, __int_Control, Float:__float_Charge)
  162. {
  163.     switch(__Status)
  164.     {
  165.         case ssCharge:
  166.         {
  167.             if(__int_Control == IN_ATTACK2)
  168.             {
  169.                 if(@IsPlayerBusy(__int_Index)
  170.                 || getClientINFREEFALL(__int_Index)
  171.                 || @ReturnAnimation(__int_Index, 1))
  172.                 {
  173.                     return SPECIAL_NULREQSTATE;
  174.                 }
  175.                
  176.                 if(__float_Charge == float(-1))
  177.                 {
  178.                     set_pdata_int(__int_Index, 200, false);
  179.                    
  180.                     @StopAnimation(__int_Index, 2);
  181.                 }
  182.                
  183.                 if(__float_Charge == float(0))
  184.                 {
  185.                     set_pdata_int(__int_Index, 200, true);
  186.                    
  187.                     @StartAnimation(__int_Index, 0);
  188.                 }
  189.                
  190.                 if(__float_Charge == 0.300_000 && __int_Capsule & (1 << __int_Index))
  191.                 {
  192.                     emit_sound(__int_Index, CHAN_WEAPON, "weapons/mafuba/capsule_click.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  193.                 }
  194.             }
  195.            
  196.             else
  197.             {
  198.                 if(getClientPOWERUP(__int_Index) && getClientXFROZEN(__int_Index))
  199.                 {
  200.                     setClientFLY(__int_Index, false);
  201.                 }
  202.                
  203.                 if(@IsPlayerBusy(__int_Index)
  204.                 || getClientFLY(__int_Index)
  205.                 || getClientTURBO(__int_Index)
  206.                 || ~entity_get_int(__int_Index, EV_INT_flags) & FL_ONGROUND)
  207.                 {
  208.                     return SPECIAL_NULREQSTATE;
  209.                 }
  210.                
  211.                 if(__float_Charge == 0.050_000)
  212.                 {
  213.                     set_task(0.5, "@fxWorldLight", __int_Index, _, _, "b");
  214.                    
  215.                     message_begin(MSG_ALL, get_user_msgid("Powerup"));
  216.                     {
  217.                         write_byte(__int_Index);
  218.                        
  219.                         write_byte(0);
  220.                         write_byte(0);
  221.                         write_byte(0);
  222.                     }
  223.                     message_end();
  224.                    
  225.                     emit_sound(__int_Index, CHAN_WEAPON, "common/null.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  226.                    
  227.                     emit_sound(__int_Index, CHAN_ITEM, "weapons/powerup.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  228.                 }
  229.                
  230.                 if(__float_Charge == 0.700_000)
  231.                 {
  232.                     set_rendering(__int_Index, kRenderFxGlowShell, 0, _, 0, _, 10);
  233.                 }
  234.                
  235.                 else if(__float_Charge == 0.325_000 || __float_Charge == 0.987_500)
  236.                 {
  237.                     AddFx(__int_Index, "fxBlow");
  238.                     AddFx(__int_Index, "fxScreenShake", float(5), float(1), float(5));
  239.                 }
  240.             }
  241.            
  242.             entity_set_float(__int_Index, EV_FL_fuser2, __float_Charge);
  243.            
  244.             return SPECIAL_VALREQSTATE;
  245.         }
  246.        
  247.         case ssChargeReleased:
  248.         {
  249.             if(__int_Control == IN_ATTACK2)
  250.             {
  251.                 if(__float_Charge >= 0.325_000)
  252.                 {
  253.                     @StartAnimation(__int_Index, 1);
  254.                    
  255.                     if(__int_Capsule & (1 << __int_Index))
  256.                     {
  257.                         @ThrowCapsule(__int_Index, (120 * floatround(__float_Charge * float(10))));
  258.                     }
  259.                    
  260.                     else
  261.                     {
  262.                         client_print(__int_Index, print_center, "You don't have more capsules.");
  263.                     }
  264.                 }
  265.                
  266.                 else
  267.                 {
  268.                     set_pdata_int(__int_Index, 200, false);
  269.                    
  270.                     @StopAnimation(__int_Index, 2);
  271.                 }
  272.             }
  273.            
  274.             else
  275.             {
  276.                 if(__float_Charge >= 0.900_000)
  277.                 {  
  278.                     @CreateMafubaBeamEntity(100, __int_Index, 1.0, 10);
  279.                     emit_sound(__int_Index, CHAN_AUTO, "weapons/mafuba/player_scream.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  280.                 }
  281.                
  282.                 emit_sound(__int_Index, CHAN_ITEM, "common/null.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  283.                
  284.                 @RemoveChargeReferences(__int_Index);
  285.             }
  286.         }
  287.        
  288.         case ssChargeAborted:
  289.         {
  290.             if(__int_Control == IN_ATTACK2)
  291.             {
  292.                 set_pdata_int(__int_Index, 200, false);
  293.                
  294.                 @StopAnimation(__int_Index, 2);
  295.             }
  296.            
  297.             else
  298.             {
  299.                 emit_sound(__int_Index, CHAN_ITEM, "common/null.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  300.                
  301.                 @RemoveChargeReferences(__int_Index);
  302.             }
  303.            
  304.             return SPECIAL_NULREQSTATE;
  305.         }
  306.        
  307.         case ssForceAbort:
  308.         {
  309.             if(__int_Control == IN_ATTACK2)
  310.             {
  311.                 set_pdata_int(__int_Index, 200, false);
  312.                
  313.                 @StopAnimation(__int_Index, 2);
  314.             }
  315.            
  316.             else
  317.             {
  318.                 emit_sound(__int_Index, CHAN_ITEM, "common/null.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  319.                
  320.                 @RemoveChargeReferences(__int_Index);
  321.             }
  322.         }
  323.     }
  324.    
  325.     return SPECIAL_VALREQSTATE;
  326. }
  327.  
  328. public @ThrowCapsule(const __int_Index, const __int_Strengh)
  329. {
  330.     static __int_Entity;
  331.     __int_Entity = create_entity("info_target");
  332.    
  333.     entity_set_string(__int_Entity, EV_SZ_classname, "capsule_jar");
  334.    
  335.     entity_set_model(__int_Entity, "models/capsule.mdl");
  336.    
  337.     DispatchKeyValue(__int_Entity, "health", "10");
  338.    
  339.     entity_set_int(__int_Entity, EV_INT_spawnflags, entity_get_int(__int_Entity, EV_INT_spawnflags) & SF_NORESPAWN);
  340.    
  341.     DispatchSpawn(__int_Entity);
  342.    
  343.     entity_set_float(__int_Entity, EV_FL_nextthink, (get_gametime() + 0.01));
  344.    
  345.     entity_set_float(__int_Entity, EV_FL_scale, 0.6);
  346.    
  347.     entity_set_int(__int_Entity, EV_INT_solid, SOLID_TRIGGER);
  348.    
  349.     entity_set_int(__int_Entity, EV_INT_movetype, MOVETYPE_BOUNCE);
  350.    
  351.     entity_set_size(__int_Entity, Float:{-0.500_000, -0.500_000, -0.500_000}, Float:{0.500_000, 0.500_000, 0.500_000});
  352.    
  353.     static Float:__float_Origin[3], Float:__float_Velocity[3];
  354.     entity_get_vector(__int_Index, EV_VEC_origin, __float_Origin);
  355.     entity_set_origin(__int_Entity, __float_Origin);
  356.    
  357.     velocity_by_aim(__int_Index, __int_Strengh, __float_Velocity);
  358.    
  359.     __float_Velocity[2] += float(100);
  360.    
  361.     entity_set_vector(__int_Entity, EV_VEC_avelocity, Float:{200.0, 400.0, 600.0});
  362.     entity_set_vector(__int_Entity, EV_VEC_velocity, __float_Velocity);
  363.    
  364.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  365.     {
  366.         write_byte(TE_BEAMFOLLOW);
  367.        
  368.         write_short(__int_Entity);
  369.         write_short(__int_Trail);
  370.        
  371.         write_byte(5);
  372.         write_byte(1);
  373.        
  374.         write_byte(255);
  375.         write_byte(255);
  376.         write_byte(255);
  377.        
  378.         write_byte(100);
  379.     }
  380.     message_end();
  381.    
  382.     __int_Capsule &= ~(1 << __int_Index);
  383. }
  384.  
  385. public @SpawnJar(__int_Entity)
  386. {
  387.     if(is_valid_ent(__int_Entity))
  388.     {
  389.         entity_set_model(__int_Entity, "models/ricecooker.mdl");
  390.        
  391.         entity_set_int(__int_Entity, EV_INT_solid, SOLID_BBOX);
  392.        
  393.         entity_set_int(__int_Entity, EV_INT_movetype, MOVETYPE_TOSS);
  394.        
  395.         entity_set_size(__int_Entity, Float:{-0.500_000, -0.500_000, -0.500_000}, Float:{0.500_000, 0.500_000, 0.500_000});
  396.        
  397.         entity_set_float(__int_Entity, EV_FL_scale, float(1));
  398.        
  399.         entity_set_float(__int_Entity, EV_FL_animtime, get_gametime());
  400.         entity_set_float(__int_Entity, EV_FL_framerate, 1.0);
  401.        
  402.         entity_set_int(__int_Entity, EV_INT_effects, EF_MUZZLEFLASH);
  403.        
  404.         entity_set_float(__int_Entity, EV_FL_takedamage, float(1));
  405.        
  406.         static Float:__float_Origin[3], __int_Origin[3];
  407.         entity_get_vector(__int_Entity, EV_VEC_origin, __float_Origin);
  408.         FVecIVec(__float_Origin, __int_Origin);
  409.        
  410.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  411.         {
  412.             write_byte(TE_DLIGHT);
  413.            
  414.             write_coord(__int_Origin[0]);
  415.             write_coord(__int_Origin[1]);
  416.             write_coord(__int_Origin[2]);
  417.            
  418.             write_byte(10);
  419.             write_byte(255);
  420.             write_byte(255);
  421.             write_byte(255);
  422.             write_byte(30);
  423.             write_byte(1);
  424.         }
  425.         message_end();
  426.        
  427.         message_begin(MSG_ALL, 98);
  428.         {
  429.             write_byte(2);
  430.             write_short(__int_Entity);
  431.            
  432.             write_coord(__int_Origin[0]);
  433.             write_coord(__int_Origin[1]);
  434.             write_coord(__int_Origin[2]);
  435.            
  436.             write_short(200);
  437.         }
  438.         message_end();
  439.        
  440.         message_begin(MSG_ALL, 115, __int_Origin);
  441.         {
  442.             write_byte(3);
  443.             write_byte(__int_Entity);
  444.         }
  445.         message_end();
  446.        
  447.         message_begin(MSG_ALL, 106, __int_Origin);
  448.         {
  449.             write_short(__int_Entity);
  450.             write_byte(10);
  451.         }
  452.         message_end();
  453.        
  454.         entity_set_int(__int_Entity, EV_INT_sequence, 1);
  455.        
  456.         emit_sound(__int_Entity, CHAN_WEAPON, "weapons/mafuba/capsule_decompression.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  457.        
  458.         static __int_Use;
  459.         __int_Use = create_entity("func_button");
  460.        
  461.         entity_set_int(__int_Use, EV_INT_movetype, MOVETYPE_FOLLOW);
  462.         entity_set_edict(__int_Use, EV_ENT_aiment, __int_Entity);
  463.        
  464.         entity_set_edict(__int_Use, EV_ENT_euser1, __int_Entity);
  465.        
  466.         entity_set_string(__int_Use, EV_SZ_classname, "mafuba_use");
  467.        
  468.         entity_set_edict(__int_Entity, EV_ENT_euser3, __int_Use);
  469.     }
  470. }
  471.  
  472. public @FM_AddToFullPack(__int_Handle, __int_Edict, __int_Entity, __int_Host, __int_Flags, __int_Player, __int_Set)
  473. {
  474.     if(__int_Player
  475.     && __int_Entity == __int_Host
  476.     && (is_user_alive(__int_Host) && !is_user_bot(__int_Host)))
  477.     {
  478.         if(__int_Sequence[0] & (1 << __int_Entity))
  479.         {
  480.             entity_set_float(__int_Entity, EV_FL_animtime, get_gametime());
  481.             set_es(__int_Handle, ES_Sequence, 90);
  482.             entity_set_float(__int_Entity, EV_FL_framerate, 0.380_000);
  483.            
  484.             if(entity_get_float(__int_Entity, EV_FL_fuser2) == float(1))
  485.             {
  486.                 entity_set_float(__int_Entity, EV_FL_framerate, float(0));
  487.             }
  488.         }
  489.        
  490.         if(__int_Sequence[1] & (1 << __int_Entity))
  491.         {
  492.             entity_set_float(__int_Entity, EV_FL_framerate, float(2));
  493.            
  494.             static Float:__int_Frame[2];
  495.            
  496.             __int_Frame[0] = __int_Frame[1];
  497.             __int_Frame[1] = entity_get_float(__int_Entity, EV_FL_frame);
  498.            
  499.             if(__int_Frame[0] > __int_Frame[1])
  500.             {
  501.                 set_pdata_int(__int_Entity, 200, false);
  502.                
  503.                 @StopAnimation(__int_Entity, 2);
  504.             }
  505.         }
  506.     }
  507.    
  508.     return FMRES_IGNORED;
  509. }
  510.  
  511. public @Think_Jar(__int_Entity)
  512. {
  513.     if(is_valid_ent(__int_Entity))
  514.     {
  515.         if(task_exists(__int_Entity))
  516.         {
  517.             remove_task(__int_Entity);
  518.         }
  519.        
  520.         static Float:__float_Start[3], Float:__float_End[3];
  521.         entity_get_vector(__int_Entity, EV_VEC_origin, __float_Start);
  522.        
  523.         __float_End[0] = __float_Start[0];
  524.         __float_End[1] = __float_Start[1];
  525.         __float_End[2] = (__float_Start[2] - float(9999));
  526.        
  527.         static __int_Trace;
  528.         engfunc(EngFunc_TraceLine, __float_Start, __float_End, IGNORE_MONSTERS, 0, __int_Trace);
  529.        
  530.         static Float:__float_Angles[3];
  531.         get_tr2(__int_Trace, TR_vecPlaneNormal, __float_Angles);
  532.        
  533.         vector_to_angle(__float_Angles, __float_Angles);
  534.        
  535.         __float_Angles[0] -= float(90);
  536.        
  537.         entity_set_vector(__int_Entity, EV_VEC_angles, __float_Angles);
  538.        
  539.         set_task(2.500_000, "@fxLight", __int_Entity);
  540.         set_task(float(3), "@SpawnJar", __int_Entity);
  541.     }
  542. }
  543.  
  544. public @Touch_Jar(__int_Touched, __int_Toucher)
  545. {
  546.     if(is_valid_ent(__int_Toucher))
  547.     {
  548.         static Float:__float_Velocity[3];
  549.         entity_get_vector(__int_Toucher, EV_VEC_velocity, __float_Velocity);
  550.        
  551.         __float_Velocity[0] /= 2.500_000;
  552.         __float_Velocity[1] /= 2.500_000;
  553.         __float_Velocity[2] /= 2.500_000;
  554.        
  555.         entity_set_vector(__int_Toucher, EV_VEC_velocity, __float_Velocity);
  556.        
  557.         entity_set_float(__int_Toucher, EV_FL_nextthink, (get_gametime() + 0.01));
  558.        
  559.         emit_sound(__int_Toucher, random_num(0, 7), "weapons/mafuba/capsule_bounce.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  560.     }
  561. }
  562.  
  563. public @Ham_Use(__int_Entity, __int_Index)
  564. {
  565.     if(entity_get_int(entity_get_edict(__int_Entity, EV_ENT_euser1), EV_INT_iuser3) != 1)
  566.     {
  567.         static __int_Classname[32];
  568.         entity_get_string(__int_Entity, EV_SZ_classname, __int_Classname, sizeof(__int_Classname)-1);
  569.        
  570.         if(equal(__int_Classname, "mafuba_use"))
  571.         {
  572.             emit_sound(__int_Index, CHAN_ITEM, "weapons/mafuba/jar_use.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  573.            
  574.             entity_set_int(entity_get_edict(__int_Entity, EV_ENT_euser1), EV_INT_sequence, entity_get_int(entity_get_edict(__int_Entity, EV_ENT_euser1), EV_INT_sequence) == 0 ? 1 : 0);
  575.         }
  576.     }
  577. }
  578.  
  579. public @Ham_TakeDamage(__int_Victim, __int_Inflictor, __int_Attacker, Float:__float_Damage, __int_Bits)
  580. {
  581.     static __int_Classname[32];
  582.     entity_get_string(__int_Victim, EV_SZ_classname, __int_Classname, sizeof(__int_Classname)-1);
  583.    
  584.     if(equal(__int_Classname, "capsule_jar"))
  585.     {
  586.         if((entity_get_float(__int_Victim, EV_FL_health) - __float_Damage) < float(0))
  587.         {
  588.             SetHamParamFloat(4, float(0));
  589.            
  590.             if(!task_exists(__int_Victim))
  591.             {
  592.                 entity_set_int(__int_Victim, EV_INT_iuser3, 1);
  593.                
  594.                 static __int_Data[2];
  595.                 __int_Data[0] = __int_Victim;
  596.                 __int_Data[1] = __int_Attacker;
  597.                
  598.                 set_rendering(__int_Victim, kRenderFxGlowShell, _, _, _, _, 20);
  599.                
  600.                 set_task(0.5, "@fxLightning", __int_Victim, _, _, "a", 8);
  601.                 set_task(float(5), "@fxKillJar", __int_Victim, __int_Data, 2);
  602.                
  603.                 emit_sound(__int_Victim, CHAN_ITEM, "weapons/mafuba/jar_break.wav", VOL_NORM, ATTN_NORM, 0 ,PITCH_NORM);
  604.             }
  605.         }
  606.     }
  607. }
  608.  
  609. /*==================================================================================================
  610. EFFECTS.
  611. ==================================================================================================*/
  612.  
  613. public @fxKillJar(__int_Data[])
  614. {
  615.     if(is_valid_ent(__int_Data[0]))
  616.     {
  617.         static Float:__float_Origin[3];
  618.         entity_get_vector(__int_Data[0], EV_VEC_origin, __float_Origin);
  619.        
  620.         for(new __int_Models = 0; __int_Models < 3; __int_Models++)
  621.         {
  622.             message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  623.             {
  624.                 write_byte(TE_MODEL);
  625.                 write_coord(floatround(__float_Origin[0]));
  626.                 write_coord(floatround(__float_Origin[1]));
  627.                 write_coord(floatround(__float_Origin[2]));
  628.                
  629.                 write_coord(random_num(random_num(-200, -300), random_num(200, 300)));
  630.                 write_coord(random_num(random_num(-200, -300), random_num(200, 300)));
  631.                 write_coord(random_num(250, 300));
  632.                
  633.                 write_angle(random_num(0, 360));
  634.                
  635.                 write_short(__int_Gibs[__int_Models]);
  636.                 write_byte(0);
  637.                 write_byte(200);
  638.             }
  639.             message_end();
  640.         }
  641.        
  642.         message_begin(MSG_ALL, 98);
  643.         {
  644.             write_byte(2);
  645.             write_short(__int_Data[0]);
  646.            
  647.             write_coord(floatround(__float_Origin[0]));
  648.             write_coord(floatround(__float_Origin[1]));
  649.             write_coord(floatround(__float_Origin[2]));
  650.            
  651.             write_short(60);
  652.         }
  653.         message_end();
  654.        
  655.         if(is_valid_ent(entity_get_edict(__int_Data[0], EV_ENT_euser3)))
  656.         {
  657.             remove_entity(entity_get_edict(__int_Data[0], EV_ENT_euser3));
  658.         }
  659.        
  660.         ExecuteHam(Ham_Killed, __int_Data[0], __int_Data[1], 0);
  661.     }
  662. }
  663.  
  664. public @fxLightning(__int_Entity)
  665. {
  666.     if(is_valid_ent(__int_Entity))
  667.     {
  668.         static Float:__float_Origin[3];
  669.         entity_get_vector(__int_Entity, EV_VEC_origin, __float_Origin);
  670.        
  671.         message_begin(MSG_ALL, SVC_TEMPENTITY);
  672.         {
  673.             write_byte(TE_BEAMPOINTS);
  674.             write_coord(floatround(__float_Origin[0]));
  675.             write_coord(floatround(__float_Origin[1]));
  676.             write_coord(floatround(__float_Origin[2]));
  677.            
  678.             write_coord(floatround(__float_Origin[0] + random_float(-11.0, 11.0)));
  679.             write_coord(floatround(__float_Origin[1] + random_float(-11.0, 11.0)));
  680.             write_coord(floatround(__float_Origin[2] + random_float(0.0, 11.0)));
  681.            
  682.             write_short(__int_Lightning);
  683.            
  684.             write_byte(1);
  685.             write_byte(10);
  686.             write_byte(10);
  687.             write_byte(5);
  688.             write_byte(125);
  689.             write_byte(255);
  690.            
  691.             write_byte(255);
  692.             write_byte(255);
  693.             write_byte(255);
  694.            
  695.             write_byte(150);
  696.         }
  697.         message_end();
  698.     }
  699. }
  700.  
  701. public @fxLight(__int_Entity)
  702. {
  703.     if(is_valid_ent(__int_Entity))
  704.     {
  705.         static Float:__float_Origin[3];
  706.         entity_get_vector(__int_Entity, EV_VEC_origin, __float_Origin);
  707.        
  708.         static __int_Players;
  709.         __int_Players = -1;
  710.        
  711.         while((__int_Players = find_ent_in_sphere(__int_Players, __float_Origin, float(15))))
  712.         {
  713.             if(is_user_alive(__int_Players) && is_user_connected(__int_Players))
  714.             {
  715.                 static Float:__float_Origin[3];
  716.                 entity_get_vector(__int_Players, EV_VEC_origin, __float_Origin);
  717.                
  718.                 __float_Origin[2] += float(100);
  719.                
  720.                 entity_set_origin(__int_Players, __float_Origin);
  721.             }
  722.         }
  723.        
  724.         entity_set_int(__int_Entity, EV_INT_effects, EF_LIGHT);
  725.     }
  726. }
  727.  
  728. public @fxWorldLight(__int_Index)
  729. {
  730.     if(is_user_alive(__int_Index))
  731.     {
  732.         static __int_Origin[3];
  733.         get_user_origin(__int_Index, __int_Origin);
  734.        
  735.         message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, __int_Index);
  736.         {
  737.             write_byte(TE_DLIGHT);
  738.            
  739.             write_coord(__int_Origin[0]);
  740.             write_coord(__int_Origin[1]);
  741.             write_coord(__int_Origin[2]);
  742.            
  743.             write_byte(12);
  744.            
  745.             write_byte(entity_get_float(__int_Index, EV_FL_fuser2) < 0.699_999 ? 255 : 0);
  746.             write_byte(255);
  747.             write_byte(entity_get_float(__int_Index, EV_FL_fuser2) < 0.699_999 ? 255 : 0);
  748.            
  749.             write_byte(255);
  750.             write_byte(floatround(2.500_000));
  751.         }
  752.         message_end();
  753.        
  754.         static Float:__float_Charge;
  755.         __float_Charge = entity_get_float(__int_Index, EV_FL_fuser2);
  756.        
  757.         if(__float_Charge >= 0.325_000)
  758.         {
  759.             set_rendering(.index = __int_Index,
  760.                 .fx = kRenderFxGlowShell,
  761.                 .r = (__float_Charge < 0.700_000 ? 255 : 0),
  762.                 .g = _,
  763.                 .b = (__float_Charge < 0.700_000 ? 255 : 0),
  764.                 .render = kRenderNormal,
  765.                 .amount = (__float_Charge < 0.700_000 ? 6 : 8));
  766.         }
  767.     }
  768. }
  769.  
  770. /*==================================================================================================
  771. POST-USE.
  772. ==================================================================================================*/
  773.  
  774. public @RemoveData(const __int_Index)
  775. {
  776.     @StopAnimation(__int_Index, 2);
  777.    
  778.     __int_Capsule &= ~(1 << __int_Index);
  779.    
  780.     if(is_valid_ent(entity_get_edict(__int_Index, EV_ENT_euser1)))
  781.     {
  782.         remove_entity(entity_get_edict(__int_Index, EV_ENT_euser1));
  783.     }
  784. }
  785.  
  786. public @IsPlayerBusy(const __int_Index)
  787. {
  788.     if(getClientPOWERUP(__int_Index) && !getClientXFROZEN(__int_Index)
  789.     || getClientSWOOPING(__int_Index)
  790.     || getClientBLOCK(__int_Index)
  791.     || getClientATKSHOOT(__int_Index)
  792.     || getClientMELEE(__int_Index)
  793.     || getClientMELEEPUSHBACK(__int_Index)
  794.     || getClientTHROWAWAY(__int_Index)
  795.     || getClientTHROW(__int_Index)
  796.     || getClientWALLGND(__int_Index))
  797.     {
  798.         return 1;
  799.     }
  800.    
  801.     return 0;
  802. }
  803.  
  804. public @RemoveChargeReferences(const __int_Index)
  805. {
  806.     if(task_exists(__int_Index))
  807.     {
  808.         remove_task(__int_Index);
  809.     }
  810.    
  811.     message_begin(MSG_ALL, get_user_msgid("StopPowerup"));
  812.     {
  813.         write_byte(__int_Index);
  814.     }
  815.     message_end();
  816.    
  817.     set_rendering(__int_Index, kRenderFxNone, _, _, _, kRenderNormal);
  818. }
  819.  
  820. public @ReturnAnimation(const __int_Index, const __int_Wich)
  821. {
  822.     return (__int_Sequence[__int_Wich] & (1 << __int_Index)); // Handle.
  823. }
  824.  
  825. public @StartAnimation(const __int_Index, const __int_Wich)
  826. {
  827.     if(__int_Wich == 0) // Hold.
  828.     {
  829.         __int_Sequence[0] |= (1 << __int_Index);
  830.     }
  831.    
  832.     else // Throw.
  833.     {
  834.         __int_Sequence[1] |= (1 << __int_Index);
  835.     }
  836. }
  837.  
  838. public @StopAnimation(const __int_Index, const __int_Wich)
  839. {
  840.     if(__int_Wich == 0) // Hold.
  841.     {
  842.         __int_Sequence[0] &= ~(1 << __int_Index);
  843.     }
  844.    
  845.     else if(__int_Wich == 1) // Throw.
  846.     {
  847.         __int_Sequence[1] &= ~(1 << __int_Index);
  848.     }
  849.    
  850.     else // Both.
  851.     {
  852.         __int_Sequence[0] &= ~(1 << __int_Index);
  853.         __int_Sequence[1] &= ~(1 << __int_Index);
  854.     }
  855. }
  856.  
  857. /*==================================================================================================
  858. END OF THE SPECIAL.
  859. ==================================================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement