PDA

View Full Version : hud error


omgitsme
06-17-2010, 03:31
set_hudmessage("255", "255", "0", "-1.0", "-1.0", "0", "6.0", "5.0")
show_hudmessage(id, "Rasyk /pirkti jei nori vip/admin privelgu!")
#include <amxmodx>

public plugin_init()
{
register_plugin("Pirkti menu", "1.0", "omgitsme")
register_clcmd( "say /pirkti","Pirkti");
}
public Pirkti(id)
{
new menu = menu_create("\rServer paslaugos:", "menu_handler");
menu_additem(menu, "\wAdmin + Vip", "1", 0);
menu_additem(menu, "\wAdmin", "2", 0);
menu_additem(menu, "\wVip", "3", 0);
menu_additem(menu, "\wSlot", "4", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);

}
public menu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
show_motd(id, "admin.txt");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 2:
{
show_motd(id, "uzas.txt");
}
case 3:
{
show_motd(id, "vip.txt");
}
case 4:
{
show_motd(id, "slot.txt");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}

without hud it works, i made the hud with hud genorator. it's proberly not in the correct place or i did something wrong. can someone fix it please?

tm.
06-17-2010, 04:14
Remove the quotation marks:set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 5.0)
And no way it's going to work setting the hud message before include. When exactly do you want the hud message to appear?

omgitsme
06-17-2010, 04:45
ok, i removed them, and it now looks like this
#include <amxmodx>

set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 5.0)
show_hudmessage(id, "Rasyk /pirkti jei nori vip/admin privelgu!")

public plugin_init()
{
register_plugin("Pirkti menu", "1.0", "omgitsme")
register_clcmd( "say /pirkti","Pirkti");
}
is it correct now? what other modelus should i include? and i would like it to apear at the round start. my "first plugin that i want to update. sorry for stupid/noob questions. thanks

GXLZPGX
06-17-2010, 04:51
ok, i removed them, and it now looks like this
#include <amxmodx>

set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 5.0)
show_hudmessage(id, "Rasyk /pirkti jei nori vip/admin privelgu!")

public plugin_init()
{
register_plugin("Pirkti menu", "1.0", "omgitsme")
register_clcmd( "say /pirkti","Pirkti");
}
is it correct now? what other modelus should i include? and i would like it to apear at the round start. my "first plugin that i want to update. sorry for stupid/noob questions. thanks

Yes thats correct, but if you want to be able to type "/pirkti" and have it display the hud message, use this:

#include <amxmodx>

public plugin_init()
{
register_plugin("Pirkti menu", "1.0", "omgitsme")
register_clcmd( "say /pirkti","Pirkti");
}

public Pirkti( id )
{
set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 5.0)
show_hudmessage(id, "Rasyk /pirkti jei nori vip/admin privelgu!")
}

tm.
06-17-2010, 05:07
Actually it's not correct. Try this:

#include <amxmodx>

public plugin_init()
{
register_plugin("Pirkti menu", "1.0", "omgitsme")
register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start")
register_clcmd( "say /pirkti","Pirkti");
}

public roundstart()
{
set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 5.0)
show_hudmessage(0, "Rasyk /pirkti jei nori vip/admin privelgu!")
}

public Pirkti(id)
{
new menu = menu_create("\rServer paslaugos:", "menu_handler");
menu_additem(menu, "\wAdmin + Vip", "1", 0);
menu_additem(menu, "\wAdmin", "2", 0);
menu_additem(menu, "\wVip", "3", 0);
menu_additem(menu, "\wSlot", "4", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);

}

public menu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
show_motd(id, "admin.txt");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 2:
{
show_motd(id, "uzas.txt");
}
case 3:
{
show_motd(id, "vip.txt");
}
case 4:
{
show_motd(id, "slot.txt");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}

omgitsme
06-17-2010, 05:20
no, i want /pirkti to make a menu. but i want a hud message every new round to say the message i typed^^

GXLZPGX
06-17-2010, 06:34
Actually it's not correct. Try this:

#include <amxmodx>

public plugin_init()
{
register_plugin("Pirkti menu", "1.0", "omgitsme")
register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start")
register_clcmd( "say /pirkti","Pirkti");
}

public roundstart()
{
set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 5.0)
show_hudmessage(0, "Rasyk /pirkti jei nori vip/admin privelgu!")
}

public Pirkti(id)
{
new menu = menu_create("\rServer paslaugos:", "menu_handler");
menu_additem(menu, "\wAdmin + Vip", "1", 0);
menu_additem(menu, "\wAdmin", "2", 0);
menu_additem(menu, "\wVip", "3", 0);
menu_additem(menu, "\wSlot", "4", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);

}

public menu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
show_motd(id, "admin.txt");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 2:
{
show_motd(id, "uzas.txt");
}
case 3:
{
show_motd(id, "vip.txt");
}
case 4:
{
show_motd(id, "slot.txt");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}

I was actually referring to the third post in this topic.

tm.
06-17-2010, 08:14
I was actually referring to the third post in this topic.
Me too.

omgitsme
06-17-2010, 12:24
thanks, it works.

GXLZPGX
06-17-2010, 19:38
Me too.

If you were, then my code was perfectly fine. All he had in the third post was:

#include <amxmodx>

set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 5.0)
show_hudmessage(id, "Rasyk /pirkti jei nori vip/admin privelgu!")

public plugin_init()
{
register_plugin("Pirkti menu", "1.0", "omgitsme")
register_clcmd( "say /pirkti","Pirkti");
}

Mine carried out the function and displays a hud message when you type /pirkti.