Page 1 of 1

win msg

Posted: 2013 Feb 10 17:34
by Spag
Kaip padaryti jog nerodytų tų terrorist win ir counter-terrorist win, o rodytų tik hud žinutes? Nes dabar rodo ir tą ir tą

Code: Select all

#include <amxmodx>#include <amxmisc>#include <dhudmessage> #define PLUGIN "TeamWin + DHUD"#define VERSION "1.0"#define AUTHOR "Opo4uMapy" public plugin_init() {        register_plugin(PLUGIN, VERSION, AUTHOR)         register_event("SendAudio", "ct_win", "a", "2=%!MRAD_ctwin")        register_event("SendAudio", "t_win", "a", "2=%!MRAD_terwin")        register_event("SendAudio", "guards_fail", "a", "2=%!MRAD_rounddraw")     register_dictionary("modas.txt")} public ct_win(){          set_dhudmessage(0, 0, 255, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)    show_dhudmessage(0, "%L", LANG_PLAYER, "ctctctct")} public t_win(){               set_dhudmessage(255, 0, 0, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)    show_dhudmessage(0, "%L", LANG_PLAYER, "ttttt") } public guards_fail(){               set_dhudmessage(255, 255, 255, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)    show_dhudmessage(0, "%L", LANG_PLAYER, "LYGIOSIOS") }

Re: win msg

Posted: 2013 Feb 10 17:47
by Tetusis

Code: Select all

#include <amxmodx>#include <amxmisc>#include <dhudmessage> public plugin_init() {    register_plugin("round events", "v1", ")        // multilang    register_dictionary("modas.txt")        // hook'as    register_message(get_user_msgid("TextMsg"), "round_events")} public round_events() {    static const ct_win[] = "#CTs_Win"              //"Counter-Terrorists Win!"    static const t_win[] = "#Terrorists_Win"                //"Terrorists Win!"    static const round_draw[] = "#Round_Draw"           //"Round Draw!"        static msg[64]    get_msg_arg_string(2, msg, charsmax(msg))                   if (equali(msg, ct_win)) {        // istrinam        set_msg_arg_string(2, "")                set_dhudmessage(0, 0, 255, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)        show_dhudmessage(0, "%L", LANG_PLAYER, "ctctctct")    }            else if (equali(msg, t_win)) {        // istrinam        set_msg_arg_string(2, "")                set_dhudmessage(255, 0, 0, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)        show_dhudmessage(0, "%L", LANG_PLAYER, "ttttt")     }            else if (equali(msg, round_draw)) {        // istrinam        set_msg_arg_string(2, "")                set_dhudmessage(255, 255, 255, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)        show_dhudmessage(0, "%L", LANG_PLAYER, "LYGIOSIOS")     }} 

Re: win msg

Posted: 2013 Feb 10 21:25
by Spag
Tetusis wrote:

Code: Select all

#include <amxmodx>#include <amxmisc>#include <dhudmessage> public plugin_init() {    register_plugin("round events", "v1", ")        // multilang    register_dictionary("modas.txt")        // hook'as    register_message(get_user_msgid("TextMsg"), "round_events")} public round_events() {    static const ct_win[] = "#CTs_Win"              //"Counter-Terrorists Win!"    static const t_win[] = "#Terrorists_Win"                //"Terrorists Win!"    static const round_draw[] = "#Round_Draw"           //"Round Draw!"        static msg[64]    get_msg_arg_string(2, msg, charsmax(msg))                   if (equali(msg, ct_win)) {        // istrinam        set_msg_arg_string(2, "")                set_dhudmessage(0, 0, 255, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)        show_dhudmessage(0, "%L", LANG_PLAYER, "ctctctct")    }            else if (equali(msg, t_win)) {        // istrinam        set_msg_arg_string(2, "")                set_dhudmessage(255, 0, 0, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)        show_dhudmessage(0, "%L", LANG_PLAYER, "ttttt")     }            else if (equali(msg, round_draw)) {        // istrinam        set_msg_arg_string(2, "")                set_dhudmessage(255, 255, 255, 0.30, 0.30, 0, 6.0, 6.0, 0.5, 0.15)        show_dhudmessage(0, "%L", LANG_PLAYER, "LYGIOSIOS")     }} 
ačiū, padėjai +karma, o kitaip neįmanoma be tų ištrynimų?

Re: win msg

Posted: 2013 Feb 10 21:36
by hleV
Vietoj ištrynimo galima tiesiog return'int PLUGIN_HANDLED.

Re: win msg

Posted: 2013 Feb 11 00:48
by Spag
hleV wrote:Vietoj ištrynimo galima tiesiog return'int PLUGIN_HANDLED.
gali parodyti kaip tai atrodo? Bei su plugin_handled galbūt labiau optimizuota?

Re: win msg

Posted: 2013 Feb 11 15:22
by hleV
Išimk visus set_msg_arg_string() ir visų trijų if'ų pabaigose darašyk return PLUGIN_HANDLED. O pačios funkcijos pabaigoj return PLUGIN_CONTINUE. Teoriškai čia šiek tiek geresnis būdas.

Re: win msg

Posted: 2013 Feb 11 16:10
by Tetusis
hleV wrote:Išimk visus set_msg_arg_string() ir visų trijų if'ų pabaigose darašyk return PLUGIN_HANDLED. O pačios funkcijos pabaigoj return PLUGIN_CONTINUE. Teoriškai čia šiek tiek geresnis būdas.
+1, teisingai pasakyta, nes pagal mano metoda tik parodome tuscia zinute pries tai pakeitus argumenta, kurios realiai nematome, pagal tavo metoda ja panaikinam, beje ar imanoma butu panaudoti switch - case, vietoi salygu kurios apkrauna? man nepavyko...