←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

mp_roundtime w HUD

Locked

hardbot's Photo hardbot 02.09.2010

Jak przebrać odliczanie do HUD. Próbowałem coś takiego lecz nie wychodzi mi :(

#include <amxmodx>

public plugin_init()
{
register_plugin("Time","0.1","HARDBOT")
set_task(1.0, "Start", _,_, _, "b")
return PLUGIN_CONTINUE
}
public Start(id)
{
new roundtime = get_cvar_num("mp_roundtime")
set_hudmessage(0, 255, 0, 0.5, 0.2, 2, 0.02, 1.0, 0.01)
show_hudmessage(0, "Nowa Runda za %f sekund", roundtime)
return PLUGIN_CONTINUE
}
Quote

  • +
  • -
Harsay's Photo Harsay 02.09.2010

#include <amxmodx>
#include <amxmisc>

public plugin_init() 
{ 
        register_plugin("Time","0.1","HARDBOT")
        register_event("HLTV", "Start", "a", "1=0", "2=0") 
        return PLUGIN_CONTINUE
}

public Start()
{
        new roundtime = get_cvar_num("mp_roundtime")
        set_hudmessage(0, 255, 0, 0.5, 0.2, 2, 0.02, 1.0, 0.01)
        show_hudmessage(0, "Nowa Runda za %f sekund", roundtime)
        return PLUGIN_CONTINUE
}

:)

@edit
Jak to wyżej nie zadziała to zamiast
register_event("HLTV", "Start", "a", "1=0", "2=0")

użyj

register_logevent("Start", 2, "1=Round_Start")

Edited by Harsay, 02.09.2010 22:33.
Quote

  • +
  • -
R3X's Photo R3X 03.09.2010

No a łącząc oba kody + bonus ode mnie otrzymujemy:
#include <amxmodx>

new Float:gfNowaRunda;

#define TASKID 23456

new gcvarRoundTime;

public plugin_init() 
{ 
	register_plugin("Time","0.1","HARDBOT");
	register_logevent("Start", 2, "1=Round_Start")
	register_logevent("End", 2, "1=Round_End")

	gcvarRoundTime = get_cvar_pointer("mp_roundtime");
}
public Start(){
	set_task(1.0, "Pokaz", TASKID,_, _, "b");
	gfNowaRunda = get_gametime()+get_pcvar_float(gcvarRoundTime)*60;
}
public End(){
	remove_task(TASKID);
}
public Pokaz()
{
	new roundtime =  floatround(gfNowaRunda - get_gametime(), floatround_floor);
	if(roundtime > 0){
		set_hudmessage(0, 255, 0, 0.5, 0.2, 2, 0.02, 1.0, 0.01)
		show_hudmessage(0, "Nowa Runda za %d sekund", roundtime)
	}
	return PLUGIN_CONTINUE
}
Quote

  • +
  • -
grankee's Photo grankee 03.09.2010

Warto dodać,żeby to się aktualizowało po podłożeniu paki itd
Quote
Locked