Poprawienie kodu show_hudmessage
sq69i
31.08.2013
Witam, przerobiłem troszkę plugin tak aby 90 sekund pod koniec rundy wyświetlało następną mapę
Problem mam z tym że owszem i wyświetla ale tylko na 1 sekundę i znika
chce zrobić tak aby tabela Czas i Fragi zniknęła pod koniec rundy a w jej miejsce pojawił się napis następna mapa [nazwa]
Mój kod obecnie wygląda tak
#include <amxmodx> #define PLUGIN "Hud Frags Death" #define VERSION "1.0" #define AUTHOR "Biscuit" new maxplayers new nextmap[33] public plugin_init() { register_plugin( PLUGIN, VERSION, AUTHOR ) maxplayers = get_maxplayers() set_task(1.0,"ShowHud",0,"",0,"b") set_task(90.0,"Mapa",0,"",0,"d") } public ShowHud() { for(new i = 1 ; i <= maxplayers ; i++) { new Time = get_timeleft() new Frags = get_user_frags(i) new Deaths = get_user_deaths(i) set_hudmessage(154,205,50,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(i,"Czas : %d:%02d ^nFragi : %d / %d",Time / 60,Time % 60,Frags,Deaths) } } public Mapa() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(154,205,50,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "nastepna mapa %s!",nextmap) }
tak wiem, że odświeża co jedną sekundę ale serwer jest mały i nie odczuwa się tego
Przyjmij wiadro 31.08.2013
set_hudmessage(154,205,50,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1)
ostatnia liczba, czyli u Ciebie 1 to czas pokazywania wiadomosci HUD, zmien ja na jaka chcesz ( w sekundach ) skompiluj wgraj ponownie na serwer i zmien mape, powinno byc ok
sq69i
31.08.2013
No niestety to nie działa...
wpisałem
public test() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 10) show_hudmessage(0, "test",nextmap) }
i nadal pojawia się na jedną sekundę
kod przerobiłem w ten sposób, działa to troszkę dużo maziania
#include <amxmodx> #define PLUGIN "Hud Frags Death" #define VERSION "1.0" #define AUTHOR "Biscuit" new maxplayers new nextmap[33] public plugin_init() { register_plugin( PLUGIN, VERSION, AUTHOR ) maxplayers = get_maxplayers() set_task(1.0,"ShowHud",0,"",0,"b") set_task(90.0,"Mapa",0,"",0,"d") set_task(89.0,"Mapa2",0,"",0,"d") set_task(88.0,"Mapa3",0,"",0,"d") set_task(87.0,"Mapa4",0,"",0,"d") set_task(30.0,"Mapa5",0,"",0,"d") set_task(29.0,"Mapa6",0,"",0,"d") set_task(28.0,"Mapa7",0,"",0,"d") set_task(27.0,"Mapa8",0,"",0,"d") set_task(5.0,"Mapaa1",0,"",0,"d") set_task(4.0,"Mapaa2",0,"",0,"d") set_task(3.0,"Mapaa3",0,"",0,"d") set_task(2.0,"Mapaa4",0,"",0,"d") set_task(1.0,"Mapaa5",0,"",0,"d") } public ShowHud() { for(new i = 1 ; i <= maxplayers ; i++) { new Time = get_timeleft() new Frags = get_user_frags(i) new Deaths = get_user_deaths(i) set_hudmessage(154,205,50,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(i,"Czas : %d:%02d ^nFragi : %d / %d",Time / 60,Time % 60,Frags,Deaths) } } public Mapa() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "%s za 1:30 minuty",nextmap) } public Mapa2() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "%s za 1:29 minuty",nextmap) } public Mapa3() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "%s za 1:28 minuty",nextmap) } public Mapa4() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "%s za 1:27 minuty",nextmap) } public Mapa5() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "%s za 30 sekund",nextmap) } public Mapa6() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "%s za 29 sekund",nextmap) } public Mapa7() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "%s za 28 sekund",nextmap) } public Mapa8() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "%s za 27 sekund",nextmap) } public Mapaa1() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "Nastepna mapa %s",nextmap) } public Mapaa2() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "Nastepna mapa %s",nextmap) } public Mapaa3() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "Nastepna mapa %s",nextmap) } public Mapaa4() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "Nastepna mapa %s",nextmap) } public Mapaa5() { get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 1) show_hudmessage(0, "Nastepna mapa %s",nextmap) }
Może ma ktoś jakiś pomysł jak to uprościć? czy zostawić tak jak jest?
Przyjmij wiadro 31.08.2013
nie tak
jesli masz teraz taki kod:
set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 10)
to po liczbie (10) odpowiadajacej za czas postaw .0, cos ctakiego:
set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 10.0)
sq69i
31.08.2013
poprawiłem kod na
public test(){ get_cvar_string("amx_nextmap",nextmap,32) set_hudmessage(255,165,0,0.02,0.2,0, 1.0, 30.0, 0.1, 0.2, 10.0) show_hudmessage(0, "test",nextmap) }
słowo test nadal wyświetla się jedynie na 1 sekundę, jakieś inne pomysły?
może tutaj coś nie tak?
set_task(100.0,"test",0,"",0,"d")
i według dokumentacji ostatnia linijka odpowiada za
channel=4 - kanał hudu (są 4 kanały, jeśli 2 wiadomości hud zostaną zapisane na tym samym kanale to jedna wiadomość nadpisze drugą, jeśli wstawione zostanie -1 to kanał zostanie wybrany automatycznie
http://amxx.pl/dokum.../set-hudmessage
Edited by sq69i, 31.08.2013 21:04.
Przyjmij wiadro 31.08.2013
jesli nie tam to moze tak jak mowisz w funkcji set_task, zamien ja na to:
set_task(100.0, "test");
jesli teraz tez nie zadziala to nie wiem.
sq69i
31.08.2013
jesli nie tam to moze tak jak mowisz w funkcji set_task, zamien ja na to:
set_task(100.0, "test");jesli teraz tez nie zadziala to nie wiem.
gdybym dał taką funkcję z brakiem literki "d" to skąd by miało wiedzieć że ma odliczać od końca?
http://amxx.pl/dokum...a/f120/set_task
właśnie szukam tego sposobu już od jakiegoś czasu ale nie mogę znaleźć.
jak ustalić długość wyświetlania wiadomości hudmessage
tak aby wyświetlana funkcja trwała od x czasu aż do końca mapy
Edited by sq69i, 31.08.2013 21:08.
Kawon
18.09.2013
Ten temat został przeniesiony z forum
AMX Mod X → Pytania dotyczące pluginów
do
Scripting AMXX → Pluginy