Senior Member
Join Date: Apr 2012
Location: Copenhagen, Denmark
|
06-14-2015
, 23:44
Fix for paintball plugin
|
#1
|
Hello, anyone can help to fix this plugin? please
This plugin works only with pistols (without deagle) all SMG and all SHOUTGUNS, with RIFLES and MACHINE GUN doesn't work and i can't fix it by myself
PHP Code:
#include <amxmodx>
#include <engine>
#pragma semicolon 1
#define MAX_COLORS 9
new g_paintSprite[2][] = { "sprites/bhit.spr", "sprites/richo1.spr" };
new g_paintColors[MAX_COLORS][3] = {
{ 255, 255, 255 }, // white
{ 255, 0, 0 }, // red
{ 0, 255, 0 }, // green
{ 0, 0, 255 }, // blue
{ 255, 255, 0 }, // yellow
{ 255, 0, 255 }, // magenta
{ 0, 255, 255 }, // cyan
{ 255, 20, 147 }, // pink
{ 255, 165, 0 } // orange
};
new lastwpn[33], lastammo[33];
new pcvar_pb, pcvar_pb_rndcol;
new bool:paintball, bool:pb_rndcolor;
public plugin_init( )
{
register_plugin( "Paint Ball", "0.21", "KRoTaL" );
pcvar_pb = register_cvar( "paintball", "1" );
pcvar_pb_rndcol = register_cvar( "paintball_randomcolor", "1" );
register_event( "CurWeapon", "make_paint", "be");
register_logevent( "new_round", 2, "0=World triggered", "1=Round_Start" );
}
public plugin_precache( )
{
precache_model( "sprites/bhit.spr" );
precache_model( "sprites/richo1.spr" );
}
stock worldInVicinity( Float:origin[3] )
{
new ent = find_ent_in_sphere( -1, origin, 4.0 );
while( ent > 0 )
{
if( entity_get_float( ent, EV_FL_health ) > 0.0 || entity_get_float( ent, EV_FL_takedamage ) > 0.0 )
return 0;
ent = find_ent_in_sphere( ent, origin, 4.0 );
}
new Float:traceEnds[8][3], Float:traceHit[3], hitEnt;
traceEnds[0][0] = origin[0] - 2.0;
traceEnds[0][1] = origin[1] - 2.0;
traceEnds[0][2] = origin[2] - 2.0;
traceEnds[1][0] = origin[0] - 2.0;
traceEnds[1][1] = origin[1] - 2.0;
traceEnds[1][2] = origin[2] + 2.0;
traceEnds[2][0] = origin[0] + 2.0;
traceEnds[2][1] = origin[1] - 2.0;
traceEnds[2][2] = origin[2] + 2.0;
traceEnds[3][0] = origin[0] + 2.0;
traceEnds[3][1] = origin[1] - 2.0;
traceEnds[3][2] = origin[2] - 2.0;
traceEnds[4][0] = origin[0] - 2.0;
traceEnds[4][1] = origin[1] + 2.0;
traceEnds[4][2] = origin[2] - 2.0;
traceEnds[5][0] = origin[0] - 2.0;
traceEnds[5][1] = origin[1] + 2.0;
traceEnds[5][2] = origin[2] + 2.0;
traceEnds[6][0] = origin[0] + 2.0;
traceEnds[6][1] = origin[1] + 2.0;
traceEnds[6][2] = origin[2] + 2.0;
traceEnds[7][0] = origin[0] + 2.0;
traceEnds[7][1] = origin[1] + 2.0;
traceEnds[7][2] = origin[2] - 2.0;
for ( new i = 0; i < 8; i++ )
{
if ( PointContents( traceEnds[i] ) != CONTENTS_EMPTY )
return 1;
hitEnt = trace_line( 0, origin, traceEnds[i], traceHit );
if ( hitEnt != -1 )
return 1;
for ( new j = 0; j < 3; j++ )
{
if ( traceEnds[i][j] != traceHit[j] )
return 1;
}
}
return 0;
}
public make_paint( id )
{
new wpn = read_data( 2 );
new ammo = read_data( 3 );
if( paintball && lastwpn[id] == wpn && lastammo[id] > ammo )
{
new iOrigin[3];
get_user_origin( id, iOrigin, 4 );
new Float:fOrigin[3];
IVecFVec( iOrigin, fOrigin );
if( entity_count( ) < ( get_global_int( GL_maxEntities ) - 100 ) && worldInVicinity( fOrigin ) )
{
new ent = create_entity( "info_target" );
if( ent > 0 )
{
entity_set_string( ent, EV_SZ_classname, "paint_ent" );
entity_set_int( ent, EV_INT_movetype, 0 );
entity_set_int( ent, EV_INT_solid, 0 );
entity_set_model( ent, g_paintSprite[random_num( 0, 1 )] );
new r, g, b;
if( ! pb_rndcolor )
{
new i = random_num( 0, MAX_COLORS - 1 );
r = g_paintColors[i][0];
g = g_paintColors[i][1];
b = g_paintColors[i][2];
}
else
{
r = random_num( 64, 255 );
g = random_num( 64, 255 );
b = random_num( 64, 255 );
}
set_rendering( ent, kRenderFxNoDissipation, r, g, b, kRenderGlow, 255 );
entity_set_origin( ent, fOrigin );
}
}
}
lastwpn[id] = wpn;
lastammo[id] = ammo;
}
public new_round( )
{
remove_entity_name( "paint_ent" );
/* Check the cvars on newround */
if ( get_pcvar_num( pcvar_pb ) )
paintball = true;
else
paintball = false;
if ( get_pcvar_num( pcvar_pb_rndcol ) )
pb_rndcolor = true;
else
pb_rndcolor = false;
}
__________________
I Hate people who can hate me !
|
|