PHP- Kodu:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "Hp Kontrol"
#define VERSION "1.0"
#define AUTHOR "K4DavRa"
new sounds[] = "kalpatisi.wav"
#define FFADE_IN 0x0000
#define FFADE_OUT 0x0001
#define FFADE_MODULATE 0x0002
#define FFADE_STAYOUT 0x0004
enum {
Red,
Green,
Blue
};
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public client_authorized(id)
{
set_task(1.0, "Can", id, _, _, "b")
}
public plugin_precache()
{
precache_sound(sounds)
}
public Can(id)
{
if(is_user_connected(id) && is_user_alive(id) )
{
new Hp;
Hp = get_user_health(id)
if( Hp < 95) {
client_cmd(id,"spk sound/kalpatisi")
set_user_health(id,get_user_health(id) + 1)
switch(random_num(1,3))
{
case 1:
{
UTIL_ScreenFade(id, {100,0,0}, 0.4, 0.1, 230, FFADE_OUT | FFADE_STAYOUT, false,false)
}
case 2:
{
UTIL_ScreenFade(id, {100,0,0}, 0.7, 0.1, 230, FFADE_IN, false,false)
}
case 3:
{
UTIL_ScreenFade(id,{100,0,0},1.0,0.2,255,FFADE_IN,false,false)
}
}
}
}
}
stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=FFADE_IN,bool:bReliable=false,bool:bExternal=false)
{
if( id && !is_user_connected(id))
return;
new iFadeTime;
if( flFxTime == -1.0 )
{
iFadeTime = 4;
}
else
{
iFadeTime = FixedUnsigned16( flFxTime , 1<<12 );
}
static gmsgScreenFade;
if( !gmsgScreenFade )
{
gmsgScreenFade = get_user_msgid("ScreenFade");
}
new MSG_DEST;
if( bReliable )
{
MSG_DEST = id ? MSG_ONE : MSG_ALL;
}
else
{
MSG_DEST = id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST;
}
if( bExternal )
{
emessage_begin( MSG_DEST, gmsgScreenFade, _, id );
ewrite_short( iFadeTime );
ewrite_short( FixedUnsigned16( flHoldTime , 1<<12 ) );
ewrite_short( iFlags );
ewrite_byte( iColor[Red] );
ewrite_byte( iColor[Green] );
ewrite_byte( iColor[Blue] );
ewrite_byte( iAlpha );
emessage_end();
}
else
{
message_begin( MSG_DEST, gmsgScreenFade, _, id );
write_short( iFadeTime );
write_short( FixedUnsigned16( flHoldTime , 1<<12 ) );
write_short( iFlags );
write_byte( iColor[Red] );
write_byte( iColor[Green] );
write_byte( iColor[Blue] );
write_byte( iAlpha );
message_end();
}
}
stock FixedUnsigned16(Float:flValue, iScale)
{
new iOutput;
iOutput = floatround(flValue * iScale);
if ( iOutput < 0 )
iOutput = 0;
if ( iOutput > 0xFFFF )
iOutput = 0xFFFF;
return iOutput;
}