DarkGL, dzięki za poprawki i kod ze zmiennymi statycznymi.
BarTime
stock CreateBartime(id, duration)
{
static get_msgid;
if( !get_msgid ) get_msgid = get_user_msgid( "BarTime" );
message_begin( !id ? MSG_ALL : MSG_ONE , get_msgid , {0,0,0} , id )
write_short(duration);
message_end();
}
Przykładowe użycie:
CreateBartime(id, 50)
Czas podajemy w sekundach (liczba int).
BarTime2
stock CreateBartime2(id, duration, startprogress)
{
if( startprogress >= 0 && startprogress <=100 )
{
static get_msgid;
if( !get_msgid ) get_msgid = get_user_msgid( "BarTime2" );
message_begin( !id ? MSG_ALL : MSG_ONE , get_msgid, {0,0,0} , id )
write_short(duration);
write_short(startprogress);
message_end();
}
}
Przykładowe użycie:
CreateBartime2(id, 50, 80)
Czas podajemy w sekundach (liczba int).
Trzeci argument to od ilu % ma zaczynać się BarTime2. Pamiętajmy, że nie istnieje w matematyce coś takiego jak 101% i więcej.
HideWeapon
Dzięki tej wiadomości możemy usuwać różne elementy HUD-a
stock SetDisplayHUD(id, flaga)
{
static get_msgid;
if( !get_msgid ) get_msgid = get_user_msgid( "HideWeapon" );
message_begin( !id ? MSG_ALL : MSG_ONE , get_msgid , {0,0,0} , id )
write_byte(flaga);
message_end();
}
Przykład użycia:
SetDisplayHUD(id, (1<<2))
Co do drugiego argumentu to:
1 (1<<0) - crosshair, ammo, weapons list 2 (1<<1) - flashlight, + 4 (1<<2) - ALL 8 (1<<3) - radar, health, armor, + 16 (1<<4) - timer, + 32 (1<<5) - money, + 64 (1<<6) - crosshair 128 (1<<7) - + źródło: wiki.amxmodx.orgWedług mnie na Speedruny/Deathruny przydaje się numer 4 czyli (1<<2).
ScoreAttrib
Wiadomość pozwala zmienić stan, DEAD, BOMB lub VIP.
stock SetStance(pid, flags)
{
static get_msgid;
if( !get_msgid ) get_msgid = get_user_msgid( "ScoreAttrib" );
message_begin(MSG_ALL, get_msgid,{0,0,0});
write_byte(pid);
write_byte(flags);
message_end();
}
Przykład użycia:
SetStance(id, (1<<0));
Co do drugiego parametru:
0 - brak statusu
(1<<0) - DEAD
(1<<1) - BOMB
(1<<2) - VIP
Zamierzam dodać jeszcze kilka stocków z różnymi wiadomościami
Jeżeli id w stoku ma stan false czyli id <= 0 to msg jest MSG_ALL, jeżeli true to MSG_ONE