Page 1 of 1

Spalvos

Posted: 2011 Dec 13 16:34
by rotosas
Gal kam nors pasirodys kvailas klausimas, bet kaip padaryti chate spalvotą tekstą?

Code: Select all

client_print(id, print_chat, "cia geltonas | cia zalias")
pvz. kur žalia bandžiau su ^x04 bet neveikia:

Code: Select all

client_print(id, print_chat, "cia geltonas | ^x04cia zalias")
Gal kas nors žinot?

Re: Spalvos

Posted: 2011 Dec 13 16:43
by psychical

Code: Select all

new TextText = get_user_msgid("SayText"); stock client_printcolor(const id, const input[], any:...){    new count = 1, players[32];    static msg[191];    vformat(msg,190,input,3);    replace_all(msg,190,"!g","^4");// green txt    replace_all(msg,190,"!y","^1");// orange txt    replace_all(msg,190,"!t","^3");// team txt    if (id) players[0] = id; else get_players(players,count,"ch");    for (new i = 0; i < count; i++)        if (is_user_connected(players[i]))        {            message_begin(MSG_ONE_UNRELIABLE, Text, _, players[i]);            write_byte(players[i]);            write_string(msg);            message_end();        }} 

Code: Select all

client_printcolor(id, "!gZalia | !yGeltonas | !tKomandos spalva");
Kazkas tokio, jei suprasi (kodas ne mano)

Re: Spalvos

Posted: 2011 Dec 13 17:00
by rotosas
Dėkui, kodą suprantu. O įmanoma jį kaip nors trumpesnį padaryt, kad kuo mažiau apkrovos būtų?

Re: Spalvos

Posted: 2011 Dec 13 17:26
by psychical
kad kodas ilgas nereiskia kad apkrova didele, galima parasyt ilga koda, bt jis buziau apkraunamas nei trumpas kodas kuriame bus visko daug, taciau visaks sugrusta...

Re: Spalvos

Posted: 2011 Dec 13 17:57
by aaarnas
Šitas pakankamai optimizuotas. Nereikia nieko daugiau tvarkyti.
Nebent is_user_connected(players) galima išimti, nes jis čia nereikalingas. get_players tą patikrina.

Be to šis nepalaiko Multilangual. Jei reikia su multilangual, tada kitoks turėtų būti.

Re: Spalvos

Posted: 2011 Dec 13 18:02
by psychical
nu multilangual tai gerai ir colochat includas

Re: Spalvos

Posted: 2011 Dec 14 17:39
by rotosas
O kaip su colorchat includu padaryt?

Re: Spalvos

Posted: 2011 Dec 14 18:45
by psychical

Code: Select all

#include <ColorChat> ColorChat(id, RED, "ka nori ta rasai")
RED vietoje gali but: RED, BLUE, GREEN, WHITE ir ORANGE jei teisingai atsimenu

Dar kazkokiu principu veikia ir ^x04 tik kokiu, nezinau

P.S. Prikabinu colorchat faila

Re: Spalvos

Posted: 2011 Dec 14 18:56
by hleV

Code: Select all

    NORMAL = 1, // clients scr_concolor cvar color    GREEN, // Green Color    TEAM_COLOR, // Red, grey, blue    GREY, // grey    RED, // Red    BLUE, // Blue