Главная | Поиск | Чат | Форум | Рынок | | Регистрация | Вход
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]

Уважаемые пользователи, прежде чем открыть новую тему ознакомьтесь пожалуйста с правилами и воспользуйтесь поиском.

  • Страница 1 из 1
  • 1
Модератор форума: Cooller^_^, Mushroom, Tiger_  
Форум Counter Strike » Плагины для AMXX » Общие вопросы по модам и плагинам » помагите исравить плагин (bullet_damage.amxx)
помагите исравить плагин
mastersstritДата: Среда, 2015-03-04, 17:53 | Сообщение # 1
Сообщений: 55
Награды: 0
смысол в том что помогите поставить что бы показывал урон каторый я наношу а (каторый мне наносят отключить)
вот исходник
/***************************************************************************************************
********************
***********
******
***
* New Bullet Damage with Director Hud Message
*
* All credits return to ArkShine for :
* http://forums.alliedmods.net/showthread.php?t=149210
* And thanks to ConnorMcLeod for a lot of optimizations and take the RGB in one CVAR :
* http://forums.alliedmods.net/showthread.php?t=62224
* Big Thanks to Micapat :D
*
* The victim Hud color : Red
* The attacker Hud color : Green
* When the player does damage to himself, Hud color is Orange
*
* Version : 1.2
* Author : Bboy GruN
*
* *********** Cvars :
* * Bullet Damage Mode :
* - 0 : It just uses the director Hud Message = DEFAULT
* - 1 : It Uses HudMessage when the victim is far from the attacker AND
* when the victim & attacker are near it uses Director Hud Message.
* * Bullet Distance :
* - Only work if Bullet Damage Mode is set to 1, when the attacker and the victim
* are at X distance, we will use HudMessage.
* * Bullet Walls :
* - 0 : Disabled = DEFAULT
* - 1 : Don't show the damage you did when you shot through a wall
* * Bullet Show Spec
* - 0 : Disabled
* - 1 : Show the HudMessage / Director Hud Message to the spectator = DEFAULT
* * Bullet_Hs_Mode
* - 0 : Disabled
* - 1 : Always show Director Hud Message on HeadShot
* - 2 : Show : "HEADSHOT" to : Victim & Attacker = Default
* * Color_RGB_Victim
* - Color of the Message : RGB ( DEFAULT = 255000000 )
* * Color_RGB_Attacker
* - Color of the Message : RGB ( DEFAULT = 000255000 )
* * Color_RGB_Ourself
* - Color of the Message : RGB ( DEFAULT = 255102021 )
*
***
******
***********
********************
***************************************************************************************************/

#include < amxmodx >
#include < engine >
#include < fakemeta_util >
#include < hamsandwich >

#define VERSION "1.4"

new __dhud_color, __dhud_x, __dhud_y, __dhud_effect, __dhud_fxtime, __dhud_holdtime, __dhud_fadeintime,
__dhud_fadeouttime, __dhud_reliable

new Float: Yv[ 33 ] /* Victim*/, Float: Ya[ 33 ] // Attacker
new bool: DidHs[ 33 ], AlreadyRegistered

enum All
{
VictimC, AttackerC, OurselfC, BulletMode, Bullet_Distance, Bullet_Walls, Bullet_ShowSpec,
Bullet_Hs_Mode
}
new pCvar[ All ]

public plugin_init()
{
register_plugin( "Bullet Damage", VERSION, "BboY GruN" )
register_cvar( "Director_bullet_dmg", VERSION, FCVAR_SERVER|FCVAR_SPONLY );

pCvar[ BulletMode ] = register_cvar("Bullet_Damage_Mode", "0" )
pCvar[ Bullet_Distance ] = register_cvar("Bullet_Damage_Distance", "600" )
pCvar[ Bullet_Walls ] = register_cvar("Bullet_Damage_NoShowWalls", "0" )
pCvar[ Bullet_ShowSpec ] = register_cvar("Bullet_Show_Spec", "1" )
pCvar[ Bullet_Hs_Mode ] = register_cvar("Bullet_Hs_Mode", "2" )

pCvar[ VictimC ] = register_cvar("Color_RGB_Victim", "255000000" )
pCvar[ AttackerC ] = register_cvar("Color_RGB_Attacker", "000255000" )
pCvar[ OurselfC ] = register_cvar("Color_RGB_Ourself", "255102021" )

register_event( "Damage", "on_damage", "b", "2!0", "3=0", "4!0" )
RegisterHam( Ham_TraceAttack, "player", "HamTraceAttack" );
AlreadyRegistered = 0
}

public HamTraceAttack( Victim, Attacker, Float:Da, Float:D[ 3 ], Tr_Result, DmgBits )
{
if( get_tr2( Tr_Result, TR_iHitgroup) == HIT_HEAD ) // HeadShot ?
{
DidHs[ Attacker ] = true
}
}

// Director Hud Message, go to : http://forums.alliedmods.net/showthread.php?t=149210 by : ARKSHINE
public on_damage( Victim )
{
new Attacker; Attacker = get_user_attacker( Victim )
if( !is_user_alive( Attacker )
|| ( get_pcvar_num( pCvar[ Bullet_Walls ] ) && !is_visible( Attacker, Victim ) ) )
return PLUGIN_CONTINUE;

new damage, R, G, B, pCvar_H ; damage = read_data( 2 )
pCvar_H = get_pcvar_num( pCvar[ Bullet_Hs_Mode ] )
new AttackerOrigin[ 3 ], VictimOrigin[ 3 ]

if( Attacker != Victim )
{
if( pCvar_H > 0 && DidHs[ Attacker ] )
{
if( pCvar_H == 1 )
{
ShowMessage( Victim, Attacker, damage, 1, "" )
}
else
{
ShowMessage( Victim, Attacker, damage, 3, "HEADSHOT" )
}
}
else
{
if( !get_pcvar_num( pCvar[ BulletMode ] ) )
{
ShowMessage( Victim, Attacker, damage, 1, "" )
}

else
{
get_user_origin( Attacker, AttackerOrigin )
get_user_origin( Victim, VictimOrigin )
if( get_distance( AttackerOrigin, VictimOrigin ) > get_pcvar_num( pCvar[ Bullet_Distance ] ) )
{
ShowMessage( Victim, Attacker, damage, 2, "" )
}
else
{
ShowMessage( Victim, Attacker, damage, 1, "" )
}
}
}

Yv[ Victim ] += 0.05
if( Yv[ Victim ] >= 0.85 )
{
Yv[ Victim ] = 0.50
}
Ya[ Attacker ] += 0.05
if( Ya[ Attacker ] >= 0.90 )
{
Ya[ Attacker ] = 0.55
}
}
else
{
// http://forums.alliedmods.net/showthread.php?t=62224
new iColor = get_pcvar_num( pCvar[ VictimC ] )
R = iColor / 1000000
iColor %= 1000000
G = iColor / 1000
B = iColor % 1000
// http://forums.alliedmods.net/showthread.php?t=62224
set_dhudmessage( R, G, B, -1.0, -1.0, 2, 0.0, 2.0, 0.1, 0.1 )
show_dhudmessage( Victim, "%i", damage )
}
DidHs[ Attacker ] = false
return PLUGIN_CONTINUE;
}

ShowMessage( Victim, Attacker, damage, num, Text[ ] )
{
// http://forums.alliedmods.net/showthread.php?t=62224
new iColor = get_pcvar_num( pCvar[ VictimC ] )
new R[ 2 ], G[ 2 ], B[ 2 ], iAlive, iBot, iPevUser2
R[ 0 ] = iColor / 1000000
iColor %= 1000000
G[ 0 ] = iColor / 1000
B[ 0 ] = iColor % 1000

iColor = get_pcvar_num( pCvar[ AttackerC ] )
R[ 1 ] = iColor / 1000000
iColor %= 1000000
G[ 1 ] = iColor / 1000
B[ 1 ] = iColor % 1000
//http://forums.alliedmods.net/showthread.php?t=62224

new CheckSpec = get_pcvar_num( pCvar[ Bullet_ShowSpec ] )
new Players[ 32 ], iNum
get_players( Players, iNum )
for( new i = 0, id; i < iNum; i++ )
{
id = Players[ i ]
iAlive = is_user_alive( id )
iBot = is_user_bot( id )
iPevUser2 = pev( id, pev_iuser2 )
set_dhudmessage( R[ 1 ], G[ 1 ], B[ 1 ], 0.53, Ya[ Attacker ], 2, 0.0, 1.0, 0.02, 0.02 )
switch( num )
{
case 1:
{
show_dhudmessage( Attacker, "%i", damage ) // Attacker

if( CheckSpec && !iAlive && !iBot
&& iPevUser2 == Attacker )
{
show_dhudmessage( id, "%i", damage )
}

set_dhudmessage( R[ 0 ], G[ 0 ], B[ 0 ], 0.45, Yv[ Victim ], 2, 0.0, 1.0, 0.1, 0.1 )
show_dhudmessage( Victim, "%i", damage ) // Victim

if( CheckSpec && !iAlive && !iBot
&& iPevUser2 == Victim )
{
show_dhudmessage( id, "%i", damage )
}
}
case 2:
{
show_hudmessage( Attacker, "%i", damage ) // Attacker

if( CheckSpec && !iAlive && !iBot
&& iPevUser2 == Attacker )
{
show_hudmessage( id, "%i", damage )
}

set_hudmessage( R[ 0 ], G[ 0 ], B[ 0 ], 0.45, Yv[ Victim ], 2, 0.0, 1.0, 0.1, 0.1, -1 )
show_hudmessage( Victim, "%i", damage ) // Victim

if( CheckSpec && !iAlive && !iBot
&& iPevUser2 == Victim )
{
show_hudmessage( id, "%i", damage )
}
}
case 3:
{
show_dhudmessage( Attacker, "%s", Text ) // Attacker

if( CheckSpec && !iAlive && !iBot
&& iPevUser2 == Attacker )
{
show_dhudmessage( id, "%s", Text )
}

set_dhudmessage( R[ 0 ], G[ 0 ], B[ 0 ], 0.45, Yv[ Victim ], 2, 0.0, 1.0, 0.1, 0.1 )
show_dhudmessage( Victim, "%s", Text ) // Victim

if( CheckSpec && !iAlive && !iBot
&& iPevUser2 == Victim )
{
show_dhudmessage( id, "%s", Text )
}
}
}
}
}

public client_putinserver( id )
{
Ya[ id ] = 0.55
Yv[ id ] = 0.50
DidHs[ id ] = false
if( is_user_bot( id ) )
{
set_task( 0.4, "RegisterHamBots", id )
}
}

public RegisterHamBots( id )
{
if( !is_user_connected( id ) || AlreadyRegistered )
{
return;
}

RegisterHamFromEntity( Ham_TraceAttack, id, "HamTraceAttack" )
AlreadyRegistered = 1
}

// Director Hud Message, go to : http://forums.alliedmods.net/showthread.php?t=149210 by : ARKSHINE

stock set_dhudmessage( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false )
{
#define clamp_byte(%1) ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

__dhud_color = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) );
__dhud_x = _:x;
__dhud_y = _:y;
__dhud_effect = effects;
__dhud_fxtime = _:fxtime;
__dhud_holdtime = _:holdtime;
__dhud_fadeintime = _:fadeintime;
__dhud_fadeouttime = _:fadeouttime;
__dhud_reliable = _:reliable;

return 1;
}

stock show_dhudmessage( index, const message[], any:... )
{
new buffer[ 128 ];
new numArguments = numargs();

if( numArguments == 2 )
{
send_dhudMessage( index, message );
}
else if( index || numArguments == 3 )
{
vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
else
{
new playersList[ 32 ], numPlayers;
get_players( playersList, numPlayers, "ch" );

if( !numPlayers )
{
return 0;
}

new Array:handleArrayML = ArrayCreate();

for( new i = 2, j; i < numArguments; i++ )
{
if( getarg( i ) == LANG_PLAYER )
{
while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {}
j = 0;

if( GetLangTransKey( buffer ) != TransKey_Bad )
{
ArrayPushCell( handleArrayML, i++ );
}
}
}

new size = ArraySize( handleArrayML );

if( !size )
{
vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
else
{
for( new i = 0, j; i < numPlayers; i++ )
{
index = playersList[ i ];

for( j = 0; j < size; j++ )
{
setarg( ArrayGetCell( handleArrayML, j ), 0, index );
}

vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
}

ArrayDestroy( handleArrayML );
}
return 1;
}

stock send_dhudMessage( const index, const message[] )
{
message_begin( __dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index );
{
write_byte( strlen( message ) + 31 );
write_byte( DRC_CMD_MESSAGE );
write_byte( __dhud_effect );
write_long( __dhud_color );
write_long( __dhud_x );
write_long( __dhud_y );
write_long( __dhud_fadeintime );
write_long( __dhud_fadeouttime );
write_long( __dhud_holdtime );
write_long( __dhud_fxtime );
write_string( message );
}
message_end();
}

/***************************************************************************************************
******************** ***** ********************
*********** ***********
****** ******
*** ***
* CHANGE LOG : *
* 1.0 : First *
* 1.1 : Adding Bullet Damage Mode *
* 1.2 : Adding Bullet Damage Walls *
* 1.3 : Spectators see damage *
* 1.4 : Cvar : Bullet_Hs_Mode *
* *
*** ***
****** ******
*********** ***********
******************** ***** ********************
***************************************************************************************************/
 Беларусь
Форум Counter Strike » Плагины для AMXX » Общие вопросы по модам и плагинам » помагите исравить плагин (bullet_damage.amxx)
  • Страница 1 из 1
  • 1
Поиск:
Статистика Форума
Последние темы Читаемые темы Лучшие пользователи Новые пользователи

Админка

(17)

Франшиза кино-кафе "NewTone"

(0)

VIP статус

(4)

Запускаем два сервера на одном компьютере.

(30)

Полная настройка Server.cfg

(7)

Общение ^-^

(9999)

Общение:> (закрыта)

(9999)

Общение :] (закрыта)

(9728)

Флудилочка дизайнеров :)

(5928)

Досчитаем до 10000:)

(4786)

Cooller^_^

(6326)

REDtooth

(2547)

Gep

(2421)

redemaxa

(2162)

cs-strikez

(2010)

Bauyrzhan

(2024-03-27)

timaline

(2024-03-27)

Newtone

(2024-03-26)

Fruger

(2024-03-22)

azik_4884

(2024-03-21)

Популярные