Advertisement
macquid123560

Top Jailbreak | Days | Pumpkin

Mar 23rd, 2016
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 13.46 KB | None | 0 0
  1.  
  2. #include <amxmodx>
  3. #include <fun>
  4. #include <hamsandwich>
  5. #include <fakemeta_util>
  6. #include <cstrike>
  7.  
  8. #define PLUGIN "Pumpkin Grenade"
  9. #define VERSION "3.0"
  10. #define AUTHOR "Chrescoe1"
  11.  
  12. //Resource
  13. new const v_model_pumpkin[] =   "models/Top/JB/Days/v_pumpkin.mdl"
  14. new const p_model_pumpkin[] =   "models/Top/JB/Days/p_pumpkin.mdl"
  15. new const w_model_pumpkin[] =   "models/Top/JB/Days/w_pumpkin.mdl"
  16. new const cluster_models[] =    "models/Top/JB/Days/w_pumpkinSmall3.mdl"
  17. new const g_soundexpl[] =       "weapons/pump_exp.wav"
  18. new const blast_sprite[] =   "sprites/shockwave.spr"
  19. new const cluster_trail[] = "sprites/laserbeam.spr"
  20. new const exp_sprite[] =        "sprites/pumpkin_exp.spr"
  21.  
  22. //Settings
  23. const Float:expl_damage =  70.0 // ׃נמם םאםמסטלי דנאםאעמי
  24. const Float:expl_damage_ent = 60.0 // ׃נמם םאםמסטלי וםעטעט \ םןצ
  25. const Float:expl_radius =  240.0 // ׀אהטףס ףנמםא דנאםאע
  26. const Float:cluster_damage = 13.0 // ׃נמם םאםמסטלי מסךמכךאלט
  27. const Float:cluster_damage_ent = 20.0 // ׃נמם םאםמסטלי וםעטעט \ םןצ
  28. const Float:cluster_radius = 140.0 // ׀אהטףס ףנמםא מסךמכמך
  29.  
  30. const cluster_num_min = 15 // ּטם ךמכ-גמ מסךמכךמג
  31. const cluster_num_max = 30 // ּאךס ךמכ-גמ מסךמכךמג
  32. const Float:cluster_rad_min =  250.0 // ּטם נאהטףס נאחכועא מסךמכמך
  33. const Float:cluster_rad_max =  350.0 // ּאךס נאהטףס נאחכועא מסךמכמך
  34. const Float:cluster_up_min =  350.0 // ּטם גחכ¸ע מסךמכךמג גגונץ
  35. const Float:cluster_up_max =  450.0 // ּאךס גחכ¸ע מסךמכךמג גגונץ
  36.  
  37. #define weapon_name "weapon_hegrenade"
  38. #define Bomb_Classname "Pumpkin_Grenade"
  39. #define Cluster_Classname "Pumpkin_ClusterBomb"
  40. #define weaponlist_name "weapon_pumpkin"
  41. #define weaponlist_original "weapon_hegrenade"
  42.  
  43. native is_day();
  44. native get_running_day_pumpkin();
  45.  
  46. native is_lr_active();
  47. native is_user_lr( index );
  48.  
  49. new bool:g_has_pumpkin[32]
  50. new g_sprRing,spriteexpl,g_Trail
  51. new Msg_Weaponlist,Msg_ScreenShake,Msg_ScreenFade
  52. public plugin_precache()
  53. {
  54.     precache_generic( "sprites/weapon_pumpkin.txt" )
  55.     precache_generic( "sprites/640hud41.spr" )
  56.     precache_generic( "sprites/640hud7.spr" )
  57.  
  58.     precache_sound( "weapons/pump_deploy1.wav" )
  59.     precache_sound( "weapons/pump_in1.wav" )
  60.     precache_sound( "weapons/pump_throw1.wav" )
  61.    
  62.     precache_model(w_model_pumpkin)
  63.     precache_model(v_model_pumpkin)
  64.     precache_model(p_model_pumpkin)
  65.     precache_model(cluster_models)
  66.     precache_sound(g_soundexpl)
  67.    
  68.     spriteexpl  = precache_model(exp_sprite)
  69.     g_Trail     = precache_model(cluster_trail)
  70.     g_sprRing   = precache_model(blast_sprite)
  71. }
  72. public plugin_init()
  73. {
  74.     register_plugin(PLUGIN, VERSION, AUTHOR)
  75.    
  76.     Msg_Weaponlist = get_user_msgid("WeaponList")
  77.     Msg_ScreenShake = get_user_msgid("ScreenShake")
  78.     Msg_ScreenFade = get_user_msgid("ScreenFade")
  79.    
  80.     //Ham
  81.     RegisterHam(Ham_Item_AddToPlayer, weapon_name, "Ham_AddToPlayer_Post", 1)
  82.     RegisterHam(Ham_Item_Deploy, weapon_name, "Ham_Item_Deploy_Post", 1)
  83.    
  84.     //Fakemeta
  85.     register_forward(FM_SetModel, "Fakemeta_SetModel")
  86.     register_forward(FM_Touch, "Fakemeta_Touch")
  87.    
  88.     //Hook Weapon
  89.     register_clcmd(weaponlist_name, "hook_weapon")
  90.    
  91.     register_logevent( "evRoundStart", 2, "1=Round_Start" );
  92. }
  93.  
  94. public evRoundStart()
  95. {
  96.     for( new i = 0; i < get_maxplayers(); i++ )
  97.     {
  98.         if( is_user_connected( i ) )
  99.             remove_pumpkin( i );
  100.     }
  101. }
  102.  
  103. public plugin_natives()
  104. {
  105.     register_native( "give_pumpkin__", "_give_pumpkin" );
  106.     register_native( "remove_pumpkin__", "_remove_pumpkin" );
  107. }
  108.  
  109. public _give_pumpkin( plugin, params )
  110. {
  111.     new client = get_param( 1 );
  112.    
  113.     if( is_day() && get_running_day_pumpkin() || is_lr_active() && is_user_lr( client ) )
  114.         give_user_pumpkin( client )
  115. }
  116.  
  117. public _remove_pumpkin( plugin, params )
  118. {
  119.     new client = get_param( 1 );
  120.    
  121.     remove_pumpkin( client );
  122. }
  123.  
  124. public remove_pumpkin( id )
  125.     g_has_pumpkin[ id ] = false;
  126.    
  127. public give_user_pumpkin( id )
  128. {
  129.     if( g_has_pumpkin[ id ] )
  130.         return PLUGIN_HANDLED;
  131.        
  132.     g_has_pumpkin[ id ]= true
  133.    
  134.     give_item( id, "weapon_hegrenade" )
  135.     cs_set_user_bpammo( id, CSW_HEGRENADE, 9999 );
  136.    
  137.     return PLUGIN_HANDLED
  138. }
  139.  
  140.  
  141. public hook_weapon(id){client_cmd(id,weaponlist_original);return PLUGIN_HANDLED;}
  142.  
  143. //Ham
  144. public Ham_AddToPlayer_Post(ent, id)
  145. {
  146.     if(!pev_valid(ent))return HAM_IGNORED  
  147.     //Update WeaponList
  148.     message_begin(MSG_ONE_UNRELIABLE, Msg_Weaponlist, _, id)
  149.     write_string(g_has_pumpkin[id]? weaponlist_name : weaponlist_original)
  150.     write_byte(12)
  151.     write_byte(1)
  152.     write_byte(-1)
  153.     write_byte(-1)
  154.     write_byte(3)
  155.     write_byte(1)
  156.     write_byte(CSW_HEGRENADE)
  157.     write_byte(24)
  158.     message_end()          
  159.     return HAM_HANDLED     
  160. }
  161. public Ham_Item_Deploy_Post(ent)
  162. {
  163.     if(!pev_valid(ent))return
  164.    
  165.     new id = get_pdata_cbase(ent, 41, 4)
  166.    
  167.     if (is_user_alive(id))
  168.     {
  169.         if(g_has_pumpkin[id] )
  170.         {
  171.             if( is_day() && get_running_day_pumpkin())
  172.             {
  173.                 set_pev(id, pev_viewmodel2, v_model_pumpkin)
  174.                 set_pev(id, pev_weaponmodel2, p_model_pumpkin)
  175.             }
  176.         }
  177.     }
  178. }
  179. //Fakemeta
  180. public Fakemeta_SetModel(ent, const Model[])
  181. {
  182.     if( !pev_valid( ent ) )
  183.         return FMRES_IGNORED;
  184.        
  185.     new id = pev( ent, pev_owner )
  186.    
  187.        
  188.     if( is_day() && !get_running_day_pumpkin() )
  189.         return FMRES_IGNORED;
  190.        
  191.     if(equal(Model, "models/w_hegrenade.mdl") ) //If model HE Grenade
  192.     {
  193.         if( g_has_pumpkin[id] ) //if owner has bomb
  194.         {
  195.             Trail(ent,g_Trail,12,8,255,155,55,255)
  196.             set_pev(ent, pev_classname, Bomb_Classname) //Set classname
  197.             set_pev(ent, pev_dmgtime, 9999999.0)        //Block Explode
  198.             engfunc(EngFunc_SetModel, ent, w_model_pumpkin) //Change Model
  199.             return FMRES_SUPERCEDE
  200.         }
  201.     }
  202.     return FMRES_IGNORED   
  203. }
  204. public Fakemeta_Touch(ent, touch)
  205. {
  206.     if(!pev_valid(ent) )
  207.         return HAM_IGNORED;
  208.        
  209.     if( is_day() && !get_running_day_pumpkin() )
  210.         return HAM_IGNORED;
  211.        
  212.     new EntClassname[32],TouchClassname[32]
  213.     pev(ent, pev_classname, EntClassname, sizeof(EntClassname))
  214.    
  215.     if(pev_valid(touch))
  216.         pev(touch, pev_classname, TouchClassname, sizeof(TouchClassname))
  217.    
  218.     if(equal(EntClassname, Bomb_Classname))
  219.     {
  220.         if(pev_valid(touch))
  221.         {
  222.             if(equal(TouchClassname, Cluster_Classname))return HAM_SUPERCEDE
  223.             if(equal(TouchClassname, Bomb_Classname))return HAM_SUPERCEDE
  224.         }
  225.         Pumpkin_Explode(ent)
  226.         return HAM_SUPERCEDE
  227.     }
  228.    
  229.     if(equal(EntClassname, Cluster_Classname))
  230.     {
  231.         if(pev_valid(touch))
  232.         {
  233.             if(equal(TouchClassname, Cluster_Classname))return HAM_SUPERCEDE
  234.             if(equal(TouchClassname, Bomb_Classname))return HAM_SUPERCEDE
  235.         }
  236.         Cluster_Explode(ent)
  237.         return HAM_SUPERCEDE
  238.     }
  239.     return HAM_IGNORED
  240. }
  241. //Public Func
  242. public Pumpkin_Explode(ent)
  243. {
  244.     new Float:ExpOrigin[3],owner= pev(ent, pev_owner)
  245.     pev(ent,pev_origin,ExpOrigin)
  246.        
  247.     engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON,g_soundexpl, 1.0, ATTN_NORM, 0, PITCH_NORM)
  248.    
  249.     //Explode  
  250.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, ExpOrigin, 0)
  251.     write_byte(TE_EXPLOSION)
  252.     engfunc(EngFunc_WriteCoord, ExpOrigin[0])
  253.     engfunc(EngFunc_WriteCoord, ExpOrigin[1])
  254.     engfunc(EngFunc_WriteCoord, ExpOrigin[2]+50.0)
  255.     write_short(spriteexpl)
  256.     write_byte(30)
  257.     write_byte(10)
  258.     write_byte(0)
  259.     message_end()
  260.    
  261.     ExplodeDecals(ExpOrigin)
  262.     Light(ExpOrigin,45,250,150,50,15)  
  263.     Ring(ExpOrigin,20,80)
  264.     Ring(ExpOrigin,40,60)
  265.     Ring(ExpOrigin,60,40)
  266.     Ring(ExpOrigin,80,20)
  267.    
  268.     static victim = -1
  269.     while((victim = engfunc(EngFunc_FindEntityInSphere, victim, ExpOrigin, expl_radius)) != 0)
  270.     {
  271.         if(victim>0&&pev(victim, pev_takedamage)!=DAMAGE_NO&&pev(victim, pev_solid)!=SOLID_NOT)
  272.         {  
  273.             if(is_user_connected(victim))
  274.             {
  275.                     ExecuteHamB(Ham_TakeDamage, victim, ent, owner,expl_damage , DMG_NERVEGAS),
  276.                     ScreenFadeAndShake(victim)
  277.             }
  278.             else ExecuteHamB(Ham_TakeDamage, victim, ent, owner,expl_damage_ent , DMG_NERVEGAS)
  279.         }
  280.     }
  281.    
  282.     //Make Cluster Grenade
  283.     //Code by Alexander.3 - http://forum.zombielite.ru/index.php?/topic/81-clustergrenade/
  284.     for (new i=0;i<random_num(cluster_num_min,cluster_num_max); i++)
  285.     {  
  286.         new bomb           
  287.         bomb = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))  // ׁמחהאול ‎םעטעט
  288.         engfunc(EngFunc_SetOrigin, bomb, ExpOrigin) // ׃סעאםאגכטגאול ךממנהטםאע הכ סמחהאםםמי ‎םעטעט
  289.         engfunc(EngFunc_SetModel, bomb, cluster_models) // ׃סעאםאגכטגאול למהוכךף
  290.         set_pev(bomb, pev_solid, SOLID_TRIGGER)     // ׁמכטהםמסע סעאגטל םא TRGGGER, קעמ ב םו גחנגאכטס נאםרו םףזםמדמ גנולוםט
  291.         set_pev(bomb, pev_classname, Cluster_Classname) // ׃סעאםאגכטגאול ClassName הכ ןנמגונךט ג Touch ‎גוםעו
  292.         set_pev(bomb, pev_movetype, MOVETYPE_TOSS)  // ׃סעאםאגכטגאול MOVETYPE_TOSS
  293.         set_pev(bomb, pev_owner, pev(ent, pev_owner))   // ׃סעאםאגכטגאול טםהוךס טדנמךא הכ ‎םעטעט
  294.         Util_PlayAnimation(bomb,1,0.6)  //Play Anim
  295.         // ׀אבמעא ס נאחבנמסמל, בףהוע נאםהמלםא ג ןנוהוכו כטלטעא.
  296.         new Float:velocity[3]
  297.         velocity[0] = random_float(-random_float(cluster_rad_min,cluster_rad_max), random_float(cluster_rad_min,cluster_rad_max))  
  298.         velocity[1] = random_float(-random_float(cluster_rad_min,cluster_rad_max), random_float(cluster_rad_min,cluster_rad_max))  
  299.         velocity[2] = random_float(-random_float(cluster_rad_min,cluster_rad_max), random_float(cluster_rad_min,cluster_rad_max))+ random_float(cluster_up_min,cluster_up_max)
  300.        
  301.         // ׃סעאםאגכטגאול סטכף נאחכועא מסךמכמך
  302.         set_pev(bomb, pev_velocity, velocity)
  303.        
  304.         new Float: Angles[3]
  305.         Angles[1]=random_float(0.0,360.0)
  306.         set_pev(bomb,pev_angles,Angles)
  307.        
  308.         Trail(bomb,g_Trail,4,4,255,155,55,255)
  309.     }
  310.    
  311.     if( pev_valid( ent ) )
  312.         engfunc(EngFunc_RemoveEntity, ent)
  313. }
  314.  
  315. public Cluster_Explode(ent)
  316. {
  317.     if (!pev_valid( ent ) )
  318.         return;
  319.    
  320.     new Float:ExpOrigin[3],victim = -1
  321.     new owner = pev( ent, pev_owner );
  322.        
  323.     if( is_day() && !get_running_day_pumpkin() )
  324.         return;
  325.    
  326.     pev(ent, pev_origin, ExpOrigin)
  327.    
  328.     Ring(ExpOrigin,20,40)
  329.     Ring(ExpOrigin,40,20)
  330.     Light(ExpOrigin,15,250,150,50,15)
  331.    
  332.     //Explode
  333.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, ExpOrigin, 0)
  334.     write_byte(TE_EXPLOSION)
  335.     engfunc(EngFunc_WriteCoord, ExpOrigin[0])
  336.     engfunc(EngFunc_WriteCoord, ExpOrigin[1])
  337.     engfunc(EngFunc_WriteCoord, ExpOrigin[2] + 15.0)
  338.     write_short(spriteexpl)
  339.     write_byte(5)
  340.     write_byte(10)
  341.     write_byte(0)
  342.     message_end()
  343.    
  344.     while((victim = engfunc(EngFunc_FindEntityInSphere, victim, ExpOrigin, cluster_radius)) != 0)
  345.     {
  346.         if(victim>0&&pev(victim, pev_takedamage)!=DAMAGE_NO&&pev(victim, pev_solid)!=SOLID_NOT)
  347.         {  
  348.             if(is_user_connected(victim))
  349.             {
  350.                     ExecuteHamB(Ham_TakeDamage, victim, ent, pev(ent,pev_owner),cluster_damage , DMG_NERVEGAS),
  351.                     ScreenFadeAndShake(victim)
  352.             }
  353.             else ExecuteHamB(Ham_TakeDamage, victim, ent, pev(ent,pev_owner),cluster_damage_ent , DMG_NERVEGAS)
  354.         }
  355.     }
  356.    
  357.     if( pev_valid( ent) )
  358.         engfunc( EngFunc_RemoveEntity, ent )
  359.    
  360. }
  361.  
  362. //Stocks
  363. stock Trail(ent,sprite,life,size,R,G,B,F)
  364. {
  365.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  366.         write_byte(TE_BEAMFOLLOW)
  367.         write_short(ent)
  368.         write_short(sprite)
  369.         write_byte(life)
  370.         write_byte(size)
  371.         write_byte(R)
  372.         write_byte(G)
  373.         write_byte(B)
  374.         write_byte(F)
  375.         message_end()
  376. }
  377. stock ExplodeDecals(Float:Origin[3])
  378. {
  379.     engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, Origin, 0)
  380.     write_byte(TE_WORLDDECAL)
  381.     engfunc(EngFunc_WriteCoord, Origin[0])
  382.     engfunc(EngFunc_WriteCoord, Origin[1])
  383.     engfunc(EngFunc_WriteCoord, Origin[2])
  384.     write_byte(engfunc(EngFunc_DecalIndex,"{scorch3"))
  385.     message_end()
  386. }
  387.  
  388. stock Light(Float:Origin[3],RAD,R,G,B,Life)
  389. {
  390.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  391.     write_byte(TE_DLIGHT)
  392.     engfunc(EngFunc_WriteCoord, Origin[0])
  393.     engfunc(EngFunc_WriteCoord, Origin[1])
  394.     engfunc(EngFunc_WriteCoord, Origin[2])
  395.     write_byte(RAD) //Radius
  396.     write_byte(R)   // r
  397.     write_byte(G)   // g
  398.     write_byte(B)   // b
  399.     write_byte(Life)    //Life
  400.     write_byte(10)
  401.     message_end()
  402. }
  403. stock Ring(Float:flOrigin[3],Size,width)
  404. {
  405.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flOrigin, 0)
  406.     write_byte(TE_BEAMCYLINDER)         // TE id
  407.     engfunc(EngFunc_WriteCoord, flOrigin[0])        // x
  408.     engfunc(EngFunc_WriteCoord, flOrigin[1])        // y
  409.     engfunc(EngFunc_WriteCoord, flOrigin[2]-20.0)       // z
  410.     engfunc(EngFunc_WriteCoord, flOrigin[0])        // x axis
  411.     engfunc(EngFunc_WriteCoord, flOrigin[1])        // y axis
  412.     engfunc(EngFunc_WriteCoord, flOrigin[2] + Size) // z axis
  413.     write_short(g_sprRing)  // sprite
  414.     write_byte(0)       // startframe
  415.     write_byte(0)       // framerate
  416.     write_byte(10)      // life
  417.     write_byte(width)   // width
  418.     write_byte(0)       // noise
  419.     write_byte(255)         // red
  420.     write_byte(155)         // green
  421.     write_byte(55)      // blue
  422.     write_byte(255)         // brightness
  423.     write_byte(0)       // speed
  424.     message_end()
  425. }
  426. stock ScreenFadeAndShake(victim)
  427. {
  428.     // ScreenShake     
  429.     message_begin(MSG_ONE_UNRELIABLE, Msg_ScreenShake, {0,0,0}, victim)
  430.     write_short(1<<14)
  431.     write_short((1<<12) * 8)
  432.     write_short((2<<12) * 7)
  433.     message_end()
  434.            
  435.     //ScreenFade
  436.     message_begin(MSG_ONE_UNRELIABLE, Msg_ScreenFade, _, victim)
  437.     write_short(6<<8)
  438.     write_short(6<<10)
  439.     write_short(1<<1)
  440.     write_byte(255)
  441.     write_byte(155)
  442.     write_byte(55)
  443.     write_byte(255)
  444.     message_end()  
  445. }
  446. stock Util_PlayAnimation(index, sequence, Float: framerate = 1.0)
  447. {
  448.       set_pev(index, pev_animtime, get_gametime())
  449.       set_pev(index, pev_framerate,  framerate)
  450.       set_pev(index, pev_frame, 0.0)
  451.       set_pev(index, pev_sequence, sequence)
  452. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement