←  Pluginy

AMXX.pl: Support AMX Mod X i SourceMod

»

Nowy Plugin
Prośba o napisanie pluginu

Zablokowany

  • +
  • -
daedhelil - zdjęcie daedhelil 05.01.2010

Witam! Potrzebuje prostego pluginu, który będzie pokazywał w lewym dolnym rogu ekranu obecną ilość HP i AP.
Odpowiedz

  • +
  • -
Misiaczek ;c - zdjęcie Misiaczek ;c 06.01.2010

Witam! Potrzebuje prostego pluginu, który będzie pokazywał w lewym dolnym rogu ekranu obecną ilość HP i AP.


Plugin od HP który napisał R3X pokazuje info nawet jak wartość przekracza 255HP :)
#include <amxmodx>#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Real HP"
#define VERSION "1.0"
#define AUTHOR "R3X"

#define CHANNEL 1
#define FRAMES 10

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_message(get_user_msgid("Health"),"message_health");

register_forward(FM_PlayerPreThink, "fwPreThink", 1);
}

public message_health(msg_id,msg_dest,msg_entity)
{
if(pev(msg_entity, pev_health) >= 255){
set_msg_arg_int(1, ARG_BYTE, 255);
}
return PLUGIN_CONTINUE;
}

public fwPreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED;
static iCounter[33]={0,...};
if(++iCounter[id] >= FRAMES)
{
set_hudmessage(0, 200, 200, 0.02, 0.70,0,0.0, 0.5,0.0,0.0,CHANNEL );
show_hudmessage(id, "HP: %d", pev(id, pev_health));
iCounter[id]=0;
}
return FMRES_IGNORED;
}


Do AP niestety nie mam.

ale to chyba powinno działać(nie znam się na funkcji get_user_msgid, nie znalazłem w niej opcji Armor tylko ArmorType co bardziej chyba wskakuje czy mamy kamizelek czy kamizelkę + hełm ale pewien nie jestem :P
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Real AP"
#define VERSION "1.0"
#define AUTHOR "R3X"

#define CHANNEL 1
#define FRAMES 10

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_message(get_user_msgid("ArmorType"),"message_armor");
register_forward(FM_PlayerPreThink, "fwPreThink", 1);
}

public message_armor(msg_id,msg_dest,msg_entity)
{
if(pev(msg_entity, pev_armorvalue) >= 255){
set_msg_arg_int(1, ARG_BYTE, 255);
}
return PLUGIN_CONTINUE;
}

public fwPreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED;
static iCounter[33]={0,...};
if(++iCounter[id] >= FRAMES)
{
set_hudmessage(0, 255, 170, 0.01, 0.18,0,0.0, 0.5,0.0,0.0,CHANNEL );
show_hudmessage(id, "HP: %d", pev(id, pev_armorvalue));
iCounter[id]=0;
}
return FMRES_IGNORED;
}

Użytkownik MisieQ edytował ten post 06.01.2010 07:38
Odpowiedz

  • +
  • -
daedhelil - zdjęcie daedhelil 06.01.2010

Dziękuje za pomoc, wszystko działa tak jak chciałem (po połączneiu pluginów)
Moglibyście wytłumaczyć mi w jaki sposób przemieścić wiadomość w inne miejsce oraz jak zmienić kolor tej informacji?


#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "HP & AP"
#define VERSION "1.0"
#define AUTHOR "R3X"

#define CHANNEL 1
#define FRAMES 10

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_message(get_user_msgid("Health"),"message_health");
register_message(get_user_msgid("ArmorType"),"message_armor");
register_forward(FM_PlayerPreThink, "fwPreThink", 1);
}

public message_health(msg_id,msg_dest,msg_entity)
{
if(pev(msg_entity, pev_health) >= 255){
set_msg_arg_int(1, ARG_BYTE, 255);
}
return PLUGIN_CONTINUE;
}

public message_armor(msg_id,msg_dest,msg_entity)
{
if(pev(msg_entity, pev_armorvalue) >= 255){
set_msg_arg_int(1, ARG_BYTE, 255);
}
return PLUGIN_CONTINUE;
}

public fwPreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED;
static iCounter[33]={0,...};
if(++iCounter[id] >= FRAMES)
{
set_hudmessage(0, 255, 170, 0.01, 0.18,0,0.0, 0.5,0.0,0.0,CHANNEL );
show_hudmessage(id, "HP: %d AP: %d", pev(id, pev_health), pev(id, pev_armorvalue));
iCounter[id]=0;
}
return FMRES_IGNORED;
}

Użytkownik SatanSon edytował ten post 06.01.2010 17:55
Odpowiedz

  • +
  • -
G[o]Q - zdjęcie G[o]Q 06.01.2010

#include <amxmodx>
#include <amxmisc>
#include <cstrike>


new tpstring[1024] 
new gmsgStatusText



public plugin_init() {
	

	//register_forward(FM_PlayerPreThink, "Forward_FM_PlayerPreThink")
	gmsgStatusText = get_user_msgid("StatusText")
	set_task(0.8, "UpdateHUD",0,_,_,"b")
}


public pokaz(id) {

	format(tpstring,1023,"HP: %i AP %i",get_user_health ( id ) ,get_user_armor ( index )) 
	message_begin(MSG_ONE,gmsgStatusText,{0,0,0}, id) 
	write_byte(0) 
	write_string(tpstring) 
	message_end() 	
}



public UpdateHUD()
{    
	//Update HUD for each player
	for (new id=0; id < 32; id++)
	{	
		if (!is_user_connected(id))
			continue
		
		
		if (is_user_alive(id)) pokaz(id)
}
}


Jesli server to nie diablo to ten kod jest niezlym rozwiazaniem
Odpowiedz

  • +
  • -
daedhelil - zdjęcie daedhelil 06.01.2010

Dziękuje Wam wszystkim za pomoc. :lol:

Zamieszczam tutaj .sma pluginu którego używam. Myślę, że się przyda :>

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Real HP"
#define VERSION "1.0"
#define AUTHOR "R3X"

#define CHANNEL 1
#define FRAMES 10

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_message(get_user_msgid("Health"),"pokaz_zycie");
register_message(get_user_msgid("ArmorType"),"pokaz_kamizelke");

register_forward(FM_PlayerPreThink, "fwPreThink", 1);
}

public pokaz_zycie(msg_id,msg_dest,msg_entity)
{
if(pev(msg_entity, pev_health) >= 255){
set_msg_arg_int(1, ARG_BYTE, 255);
}
return PLUGIN_CONTINUE;
}

public pokaz_kamizelke(msg_id,msg_dest,msg_entity)
{
if(pev(msg_entity, pev_armorvalue) >= 255){
set_msg_arg_int(1, ARG_BYTE, 255);
}
return PLUGIN_CONTINUE;
}

public fwPreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED;
static iCounter[33]={0,...};
if(++iCounter[id] >= FRAMES)
{
set_hudmessage(0, 255, 0, 0.01, 0.89, 0, 0.0, 0.4, 0.0, 0.0, CHANNEL );
show_hudmessage(id, "Zycie: %d Kamizelka: %d", pev(id, pev_health), pev(id, pev_armorvalue));
iCounter[id]=0;
}
return FMRES_IGNORED;
}

Załączone pliki


Użytkownik SatanSon edytował ten post 06.01.2010 21:45
Odpowiedz

Seba - zdjęcie Seba 07.01.2010

Show_hudmessage w prethink - bardzo mądre :P
Odpowiedz

  • +
  • -
daedhelil - zdjęcie daedhelil 07.01.2010

Show_hudmessage w prethink - bardzo mądre :P


Ja się na tym nie znam, ale działa =)
Odpowiedz

Adminek AMXX.PL - zdjęcie Adminek AMXX.PL 07.01.2010

Wiadomość wygenerowana automatycznie


Ten temat został zamknięty przez moderatora.

Powód: Działa

Jeśli się z tym nie zgadzasz, Dołączona grafika raportuj ten post, a moderator lub administrator rozpatrzy go ponownie.


Z pozdrowieniami,
Zespół AMXX.PL
Odpowiedz
Zablokowany