AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   hud error (https://forums.alliedmods.net/showthread.php?t=129807)

omgitsme 06-17-2010 03:31

hud error
 
Code:

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

Re: hud error
 
Remove the quotation marks:
Code:

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

Re: hud error
 
ok, i removed them, and it now looks like this
Code:

#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

Re: hud error
 
Quote:

Originally Posted by omgitsme (Post 1211251)
ok, i removed them, and it now looks like this
Code:

#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:

PHP Code:

#include <amxmodx>

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

public 
Pirktiid )
{
    
set_hudmessage(2552550, -1.0, -1.006.05.0)
    
show_hudmessage(id"Rasyk /pirkti jei nori vip/admin privelgu!")



tm. 06-17-2010 05:07

Re: hud error
 
Actually it's not correct. Try this:
PHP Code:

#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(2552550, -1.0, -1.006.05.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(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
}

public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    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

Re: hud error
 
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

Re: hud error
 
Quote:

Originally Posted by tm. (Post 1211269)
Actually it's not correct. Try this:
PHP Code:

#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(2552550, -1.0, -1.006.05.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(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
}

public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    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

Re: hud error
 
Quote:

Originally Posted by GXLZPGX (Post 1211306)
I was actually referring to the third post in this topic.

Me too.

omgitsme 06-17-2010 12:24

Re: hud error
 
thanks, it works.

GXLZPGX 06-17-2010 19:38

Re: hud error
 
Quote:

Originally Posted by tm. (Post 1211348)
Me too.

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

PHP Code:

#include <amxmodx>

set_hudmessage(2552550, -1.0, -1.006.05.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.


All times are GMT -4. The time now is 14:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.