SMA:
- | Afiseaza codul
#include <amxmodx> #include <amxmisc> #include <fun> #include <zombie_plague_special> new g_iMsgId_Health; new g_logfile[64]; public plugin_init( ) { register_plugin( "ZP Viata", "0.1", "Exolent" ); register_concmd( "amx_viata", "CmdGive", ADMIN_IMMUNITY, "<NUME> <VIATA>" ); g_iMsgId_Health = get_user_msgid( "Health" ); get_time( "addons/amxmodx/logs/credite_nivel/viata_%Y%m%d.log", g_logfile, charsmax ( g_logfile ) ); } public CmdGive( client, iLevel, iCId ) { if( !cmd_access( client, iLevel, iCId, 3 ) ) { return PLUGIN_HANDLED; } static szArg[ 35 ]; read_argv( 1, szArg, 34 ); new iPlayer = cmd_target( client, szArg, 13 ); if( !iPlayer ) { return PLUGIN_HANDLED; } read_argv( 2, szArg, 5 ); new szText[ 164 ]; new iAmount = str_to_num( szArg ); if( iAmount <= 0 ) { console_print( client, "Suma de HP trebuie sa fie mai mare decat 0!" ); return PLUGIN_HANDLED; } SetHealth( iPlayer, get_user_health( iPlayer ) + iAmount ); static szNames[ 2 ][ 32 ], szAuthids[ 2 ][ 35 ]; get_user_name( client, szNames[ 0 ], 31 ); get_user_authid( client, szAuthids[ 0 ], 34 ); get_user_name( iPlayer, szNames[ 1 ], 31 ); get_user_authid( iPlayer, szAuthids[ 1 ], 34 ); show_activity( client, szNames[ 0 ], "Ai dat %i viata lui %s.", iAmount, szNames[ 1 ] ); formatex( szText, charsmax( szText ),"[ZP VIATA] Admin %s a setat viata de %i lui %s.", szNames, iAmount, szAuthids ); log_amx( "%s<%s> gave %i health to %s<%s>", szNames[ 0 ], szAuthids[ 0 ], iAmount, szNames[ 1 ], szAuthids[ 1 ] ); log_to_file( g_logfile, szText ); return PLUGIN_HANDLED; } stock SetHealth( client, iHealth ) { if( iHealth <= 0 ) { user_kill( client ); } else { set_user_health( client, iHealth ); emessage_begin( MSG_ONE_UNRELIABLE, g_iMsgId_Health, _, client ); ewrite_byte( iHealth ); emessage_end( ); } }