Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < engine >
- #include < fakemeta_util >
- #include < cstrike >
- #include < hamsandwich >
- #pragma semicolon 1
- #define TASK_BOX 1234
- #define HIT_SOUND "debris/metal6.wav"
- /* Constants & Others */
- new Info[ 3 ][ ] ={
- "Galaxy Box",
- "1.0",
- "Avio"
- };
- native get_user_cash(client);
- native set_user_cash(client, cash);
- new szModel[] = "models/w_GalaxyBox.mdl";
- new Float:Uglovi[3];
- public plugin_init() {
- register_plugin( Info[ 0 ], Info[ 1 ], Info[ 2 ] );
- register_event("DeathMsg", "event_death", "a");
- register_event("HLTV", "Event_Roundstart", "a", "1=0", "2=0");
- register_touch("SupplyBox", "player", "touchbox");
- register_clcmd("create_box", "gBox" );
- }
- public plugin_precache(){
- precache_model( szModel );
- precache_sound( HIT_SOUND );
- }
- public Event_Roundstart( )
- {
- remove_task();
- new iEnt = -1;
- while( ( iEnt = find_ent_by_class( iEnt, "SupplyBox" ) ) != 0 )
- {
- remove_entity( iEnt );
- }
- }
- public event_death()
- {
- new szVictim = read_data( 2 );
- setbox( szVictim );
- return 1;
- }
- public gBox( client )
- {
- if ( !( get_user_flags( client ) & ADMIN_IMMUNITY) )
- return ColorChat( client, "You have no^x04 access^x01 to this command." );
- setbox( client );
- return 1;
- }
- public setbox( client )
- {
- static Float:fOrigin[3];
- pev( client, pev_origin, fOrigin );
- pev( client, pev_angles, Uglovi );
- Uglovi[0] = 0.0;
- fOrigin[1] += 35.0;
- create_SupplyBox(fOrigin);
- return 1;
- }
- public create_SupplyBox(Float:origin[3])
- {
- static Float:fMinSize[ 3 ];
- static Float:fMaxSize[ 3 ];
- new iEnt = create_entity("info_target");
- entity_set_origin( iEnt, origin);
- entity_set_vector( iEnt, EV_VEC_angles, Uglovi);
- entity_set_string( iEnt, EV_SZ_classname, "SupplyBox" );
- entity_set_model( iEnt, szModel );
- emit_sound( iEnt, CHAN_AUTO, "items/9mmclip1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
- entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX );
- entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_BOUNCE );
- if( !fMinSize[ 0 ] )
- {
- fMinSize = Float:{ -10.299999, -8.970000, 0.000000 };
- fMaxSize = Float:{ 10.299999, 8.970000, 12.760000 };
- }
- entity_set_size( iEnt, fMinSize, fMaxSize );
- entity_set_float( iEnt, EV_FL_gravity, 0.85 );
- /* Colors Glow */
- new g_flGlowColor[ 3 ];
- g_flGlowColor[ 0 ] = 50;
- g_flGlowColor[ 1 ] = 250;
- g_flGlowColor[ 2 ] = 50;
- set_rendering ( iEnt, kRenderFxGlowShell, g_flGlowColor[ 0 ], g_flGlowColor[ 1 ], g_flGlowColor[ 2 ], kRenderFxNone, 16 );
- /* Drop to Floor */
- drop_to_floor( iEnt );
- RegisterHamFromEntity( Ham_TraceAttack, iEnt, "OnTraceAttack" );
- return 1;
- }
- public OnTraceAttack( ent )
- {
- engfunc( EngFunc_EmitSound, ent, CHAN_ITEM, HIT_SOUND, 0.5, ATTN_STATIC, 0, PITCH_NORM );
- }
- public touchbox( iEnt, client )
- {
- if ( !is_user_alive( client ) || !pev_valid( iEnt ) )
- return FMRES_IGNORED;
- if( fm_get_user_button( client ) & IN_USE )
- {
- new classname[ 32 ];
- pev( iEnt, pev_classname, classname, 31);
- if (!equal( classname, "SupplyBox"))
- return FMRES_IGNORED;
- gSupplyBoxSub( client );
- set_pev( iEnt, pev_effects, EF_NODRAW);
- set_pev( iEnt, pev_solid, SOLID_NOT);
- remove_ent( iEnt );
- }
- return FMRES_IGNORED;
- }
- public gSupplyBoxSub( client )
- {
- new szRandomCash[ 33 ], g_iMin, g_iMax;
- g_iMin = 100;
- g_iMax = 500;
- szRandomCash[ client ] = random_num( g_iMin, g_iMax );
- set_user_cash(client,get_user_cash(client) + szRandomCash[ client ]);
- ColorChat(0, "^x03%s^x01 picked up the box received^x04 %i^x01 Cash", szName( client ), szRandomCash[ client ] );
- emit_sound( client, CHAN_ITEM, "items/weapondrop1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
- }
- public remove_ent( iEnt )
- {
- if (pev_valid( iEnt ) )
- engfunc( EngFunc_RemoveEntity, iEnt );
- }
- /* Stocks */
- stock szName( index )
- {
- static name[ 32 ];
- get_user_name( index, name, charsmax( name ) );
- return name;
- }
- stock ColorChat( const index, const string[], any:... )
- {
- new szMsg[ 191 ], Players[ 32 ], PNum = 1;
- static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "^x04[AMXX]^x01 " );
- vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
- if ( index )
- Players[ 0 ] = index;
- else
- get_players( Players, PNum, "ch" );
- for ( new i; i < PNum; i++ )
- {
- if( is_user_connected( Players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
- write_byte( Players[ i ] );
- write_string( szMsg );
- message_end( );
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement