←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

Odliczanie do 0

Zablokowany

  • +
  • -
DarkGL - zdjęcie DarkGL 26.09.2009

Chciałem napisać jak mi się wydawało proste odliczanie od 30 do 0 zrobiłem to tak:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Home"

new czas=30;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0")
	register_logevent("Koniec_Rundy", 2, "1=Round_End")
}

public Nowa_Runda(){
		for(new i=0;i<33;i++){
			set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 0, 1, 0.5, 0.5, 4)
			show_hudmessage(i, " %d",czas)
		}
		czas--;
		set_task(1.0,"Nowa_Runda",czas+1)
}
public Koniec_Rundy(){
	czas=30;
}
ale wyświetla tylko 30 i dalej już nie
Odpowiedz

  • +
  • -
mikus - zdjęcie mikus 26.09.2009

Zobacz takie coś, ale ja nie wiem...

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Home"

new czas = 30;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0")
    register_logevent("Koniec_Rundy", 2, "1=Round_End")
}
public Nowa_Runda(){
	set_task(1.0,"wyswietl",8188,"",0,"b")
}
public wyswietl(){
        for(new i=0;i<33;i++){
		
            set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 0, 1, 0.5, 0.5, 4)
            show_hudmessage(i, " %d",czas)
        }
        czas--;
        set_task(1.0,"wyswietl",czas+1)
}
public Koniec_Rundy(){
    remove_task(8188)
    czas = 30;
}
Odpowiedz

  • +
  • -
DarkGL - zdjęcie DarkGL 26.09.2009

ciągle pokazuje 30 chociaż napis się odświeża
Odpowiedz

  • +
  • -
mgr inż. Pavulon - zdjęcie mgr inż. Pavulon 26.09.2009

#include <amxmodx>

new czas = 30

public plugin_init()
{
	register_plugin("New Plug-In", "1.0", "AMXX")
	register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0")
	register_logevent("Koniec_Rundy", 2, "1=Round_End")
}
public Nowa_Runda()
{
	set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 0.0, 1.0, 0.5, 0.5, 4)
	show_hudmessage(0, "%d", czas--)
	
	if (czas>=0)
		set_task(1.0,"wyswietl", 1337)
}
public Koniec_Rundy()
{
	czas = 30
	if (task_exists(1337))
		remove_task(1337)
}

Powinno działać.
Odpowiedz

  • +
  • -
mikus - zdjęcie mikus 26.09.2009

A może zamiast
show_hudmessage(0, "%d", czas)

daj
show_hudmessage(0, "%i", czas)
Odpowiedz

  • +
  • -
DarkGL - zdjęcie DarkGL 26.09.2009

nie działa pokazuje 30 i znika i dalej już nic nie pokazuje
Odpowiedz

  • +
  • -
mgr inż. Pavulon - zdjęcie mgr inż. Pavulon 26.09.2009

DarkGL, tak to jest jak się przerabia plugin zamiast robić go od początku :/
Wdarła się mała literówka(nazwa funkcji w task'u)

#include <amxmodx>

new czas = 30

public plugin_init()
{
register_plugin("New Plug-In", "1.0", "AMXX")
register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0")
register_logevent("Koniec_Rundy", 2, "1=Round_End")
}
public Nowa_Runda()
{
set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 0.0, 1.0, 0.5, 0.5, 4)
show_hudmessage(0, "%d", czas--)

if (czas>=0)
set_task(1.0,"Nowa_Runda", 1337)
}
public Koniec_Rundy()
{
czas = 30
if (task_exists(1337))
remove_task(1337)
}

Odpowiedz
Zablokowany