[code]/*
==========================================================================================
*** Exploding bullets ***
author: Nightscream
msn: [email protected]
Version: 1.3
==========================================================================================
Credits: AssKicR( for making greenarrow i used some stuff from there )
Kleenex( for fixing some stuff )
Xavior( adding the BLOCK_SET & BLOCK_NOT deathmessage)
Tupla( for the idea )
Herbster ( telled me the invisible bug)
==========================================================================================
### how to use ###
admin with level A types amx_bullets and everyone gets exploding bullets for a scout
==========================================================================================
### Cvars ###
exploding_bullets <number> here you can set how much exploding bullets everyone gets
sv_sprites 0 now there will be no exploding or tracer sprites
1 now there will be exploding or tracer sprites (default)
==========================================================================================
### Modules ###
Engine required
Fun required
==========================================================================================
### Tested On ###
Listen server | Condition zero | Windows XP | AMXX 1.1
Dedicated server | Counter-Strike 1.6 | Windows XP | AMXX 1.1
==========================================================================================
### Suggestions ###
Got some suggestions
post them in the topic or in pm me
==========================================================================================
### Changelog ###
1.0 Release
1.1 Fixed invisible bug
1.2 You get a frag when you kill someone & sprite disable cvar
1.3 Fixed some minor stuff
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#define PLUGINNAME "Exploding Bullets"
#define VERSION "1.3"
#define AUTHOR "Nightscream"
new bool:has_explbullets = false
new LastWeapon[33] = 0
new LastClipCount[33] = 0
new lastammo[33]
new lastweapon[33]
new bulletsfired[33]
new spr_laser
new spr_laser_impact
new spr_blast_shroom
public plugin_init() {
register_plugin( PLUGINNAME, VERSION, AUTHOR )
register_concmd( "amx_bullets", "bullets_on", ADMIN_LEVEL_A, "Everyone gets exlpoding bullets" )
register_concmd( "amx_unbullets", "unbullets", ADMIN_LEVEL_A, "nobody has exploding bullets" )
register_event( "CurWeapon", "changeweapon", "be", "1=1" )
register_event( "Damage", "EventDamage", "be" )
register_logevent( "event_roundend", 2, "0=World triggered", "1=Round_End" )
register_event( "CurWeapon", "make_tracer", "be", "1=1", "3>0" )
register_cvar( "exploding_bullets", "10" )
register_cvar( "sv_sprites", "1" )
}
public plugin_precache() {
if ( get_cvar_num( "sv_sprites") == 1 ) {
spr_laser = precache_model( "sprites/laserbeam.spr" )
spr_laser_impact = precache_model( "sprites/zerogxplode.spr" )
spr_blast_shroom = precache_model( "sprites/mushroom.spr" )
}
return PLUGIN_CONTINUE
}
public plugin_modules() {
require_module( "Engine" )
require_module( "Fun" )
}
public event_roundend(id) {
if ( has_explbullets == true ) {
new message [200]
format( message, 199, "You have lost your exploding bullets" )
set_hudmessage( 255, 0, 0, 0.35, 0.5, 0, 5.0, 5.0, 0.1, 0.2, 350 )
show_hudmessage( id, message )
bulletsfired[id] = 0
LastWeapon[id]= -1
has_explbullets = false
}
return PLUGIN_HANDLED
}
public unbullets( id, level, cid ) {
if ( !cmd_access( id, level, cid, 1 ) && !is_user_alive( id ) ) {
return PLUGIN_HANDLED
}
has_explbullets = false
new message[200]
format( message, 199, "The ADMIN has taken your exploding bullets away" )
set_hudmessage( 255, 0, 0, 0.35, 0.5, 0, 5.0, 5.0, 0.1, 0.2, 350 )
show_hudmessage( id, message )
return PLUGIN_HANDLED
}
public bullets_on( id, level, cid ) {
if ( !cmd_access( id, level, cid, 1 ) ) {
return PLUGIN_HANDLED
}
if( !is_user_alive( id ) ) return PLUGIN_HANDLED
new clip, ammo, wpnid = get_user_weapon( id, clip, ammo )
if ( wpnid != CSW_SCOUT ) {
new message1[200]
format( message1, 199, "You need a scout to use it" )
set_hudmessage( 255, 0, 0, 0.35, 0.5, 0, 5.0, 5.0, 0.1, 0.2, 350 )
show_hudmessage( id, message1 )
}
has_explbullets = true
bulletsfired[id] = 0
new message2[200]
new bullets = ( get_cvar_num ( "exploding_bullets" ) )
format( message2, 199, "The Admin has given you %d explosion bullets", bullets )
set_hudmessage( 255, 0, 0, 0.35, 0.5, 0, 5.0, 5.0, 0.1, 0.2, 350 )
show_hudmessage( id, message2 )
return PLUGIN_HANDLED
}
public make_tracer(id) {
new weap = read_data(2)
new ammo = read_data(3)
if ( weap == CSW_SCOUT && is_user_alive(id) && has_explbullets == true ) {
if ( lastweapon[id] == 0 ) lastweapon[id] = weap
if ( get_cvar_num( "sv_sprites") == 1 ) {
if ( ( lastammo[id] > ammo ) && ( lastweapon[id] == weap ) ) {
new vector1[3], vector2[3]
get_user_origin( id, vector1, 1 )
get_user_origin( id, vector2, 4 )
// tracer beam
message_begin( MSG_PAS, SVC_TEMPENTITY, vector1 )
write_byte( 0 ) // TE_BEAMPOINTS
write_coord( vector1[0] )
write_coord( vector1[1] )
write_coord( vector1[2] )
write_coord( vector2[0] )
write_coord( vector2[1] )
write_coord( vector2[2] )
write_short( spr_laser ) // laserbeam sprite
write_byte( 0 ) // starting frame
write_byte( 10 ) // frame rate
write_byte( 2 ) // life in 0.1s
write_byte( 4 ) // line width in 0.1u
write_byte( 1 ) // noise in 0.1u
write_byte( 0 ) // red
write_byte( 153 ) // green
write_byte( 0 ) // blue
write_byte( 80 ) // brightness
write_byte( 100 ) // scroll speed
message_end()
// bullet impact explosion
message_begin( MSG_PAS, SVC_TEMPENTITY, vector2 )
write_byte( 3 ) // TE_EXPLOSION
write_coord( vector2[0] ) // end point of beam
write_coord( vector2[1] )
write_coord( vector2[2] )
write_short( spr_laser_impact ) // blast sprite
write_byte( 10 ) // scale in 0.1u
write_byte( 30 ) // frame rate
write_byte( 8 ) // TE_EXPLFLAG_NOPARTICLES
message_end() // ..unless i'm mistaken, noparticles helps avoid a crash
}
}
lastammo[id] = ammo
lastweapon[id] = weap
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public changeweapon(id) {
new weap = read_data(2)
new ammo = read_data(3)
if ( has_explbullets == true && is_user_alive( id ) && weap == CSW_SCOUT ) {
if ( ammo >= LastClipCount[id] ) {
LastClipCount[id]=ammo
return PLUGIN_CONTINUE
}
LastClipCount[id] = ammo
weap = LastWeapon[id]
bulletsfired[id] = ( bulletsfired[id]+1 )
new bullets = ( get_cvar_num ( "exploding_bullets" ) - bulletsfired[id] )
if ( bullets == 0 ) {
new message[200]
format( message, 199, "You have 0 bullets left" )
set_hudmessage( 255, 0, 0, 0.35, 0.5, 0, 5.0, 5.0, 0.1, 0.2, 147 )
show_hudmessage( id, message )
has_explbullets = false
} else {
new message[200]
format( message, 199, "You have %d exploding bullets left", bullets )
set_hudmessage( 255, 0, 0, 0.35, 0.5, 0, 5.0, 5.0, 0.1, 0.2, 147 )
show_hudmessage( id, message )
}
}
return PLUGIN_CONTINUE
}
public EventDamage(id) {
new weapon, bodypart, attacker_id = get_user_attacker( id, weapon, bodypart )
if( !is_user_alive( attacker_id ) ) return PLUGIN_CONTINUE
if ( get_cvar_num ( "exploding_bullets" ) < 0 ) return PLUGIN_CONTINUE
new damage = read_data(2)
if (get_cvar_num( "sv_sprites") == 1 ) {
if( has_explbullets == true && weapon == CSW_SCOUT ) {
new health = get_user_health( id )
if (!is_user_connected( attacker_id ) ) return PLUGIN_CONTINUE
if ( attacker_id == id ) return PLUGIN_CONTINUE
if ( ( ( 1.0 * damage ) / ( 1.0 * (health + damage ) ) ) < 0.01 ) return PLUGIN_CONTINUE
new origin[3]
get_user_origin( id, origin )
set_user_rendering( id, kRenderFxFadeSlow, 255, 255, 255, kRenderTransColor, 250 );
message_begin( MSG_ALL, SVC_TEMPENTITY )
write_byte( 3 ) // TE_EXPLOSION
write_coord( origin[0] )
write_coord( origin[1] )
write_coord( origin[2]-22 )
write_short( spr_blast_shroom ) // mushroom cloud
write_byte( 40 ) // scale in 0.1u
write_byte( 12 ) // frame rate
write_byte( 12 ) // TE_EXPLFLAG_NOPARTICLES & TE_EXPLFLAG_NOSOUND
message_end()
message_begin( MSG_ALL, SVC_TEMPENTITY )
write_byte( 10 ) // TE_LAVASPLASH
write_coord( origin[0] )
write_coord( origin[1] )
write_coord( origin[2]-26 )
message_end()
}
}
if( has_explbullets == true && weapon == CSW_SCOUT ) {
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
user_kill(id, 1)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ),{ 0,0,0 },0 )
write_byte( attacker_id )
write_byte( id )
write_byte( 0 )
write_string( "scout" )
message_end()
}
//new deaths = get_user_deaths( id );
//set_user_deaths( id, deaths+1 )
return PLUGIN_HANDLED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2067\\ f0\\ fs16 \n\\ par }
*/
[/code]