Advertisement
GaMeRFoReVeR

Bonus Box Edit

May 28th, 2015
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.48 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < engine >
  5. #include < fakemeta_util >
  6. #include < cstrike >
  7. #include < colorchat>
  8.  
  9. #define PLUGIN "Bonus Box v2"
  10. #define VERSION "1.0"
  11. #define AUTHOR "MegastorM"
  12.  
  13. #define TASK_BONUS 1234
  14.  
  15. new modell[] = { "models/box/w_bonus.mdl" }
  16. new const szPrefix[15] = "[Bonus Box v2]"
  17. new g_sprite
  18. new Float:OriginZrtve[3], Float:Uglovi[3]
  19.  
  20. public plugin_init() {
  21.         register_plugin(PLUGIN, VERSION, AUTHOR)
  22.         register_event("DeathMsg", "event_death", "ade");
  23.         register_touch("BonusBox", "player",  "touchbox");
  24.         // Add your code here...
  25. }
  26.  
  27. public plugin_precache()
  28. {
  29.         precache_model(modell)
  30.         g_sprite = precache_model("sprites/box/box_sprite.spr")
  31.         precache_sound("box/supplybox.wav")
  32.         precache_sound("box/touched.wav")
  33. }
  34.  
  35. public event_death()
  36. {
  37.         new victim = read_data(2)
  38.         if(is_user_connected(victim))
  39.         {
  40.                 get_origin(victim)
  41.                
  42.                 set_task(0.1,"create_bonusbox",TASK_BONUS)
  43.         }
  44. }
  45.  
  46. public get_origin(id)
  47. {
  48.         pev(id, pev_origin, OriginZrtve)
  49.         pev(id, pev_angles, Uglovi)
  50.         Uglovi[0] = 0.0
  51. }
  52.  
  53. public create_bonusbox()
  54. {
  55.         new ent = create_entity("info_target")
  56.        
  57.         entity_set_origin(ent, OriginZrtve)
  58.         entity_set_string(ent, EV_SZ_classname, "BonusBox")
  59.         entity_set_model(ent, modell)
  60.         set_rendering ( ent, kRenderFxGlowShell, random_num(128,255),random_num(128,255),random_num(128,255), kRenderFxNone, 255 )
  61.         emit_sound(ent, CHAN_ITEM, "box/supplybox.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
  62.         entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
  63.         entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP)
  64.        
  65.         entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
  66.        
  67.         drop_to_floor(ent)
  68.        
  69.         engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, OriginZrtve, 0)
  70.         write_byte(TE_BEAMCYLINDER) // TE id
  71.         engfunc(EngFunc_WriteCoord, OriginZrtve[0]) // x
  72.         engfunc(EngFunc_WriteCoord, OriginZrtve[1]) // y
  73.         engfunc(EngFunc_WriteCoord, OriginZrtve[2]) // z
  74.         engfunc(EngFunc_WriteCoord, OriginZrtve[0]) // x axis
  75.         engfunc(EngFunc_WriteCoord, OriginZrtve[1]) // y axis
  76.         engfunc(EngFunc_WriteCoord, OriginZrtve[2]+385.0) // z axis
  77.         write_short(g_sprite) // sprite
  78.         write_byte(0) // startframe
  79.         write_byte(0) // framerate
  80.         write_byte(4) // life
  81.         write_byte(30) // width
  82.         write_byte(0) // noise
  83.         write_byte(250) // red
  84.         write_byte(0) // green
  85.         write_byte(0) // blue
  86.         write_byte(200) // brightness
  87.         write_byte(0) // speed
  88.         message_end()
  89. }
  90.  
  91. public touchbox(ent, toucher)
  92. {
  93.         if (!is_user_alive(toucher) || !pev_valid(ent))
  94.                 return FMRES_IGNORED
  95.        
  96.         new classname[32]      
  97.         pev(ent, pev_classname, classname, 31)
  98.         if (!equal(classname, "BonusBox"))
  99.                 return FMRES_IGNORED
  100.        
  101.         Box_H(toucher)
  102.        
  103.         emit_sound(toucher, CHAN_ITEM, "box/touched.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
  104.        
  105.         set_pev(ent, pev_effects, EF_NODRAW)
  106.         set_pev(ent, pev_solid, SOLID_NOT)
  107.         remove_ent(ent)
  108.         return FMRES_IGNORED
  109.        
  110. }
  111.  
  112. public Box_H(id)
  113. {
  114.     switch(random_num(1, 13))
  115.     {
  116.         case 1:
  117.         {
  118.             set_pev(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT)
  119.             fm_give_item(id, "weapon_deagle")
  120.             cs_set_user_bpammo(id, CSW_DEAGLE,35)
  121.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 Desert Eagle+Aura",szPrefix)
  122.         }
  123.         case 2:
  124.         {
  125.             fm_give_item(id, "weapon_ak47")
  126.             cs_set_user_bpammo(id, CSW_AK47,90)
  127.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 AK47",szPrefix)
  128.         }
  129.         case 3:
  130.         {
  131.             fm_give_item(id, "weapon_m4a1")
  132.             cs_set_user_bpammo(id, CSW_M4A1,90)
  133.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 M4A1",szPrefix)
  134.         }
  135.         case 4:
  136.         {
  137.             ColorChat(id, TEAM_COLOR, "^4%s^1 Nazalost,nisi dobio nista,vise srece sledeci put",szPrefix)
  138.         }
  139.         case 5:
  140.         {
  141.             fm_give_item(id, "weapon_sg550")
  142.             cs_set_user_bpammo(id, CSW_SG550,90)
  143.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 SG550",szPrefix)
  144.         }
  145.         case 6:
  146.         {
  147.             fm_give_item(id, "weapon_g3sg1")
  148.             cs_set_user_bpammo(id, CSW_G3SG1,90)
  149.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 G3SG1",szPrefix)
  150.         }
  151.         case 7:
  152.         {
  153.             ColorChat(id, TEAM_COLOR, "^4%s^1 Nazalost,nisi dobio nista,vise srece sledeci put",szPrefix)
  154.         }
  155.         case 8:
  156.         {
  157.             fm_set_user_health(id, get_user_health(id)+250)
  158.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 +250HP",szPrefix)
  159.         }
  160.         case 9:
  161.         {
  162.             fm_set_user_health(id, get_user_health(id)+500)
  163.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 +500HP",szPrefix)
  164.         }
  165.         case 10:
  166.         {
  167.             ColorChat(id, TEAM_COLOR, "^4%s^1 Nazalost,nisi dobio nista,vise srece sledeci put",szPrefix)
  168.         }
  169.         case 11:
  170.         {
  171.             cs_set_user_money(id, cs_get_user_money(id)+1000)
  172.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 +1000$",szPrefix)
  173.         }
  174.         case 12:
  175.         {
  176.             cs_set_user_money(id, cs_get_user_money(id)+5000)
  177.             ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 +5000$",szPrefix)
  178.         }
  179.         case 13:
  180.         {
  181.             cs_set_user_money(id, 0)
  182.             ColorChat(id, TEAM_COLOR, "^4%s^1 Nazalost,izgubio si^3 sve pare",szPrefix)
  183.         }
  184.     }
  185.     return PLUGIN_CONTINUE;
  186. }
  187.  
  188. public remove_ent(ent)
  189. {
  190.         if (pev_valid(ent))
  191.                 engfunc(EngFunc_RemoveEntity, ent)
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement