m513cc | Дата: Пятница, 2014-03-21, 12:44 | Сообщение # 1 |
Сообщений: 1
| Вобщем есть исходник плагина который регенерирует хп у людей надо его дописать чтоб он ещё регенирировал хп у зомби
вот часть исходника #define RECOVERY_HEALTH random_num( 15, 35 ) //Кол-во выдаваемого HP #define MAX_HEALTH 255 // Маквсимальное кол-во HP #define PLAYERS_SEARCH_RADIUS 64 //Радиус поиска
#define CLASSNAME_REC "szRecoverySentry" #define MODEL_SENTRY "models/sentry.mdl" //Модель
#define PRECACHE_MODEL(%0) engfunc( EngFunc_PrecacheModel , %0 ) #define SET_ENTITY(%0) engfunc(EngFunc_CreateNamedEntity , engfunc( EngFunc_AllocString,%0 ) ) #define FFADE_IN 0x0000 #define UNIT_SECOND ( 1 << 12 )
new Float:g_fTSentryVecs[ 1 ][ 3 ]; new gi_TotalSentry ; new gi_Ent; new gi_MsgScreenFade ;
public plugin_init( ) { register_plugin( PLUGIN_NAME , PLUGIN_VERS , PLUGIN_AUTH ); Load_Sentry( ); Spawn_Sentry( ); set_task(1.0, "SetHP", _, _, _, "b"); gi_MsgScreenFade = get_user_msgid( "ScreenFade" ); }
public plugin_precache( ) PRECACHE_MODEL( MODEL_SENTRY );
public Load_Sentry( ) { new filepath; new mapname[32], string[128]; get_mapname(mapname, charsmax(mapname)); format(string, charsmax(string), "addons/amxmodx/configs/%s.sentry.txt", mapname); filepath = fopen(string, "rt"); if(!filepath) { return; } gi_TotalSentry = 0; new pos[3][8]; new buffer[64]; while(!feof(filepath) && gi_TotalSentry < 1 ) { buffer[0] = '^0'; fgets(filepath, buffer, charsmax(buffer)); if(strlen(buffer) < 2 || buffer[0] == ';') { continue; } parse(buffer, pos[0], 7, pos[1], 7, pos[2], 7); g_fTSentryVecs[gi_TotalSentry][0] = str_to_float(pos[0]); g_fTSentryVecs[gi_TotalSentry][1] = str_to_float(pos[1]); g_fTSentryVecs[gi_TotalSentry][2] = str_to_float(pos[2]); gi_TotalSentry++; } fclose(filepath); }
public Spawn_Sentry( ) { if( !gi_TotalSentry ) { return; } static i; for( i = 0 ; i < gi_TotalSentry; i++ ) { Create_Sentry( i ) ; } }
Create_Sentry( i ) { if ( ( gi_Ent = SET_ENTITY ( "info_target" ) ) ) { set_pev ( gi_Ent , pev_classname , CLASSNAME_REC ); engfunc ( EngFunc_SetModel , gi_Ent , MODEL_SENTRY ); engfunc ( EngFunc_SetSize , gi_Ent , Float:{ -8.950000 , -4.810000, -0.180000 }, Float:{ 7.540000, 5.170000, 51.520000 } ); engfunc ( EngFunc_SetOrigin, gi_Ent , g_fTSentryVecs[ i ] ); engfunc ( EngFunc_DropToFloor, gi_Ent ); set_pev ( gi_Ent , pev_solid , SOLID_BBOX ); set_pev ( gi_Ent , pev_movetype , MOVETYPE_PUSHSTEP ); set_pev ( gi_Ent , pev_flags, FL_MONSTER ); UTIL_set_rendering( gi_Ent, kRenderFxGlowShell, 0, 255 , 0, kRenderNormal, 80 ) } }
public SetHP( pId ) { static pId for ( pId = 1; pId <= get_maxplayers( ) ; pId++ ) { if( !is_user_alive( pId ) || zp_get_user_zombie( pId ) ) { continue ; }
static Float:flOrigin[ 3 ]; static Float:flDistance; static Float:flVictimOrigin [ 3 ]; static szClassName[ 32 ] ; static Float:flHealth ;
pev( gi_Ent, pev_classname, szClassName, charsmax( szClassName ) ); pev( gi_Ent, pev_origin, flOrigin ); pev( pId, pev_origin, flVictimOrigin ); pev( pId , pev_health , flHealth );
flDistance = get_distance_f ( flOrigin, flVictimOrigin );
if( !equal( szClassName, CLASSNAME_REC ) ) { continue ; }
if( flDistance <= PLAYERS_SEARCH_RADIUS ) { if( flHealth < MAX_HEALTH ) { set_pev( pId, pev_health, float(pev(pId, pev_health) + RECOVERY_HEALTH )) UTIL_SendScreenFade( pId, UNIT_SECOND * 7 , UNIT_SECOND, FFADE_IN, random_num ( 50, 200 ), random_num ( 50, 200 ), random_num ( 50, 200 ), random_num ( 160, 200 ) ); client_print( pId , print_center , "%d" , RECOVERY_HEALTH ); } } } }
stock UTIL_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static Float:color[3]; color[0] = float(r); color[1] = float(g); color[2] = float(b); set_pev(entity, pev_renderfx, fx); set_pev(entity, pev_rendercolor, color); set_pev(entity, pev_rendermode, render); set_pev(entity, pev_renderamt, float(amount)); }
stock UTIL_SendScreenFade( pPlayer, sDuration = 0, sHoldTime = 0, sFlags = 0, r = 0, g = 0, b = 0, a = 0 ) { message_begin( MSG_ONE_UNRELIABLE, gi_MsgScreenFade, .player = pPlayer ); write_short( sDuration ); write_short( sHoldTime ); write_short( sFlags ); write_byte( r ); write_byte( g ); write_byte( b ); write_byte( a ); message_end( );
только надо чтобы колличество хп выстовлялось отдельно у людей и отдельно у зомби
|
|
| |