←  Pytania

AMXX.pl: Support AMX Mod X i SourceMod

»

CoD Stary
Kolorowanie ekranu przeciwnika ? Moc ?

Kolar`.'s Photo Kolar`. 09.11.2011

Czy stąd - http://darkgl.amxx.p...-ekranu-gracza/, dało by się zrobić moc dla klasy/itemu ?

Np. 1/x że przeciwnik będzie miał "pokolorowany" ekran.

ref
Quote

  • +
  • -
Fili:P's Photo Fili:P 10.11.2011

Tak, najpierw losujesz liczbę od 1 do x i sprawdzasz, jeżeli liczba równa się y. W warunku tworzysz wiadomość:

message_begin(MSG_ONE_UNRELIABLE, gmsgScreenFade, _, id);
write_short(1<<12);
write_short(1<<12);
write_short(1<<12);
write_byte(red);
write_byte(green);
write_byte(blue);
write_byte(alpha);
message_end();

Oczywiście zamieniamy wartości.

Źródło BF2 MOD:

public screen_flash(id,red,green,blue,alpha)
{
message_begin(MSG_ONE_UNRELIABLE, gmsgScreenFade, _, id);
write_short(1<<12);
write_short(1<<12);
write_short(1<<12);
write_byte(red);
write_byte(green);
write_byte(blue);
write_byte(alpha);
message_end();
}
Quote

Kolar`.'s Photo Kolar`. 10.11.2011

Możesz po prostu powiedzieć jak dodać tę moc ? ;x
Quote

  • +
  • -
radim's Photo radim 10.11.2011

1. Szukasz public Damage(id) i tam dodajesz
if(informacje_przedmiotu_gracza[attacker][0] == xx && random_num(1, y) == 1)
        Display_Fade(id,1<<14,1<<14 ,1<<16,255,155,50,230);
xx - numer itemu
y - losowa wartość 1/y
2. Na koniec sma
stock Display_Fade(id,duration,holdtime,fadetype,red,green,blue,alpha)
{
    if (is_valid_ent(id))
    {
        message_begin( MSG_ONE, g_msg_screenfade,{0,0,0},id );
        write_short( duration ); // Duration of fadeout
        write_short( holdtime ); // Hold time of color
        write_short( fadetype ); // Fade type
        write_byte ( red ); // Red
        write_byte ( green ); // Green
        write_byte ( blue ); // Blue
        write_byte ( alpha ); // Alpha
        message_end();
    }
}
3. Do zmiennych globalnych:
new g_msg_screenfade;
4. Do plugin_init:
g_msg_screenfade = get_user_msgid("ScreenFade");
Quote