Advertisement
macquid123560

Top Jailbreak | Spawn Box

Mar 23rd, 2016
1,206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.57 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <superspawns>
  4. #include <dhudmessage>
  5. #include <fun>
  6. #include <cstrike>
  7.  
  8. native get_user_cash( const index );
  9. native set_user_cash( const index, cash );
  10.  
  11.  
  12. new const gszSupply[] = "Top/JB/spawnbox1";
  13. new const gszSupplyModel[] = "models/Top/JB/FindBox.mdl"
  14.  
  15. new RoundTime, g_iSprite, cvar_spawnchance
  16.  
  17. public plugin_init()
  18. {  
  19.     register_plugin("spawnbox", "v1.0", "@,TheBomB`");
  20.    
  21.     register_logevent("round_start", 2, "1=Round_Start");
  22.     register_logevent("round_end", 2, "1=Round_End");
  23.        
  24.     register_touch(gszSupply, "player", "FwdTouchSupply")
  25.  
  26.     cvar_spawnchance = register_cvar("supply_spawnchance","50")
  27.    
  28.     RoundTime = get_cvar_pointer("mp_roundtime");
  29.        
  30.     SsInit(0.0)
  31.     SsScan()
  32.     SsDump()
  33. }
  34.  
  35. public round_start()
  36. {      
  37.     if (random_num(1, 100) <= get_pcvar_num(cvar_spawnchance))
  38.     {
  39.         new Float:randomTime = random_float(0.0, get_pcvar_float(RoundTime) * 60.0 - 30.0);
  40.         if (!task_exists())
  41.             set_task(randomTime, "DoSomething");
  42.         else
  43.             change_task(_, randomTime);
  44.     }
  45. }
  46.  
  47. public round_end()
  48. {
  49.     remove_task()
  50.    
  51.     new ent = find_ent_by_class(-1, gszSupply);
  52.    
  53.     if(is_valid_ent(ent)) remove_entity(ent);
  54. }  
  55.  
  56. public plugin_precache()
  57. {
  58.     precache_model(gszSupplyModel)
  59.     precache_sound("Top/JB/spawnbox1.wav")
  60.     g_iSprite = precache_model ( "sprites/white.spr" )
  61. }
  62.  
  63. public DoSomething()
  64. {      
  65.     new Float:vOrigin[3]
  66.    
  67.     if(SsGetOrigin(vOrigin))
  68.     {
  69.         new iSupply = create_entity("info_target")
  70.        
  71.         if(!is_valid_ent(iSupply)) return PLUGIN_CONTINUE
  72.        
  73.         entity_set_string(iSupply, EV_SZ_classname, gszSupply)
  74.         entity_set_int(iSupply, EV_INT_solid, SOLID_TRIGGER)
  75.         entity_set_vector(iSupply, EV_VEC_origin, vOrigin)
  76.         entity_set_model(iSupply, gszSupplyModel)
  77.         drop_to_floor(iSupply)
  78.         MakeSprite()
  79.        
  80.         emit_sound( 0 ,CHAN_ITEM, "Top/JB/spawnbox1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM )
  81.         set_dhudmessage(255, 0, 0, -1.0, 0.02, 0, 1.0, 4.0, 0.1, 3.5)
  82.         show_dhudmessage( 0, "The Suprise Box have spawned find it and get Cash!")
  83.         ColorChat(0,"The ^3Suprise Box ^1have spawned find it and ^4get Cash^1!");
  84.     }
  85.    
  86.     return PLUGIN_CONTINUE;
  87. }
  88.  
  89. public MakeSprite()
  90. {
  91.     new Float:Origin[ 3 ]
  92.    
  93.     new iSupply = find_ent_by_class(-1, gszSupply);
  94.     entity_get_vector( iSupply, EV_VEC_origin, Origin );
  95.    
  96.     engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0);
  97.     write_byte ( TE_BEAMCYLINDER )  
  98.    
  99.     engfunc( EngFunc_WriteCoord, Origin[ 0 ] );
  100.     engfunc( EngFunc_WriteCoord, Origin[ 1 ] );
  101.     engfunc( EngFunc_WriteCoord, Origin[ 2 ] );
  102.    
  103.     engfunc( EngFunc_WriteCoord, Origin[ 0 ] );
  104.     engfunc( EngFunc_WriteCoord, Origin[ 1 ] );
  105.     engfunc( EngFunc_WriteCoord, Origin[ 2 ] + 140 );
  106.    
  107.     write_short ( g_iSprite )
  108.     write_byte ( 0 )       
  109.     write_byte ( 1 )           
  110.     write_byte ( 8 )       
  111.     write_byte ( 10 )      
  112.     write_byte ( 1 )       
  113.    
  114.    
  115.     write_byte ( 60 )      
  116.     write_byte ( 30 )      
  117.     write_byte ( 255 ) 
  118.    
  119.     write_byte ( 255 )     
  120.     write_byte ( 0 )           
  121.     message_end ( )
  122.     set_task( 1.0, "MakeSprite")
  123. }  
  124.  
  125. public FwdTouchSupply(iEntity, iPlayer)
  126. {  
  127.     if (cs_get_user_team(iPlayer) == CS_TEAM_T)
  128.     {
  129.         new szName[32]; get_user_name(iPlayer, szName, 31)
  130.         remove_task()
  131.         emit_sound(iPlayer, CHAN_STATIC, "buttons/latchunlocked2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
  132.         remove_entity(iEntity)
  133.        
  134.         new g_num = random_num(1, 3);
  135.        
  136.         if(g_num <= 1)
  137.         {
  138.             set_user_cash( iPlayer, get_user_cash( iPlayer ) + 5000 )
  139.             ColorChat(0,"^3%s ^1has recived^4 5000 ^1cash from ^3Suprise Box",szName);
  140.             return PLUGIN_HANDLED;
  141.         }
  142.         if(g_num <= 2)
  143.         {
  144.             set_user_cash( iPlayer, get_user_cash( iPlayer ) + 10000 )
  145.             ColorChat(0,"^3%s ^1has recived^4 10000 ^1cash from ^3Suprise Box",szName);
  146.             return PLUGIN_HANDLED;
  147.         }
  148.         if(g_num <= 3)
  149.         {
  150.             set_user_cash( iPlayer, get_user_cash( iPlayer ) + 15000 )
  151.             ColorChat(0,"^3%s ^1has recived^4 15000 ^1cash from ^3Suprise Box",szName);
  152.             return PLUGIN_HANDLED;
  153.         }
  154.     }
  155.     return PLUGIN_HANDLED;
  156. }
  157. stock ColorChat(index, const Msg[], {Float, Sql, Result,_}:...) {
  158.     new Buffer[190], Buffer2[192]
  159.     formatex(Buffer2, sizeof(Buffer2)-1, "^4[^1 Cyber ^4]^1 %s", Msg)
  160.     vformat(Buffer, sizeof(Buffer)-1, Buffer2, 3)
  161.     if(!index) {
  162.         for (new i = 1; i <= get_maxplayers(); i++)
  163.         {
  164.             if(!is_user_connected(i))  
  165.                 continue
  166.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, i)
  167.             write_byte(i)
  168.             write_string(Buffer)
  169.             message_end()
  170.         }
  171.     }
  172.     else
  173.     {
  174.         if(!is_user_connected(index))  
  175.             return
  176.         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, index)
  177.         write_byte(index)
  178.         write_string(Buffer)
  179.         message_end()
  180.     }
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement