Raised This Month: $51 Target: $400
 12% 

add HUD message to plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cahervar
Member
Join Date: Mar 2021
Old 08-31-2021 , 17:21   add HUD message to plugin
Reply With Quote #1

I am using a CTF but there are always problems with the HUD because it has so many things that there are no channels available, for that reason, I use a version that does not show anything about how much adrenaline you have or when it is full, only by entering the menu you can see it.
I need to add a HUD (in the middle and bottom of the screen) that will tell you how much adrenaline you are gathering and warn you when it is full to use it

I leave the dictionary items

HUD_ADRENALINE = Adrenaline:% d of% d
HUD_ADRENALINEFULL = Adrenaline FULL! ^ N Type / adrenaline on the console to use a combo!

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <jctf>

#define MAX_ITEM 10

enum _:ITEMS
{
    
ITEM_NAME[32],
    
ITEM_COST,
    
ITEM_FORWARD
}

new 
g_szItem[MAX_ITEM][ITEMS], g_TotalItems

public plugin_init()
{
    
register_plugin("Shop Natives""1.2""Sugisaki")
    
    
register_clcmd("say /adrenaline""pfn_shop_adrenaline")
    
register_clcmd("say_team /adrenaline""pfn_shop_adrenaline")
    
    
register_dictionary("jctf.txt")
}

public 
plugin_natives()
{
    
register_native("shop_add_item""_native_add_item")
    
register_native("display_shop""pfn_shop_adrenaline"1)
}

public 
_native_add_item(pidpar)
{
    if(
g_TotalItems >= MAX_ITEM)
    {
        
log_amx("Maximo de items (%i) alcanzado, Modifica el plugin de la tienda.",  MAX_ITEM)
        return 
PLUGIN_HANDLED
    
}
    
    if(
get_param(2) > 100)
    {
        
log_amx("El item #%d sobrepaso el valor de 100 de adrenalina."g_TotalItems)
        return 
PLUGIN_HANDLED
    
}
    new 
FWD[32]
    
g_szItem[g_TotalItems][ITEM_COST] = get_param(2)
    
get_string(1g_szItem[g_TotalItems][ITEM_NAME], 31)
    
get_string(3FWDcharsmax(FWD))
    if(
get_func_id(FWDpid) == -1)
    {
        new 
pluginfilename[32]
        
get_plugin(pidpluginfilenamecharsmax(pluginfilename));
        
log_amx("[%s]Funcion %s Inexistente"pluginfilenameFWD);
        return 
PLUGIN_HANDLED
    
}
    if((
g_szItem[g_TotalItems][ITEM_FORWARD] = CreateOneForward(pidFWDFP_CELLFP_STRING)) == -1)
    {
        
log_amx("Ocurrio un error al crear la funcion %s"FWD)
        return 
PLUGIN_HANDLED
    
}
    
g_TotalItems++
    return 
PLUGIN_CONTINUE
}

public 
pfn_shop_adrenaline(id)
{
    new 
temp[5], menu
    menu 
menu_create(fmt("\r AMBA CS \w%L"id"MENU_SPITEMS_HEADER"get_user_adrenaline(id), 100), "buymenu_handled")
    
    for(new 
0g_TotalItemsi++)
    {
        
num_to_str(itempcharsmax(temp))
        
menu_additem(menufmt("\w%L: \y%d \d"idg_szItem[i][ITEM_NAME], g_szItem[i][ITEM_COST]), temp)
    }
    
    
menu_setprop(menuMPROP_BACKNAMEfmt("%L"id"MENU_BACK"))
    
menu_setprop(menuMPROP_NEXTNAMEfmt("%L"id"MENU_NEXT"))
    
menu_setprop(menuMPROP_EXITNAMEfmt("%L"id"MENU_EXIT"))
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    
    return 
PLUGIN_HANDLED
}

public 
buymenu_handled(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
cost get_user_adrenaline(id)
    if(
g_szItem[item][ITEM_COST] > cost)
    {
        
client_print_color(idprint_team_default"^1[^4AMBA CS^1] %L."id"PRINT_ADR_LOW")
        return 
PLUGIN_HANDLED
    
}
    
    new 
ret//, g_forward
    //g_forward = CreateMultiForward(g_szItem[item][ITEM_FORWARD], ET_STOP, FP_CELL, FP_STRING)
    
ExecuteForward(g_szItem[item][ITEM_FORWARD], retidg_szItem[item][ITEM_NAME]);
    if(
ret == PLUGIN_HANDLED)
    {
        return 
PLUGIN_HANDLED
    
}
    
set_user_adrenaline(idcost g_szItem[item][ITEM_COST])
    return 
PLUGIN_CONTINUE


Last edited by cahervar; 09-01-2021 at 13:27.
cahervar is offline
Old 04-07-2022, 11:54
fingerprint
This message has been deleted by fingerprint.
fingerprint
Junior Member
Join Date: Apr 2022
Old 04-07-2022 , 11:57   Re: add HUD message to plugin
Reply With Quote #2

here you go
Attached Files
File Type: sma Get Plugin or Get Source (reply.sma - 13 views - 3.7 KB)
fingerprint is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 04-07-2022 , 12:40   Re: add HUD message to plugin
Reply With Quote #3

why do you requesting here?
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951
kww is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:20.


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