Raised This Month: $ Target: $400
 0% 

HUD doesnt show up


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xeloxded
Member
Join Date: Dec 2016
Old 12-27-2016 , 11:42   HUD doesnt show up
Reply With Quote #1

Hello,

PHP Code:
public hud(taskid)    
{
    new 
id taskid 123;
    
    if(!
is_user_alive(id))
    {
        new 
espect pev(idpev_iuser2);
        
        if(!
espect)
            return 
PLUGIN_CONTINUE;
        
        new 
nombre[33];get_user_name(espectnombrecharsmax(nombre))
        new 
nuevonivel Niveles[niveles[espect]]-experiencia[espect]
    
        
set_hudmessage(025500.150.1516.01.10.00.0, -1);
        
ShowSyncHudMsg(idg_VerHud"%s Detalles del Jugador^n1- Nombre: %s^n2- Vida: %d / Chaleco: %d^n3- Nivel: %d / %d^n4- Experiencia: %d / %d^nRango : %s",
        
g_szPrefixnombreget_user_health(espect), get_user_armor(espect), niveles[espect], NivelMaximoexperiencia[espect], nuevonivelRANGOS[g_rango[espect]][RANGO_NAME])
    }
    return 
PLUGIN_CONTINUE;

For some reason, the HUD doesnt show up, if you need the entire code, i can provide it!
xeloxded is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-27-2016 , 11:52   Re: HUD doesnt show up
Reply With Quote #2

PHP Code:
public hud(taskid)     

    new 
id taskid 123
     
    if(!
is_user_alive(id)) 
    { 
        new 
espect pev(idpev_iuser2); 
Are you sure this is correct ?
Edit: I mean the way you use 'id' and not 'taskid'
__________________
Project: Among Us

Last edited by Craxor; 12-27-2016 at 11:53.
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2016 , 11:54   Re: HUD doesnt show up
Reply With Quote #3

Provide the full code(how you set the task).
__________________
HamletEagle is offline
xeloxded
Member
Join Date: Dec 2016
Old 12-27-2016 , 11:56   Re: HUD doesnt show up
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <colorchat>
#include <adv_vault>

new const g_szPrefix[] = "[AMXX]";

#define NivelMaximo 800
new const Niveles[NivelMaximo] =
{
    
50,
    
100,
    
200,
    
400,
    
600,
    
800,
    ...
}

enum _:rng
{
    
RANGO_NAME[30],
    
RANGO_NVL
}

new const 
RANGOS[][rng] = 
{
    { 
"Saiyayin Comun"},
    { 
"Saiyayin Fase 2"}
}

new 
experiencia[33], niveles[33], PKS[33], g_VerHudg_rango[33]

new const 
Modelos[][] = 
{
    
"models/leet/leet.mdl"
}

new 
Ganancia[33], AccountType[33][20];

enum _GANANCIA_DATA
{
    
GD_ADM_TYPE[20],
    
GD_ADM_FLAG,
    
GD_ADM_GN
}

new const 
Ganancias[][GANANCIA_DATA] =
{
    {
"VIP"ADMIN_LEVEL_F2}
}

enum
{
    
CAMP_NIVELES 0,
    
CAMP_EXP,
    
CAMP_RANGO,
    
MAX_CAMPOS
};

new 
g_iVault;
new 
g_iCampos[MAX_CAMPOS];

public 
plugin_cfg()
{
    
set_cvar_num"sv_airaccelerate"100);
    
set_cvar_float("mp_buytime"99999.9);
    
set_cvar_float("mp_freezetime"0.0);
    
set_cvar_float("mp_roundtime"5.0);
}

public 
plugin_init()
{
    
/* Información del PLUGIN */
    
register_plugin("Simple SurF MOD""1.0""Ardivaba")
    
    
/* Sistema de Niveles por Experiencia */
    
register_event"DeathMsg""EventDeathMsg""a" )
    
    
/* Comando para dar nivel */
    
register_concmd("amx_darnivel""DarNivel"ADMIN_RCON"SurFXPMOD v1.0 by SoundBlaster")
    
register_concmd("amx_quitar""QuitarTodo"ADMIN_RCON"SurFXPMOD v1.0 by SoundBlaster")
    
    
/* Información */
    
register_clcmd("say /level""info_menu");
    
register_clcmd("say /info""Informacion");
    
    
/* HUD */
    
g_VerHud CreateHudSyncObj()
    
    
/* Armas por Niveles */
    
register_event("CurWeapon","ev_CurWeapon""be""1=1")
    
    
RegisterHam(Ham_TakeDamage"player""fwHamTakeDamage")
    
    
/* Guardado */
    
g_iVault adv_vault_open("SurFXPMOD"false);

    
g_iCampos[CAMP_NIVELES] = adv_vault_register_field(g_iVault"NIVELES");
    
g_iCampos[CAMP_EXP] = adv_vault_register_field(g_iVault"EXP");
    
g_iCampos[CAMP_RANGO] = adv_vault_register_field(g_iVault"RANGO");
    
    
adv_vault_init(g_iVault);
}

public 
plugin_precache()
{    
    new 
i
    
    
for(0sizeof(Modelos); i++)
        
precache_model(Modelos[i])
}

public 
client_putinserverid )
{    
    
CargarDatos(id);
    
Load_AdminTypesid )
    
    
set_task(2.0,"hud",id+123,_,_,"b");
}

public 
client_disconnectid )
{
    
remove_task(id+123
    
GuardarDatos(id)
}

public 
hud(taskid)     

    new 
id taskid 123
     
    if(!
is_user_alive(id)) 
    { 
        new 
espect pev(idpev_iuser2);
        
        if(!
espect)
            return 
PLUGIN_CONTINUE;
        
        new 
nombre[33];get_user_name(espectnombrecharsmax(nombre))
        new 
nuevonivel Niveles[niveles[espect]]-experiencia[espect]
    
        
set_hudmessage(025500.150.1516.01.10.00.0, -1);
        
ShowSyncHudMsg(idg_VerHud"%s Detalles del Jugador^n1- Nombre: %s^n2- Vida: %d / Chaleco: %d^n3- Nivel: %d / %d^n4- Experiencia: %d / %d^nRango : %s",
        
g_szPrefixnombreget_user_health(espect), get_user_armor(espect), niveles[espect], NivelMaximoexperiencia[espect], nuevonivelRANGOS[g_rango[espect]][RANGO_NAME])
    }
    return 
PLUGIN_CONTINUE;
}

public 
EventDeathMsg()
{
    new 
killer read_data)
    new 
victim read_data)
    new 
headshot read_data)
    new 
xphs
    
    
if(niveles[killer] > niveles[victim]) xp 40 Ganancia[victim];
    if(
niveles[killer] < nivelesvictim ]) xp 60 Ganancia[victim]; 
    if(
niveles[killer] == niveles[victim]) xp 50 Ganancia[victim];
    
    
PKSvictim ] = 0
        
    
if( victim == killer ) return PLUGIN_CONTINUE;
        
    if(
headshot)
    {
        
xp xp 50 Ganancia[victim]; 
        
hs 1
    
}
    
    if(
PKS[killer] < 10PKS[killer]++
    
    
xp xp PKS[killer]
    
    
add_xp(killerxphs)
    
ColorChat(victimGREY"^x04%s^x3 Estas muerto y perdiste tu^x04 killstreak!"g_szPrefix)
    
check_level(killer)
    
    return 
PLUGIN_CONTINUE;
}

/* Add xp */
public add_xpidxphs )
{
    new 
nuevonivel Niveles[niveles[id]]-experiencia[id]
    
    
experiencia[id] = experiencia[id] + xp
    
    
if(hs)
    {
        
ColorChat(idGREY"^x04%s Headshot!^x03 Tu tienes ^x04%d^x03 de^x04 Experiencia! ^x01-^x03 Killstreak: ^x04%d^x03 Nuevo nivel despues de ^x04%d Experiencia."g_szPrefixxpPKSid ], nuevonivel)
    }
    else
    {
        
ColorChat(idGREY"^x04%s^x03 Tu tienes ^x04%d^x03 de^x04 Experiencia! ^x01-^x03 Killstreak: ^x04%d^x03 Nuevo nivel despues de ^x04%d^x03 de^x04 Experiencia."g_szPrefixxpPKSid ], nuevonivel)
    }
}

public 
check_levelid )
{
    if(
niveles[id] < NivelMaximo )
    {
        while(
experiencia[id] >= Niveles[niveles[id]])
        {
            
niveles[id]++
            
ColorChat(idGREY"^x04%s^x03 Ahora eres nivel^x04 %d!"g_szPrefixniveles[id])
            
check_rango(id)
            
GuardarDatos(id)
        }
    }
}

public 
check_rango(id)
{
         while (
niveles[id] >= RANGOS [g_rango[id]][RANGO_NVL] && g_rango[id] < sizeof RANGOS)
    {
        
g_rango[id] ++
        
client_print(idprint_chat"subiste de rango")
        
GuardarDatos(id)
    }
}

public 
info_menu(id)
{
    new 
keys MENU_KEY_0
    
new infomenu[999], lenlen 0
    
new nombre[32]
    
get_user_name(idnombrecharsmax(nombre))
    new 
nuevonivel Niveles[niveles[id]]-experiencia[id]
    
    
len += formatex(infomenu[len], charsmax(infomenu) - len"\r%s \wInformacion^n^n"g_szPrefix)
    
len += formatex(infomenu[len], charsmax(infomenu) - len"|=======================|^n")
    
len += formatex(infomenu[len], charsmax(infomenu) - len"\r- \wNombre: %s^n"nombre)
    
len += formatex(infomenu[len], charsmax(infomenu) - len"\r- \wNivel: %d / %d^n"niveles[id], NivelMaximo)
    
len += formatex(infomenu[len], charsmax(infomenu) - len"\r- \wExperiencia: %d / %d^n"experiencia[id], nuevonivel)
    
len += formatex(infomenu[len], charsmax(infomenu) - len"\r- \wRango : %s^n"RANGOS[g_rango[id]][RANGO_NAME])
    
len += formatex(infomenu[len], charsmax(infomenu) - len"|=======================|")
    
len += formatex(infomenu[len], charsmax(infomenu) - len"^n^n\y0. \rSalir")

    
show_menu(idkeysinfomenu)
    return 
PLUGIN_CONTINUE
}
public 
GuardarDatos(id)
{
    
adv_vault_set_start(g_iVault);
    
    
adv_vault_set_field(g_iVaultg_iCampos[CAMP_NIVELES], niveles[id]);
    
adv_vault_set_field(g_iVaultg_iCampos[CAMP_EXP], experiencia[id]);
    
adv_vault_set_field(g_iVaultg_iCampos[CAMP_RANGO], g_rango[id]);
    
    new 
g_szPlayerName[33];get_user_name(idg_szPlayerName31)
    
adv_vault_set_end(g_iVault0g_szPlayerName[id]);
}

public 
CargarDatos(id)
{
    new 
g_szPlayerName[33];get_user_name(idg_szPlayerName31)
    
    if (!
adv_vault_get_prepare(g_iVault 0_g_szPlayerName[id]))
    {
        
niveles[id] = experiencia[id] = 0;
        return;
    }
    
    
niveles[id] = adv_vault_get_field(g_iVaultg_iCampos[CAMP_NIVELES]);
    
experiencia[id] = adv_vault_get_field(g_iVaultg_iCampos[CAMP_EXP]);
    
g_rango[id] = adv_vault_get_field(g_iVaultg_iCampos[CAMP_RANGO]);
}

public 
ev_CurWeapon(id)
{
    if (!
is_user_connected(id) || !is_user_alive(id))
    return 
PLUGIN_HANDLED;
    
    new 
wid read_data(2)
    
    switch(
wid)
    {
        case 
CSW_KNIFE : if(niveles[id] >= 5set_pev(idpev_viewmodel2"models/leet/leet.mdl")
    }
        
    return 
PLUGIN_CONTINUE;
}
public 
fwHamTakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(attacker))
        return 
HAM_IGNORED 
    
    
new wid get_user_weapon(attacker)
    
    switch(
wid)
    {
        case 
CSW_KNIFE : if(niveles[attacker] >= 5SetHamParamFloat(4damage 1.4)
    }
    return 
HAM_IGNORED;
}

public 
QuitarTodo(idlevelcid
{
    if(!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED
    
    
new nombre[32], Player
    read_argv
(1nombrecharsmax(nombre))
    
    
Player cmd_target(idnombreCMDTARGET_ALLOW_SELF)
    
    if(!
Player)
        return 
PLUGIN_HANDLED
    
    niveles
[Player] = 1
    experiencia
[Player] = 0
    g_rango
[Player] = 0
    
    
if(id != Player)
        
ColorChat(idGREY"^x04%s^x03 Le has Quitado^x04 Todo,^x03 Al Jugador ^x04%s"g_szPrefixnombre)
    
    
ColorChat(PlayerGREY"^x04%s^x03 Te han Quitado todos tus^x04 niveles"g_szPrefix)
    
    
check_level(Player)
    
    return 
PLUGIN_HANDLED
}

public 
DarNivel(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;
    
    static 
arg[32], arg2[99], playerasd
    read_argv
(1argsizeof arg 1)
    
read_argv(2arg2sizeof arg2 1)
    
player cmd_target(idargCMDTARGET_ALLOW_SELF
    
    if (!
player) return PLUGIN_HANDLED;
    
    
asd = (str_to_num(arg2))
    
    
niveles[player] = asd
    
    experiencia
[player] = Niveles[niveles[player]]
    
check_level(player)
    return 
PLUGIN_HANDLED
}

Load_AdminTypes(id)
{
    if(
is_user_admin(id)) // Si es admin
    
{        
        new 
iflags get_user_flags(id);

        for(
sizeof Ganancias i++ ) 
        {            
            if(
flags Ganancias[i][GD_ADM_FLAG])
            {                
                
Ganancia[id] = Ganancias[i][GD_ADM_GN];

                
formatex(AccountType[id], charsmax(AccountType), "%s"Ganancias[i][GD_ADM_TYPE]);

                break;
            }
        }
    }
    else
    {
        
Ganancia[id] = 1;

        
formatex(AccountType[id], charsmax(AccountType), "Usuario");
    }

I am getting those errors aswell

12/27/2016 - 13:43:26: [AMXX] Displaying debug trace (plugin "rango.amxx")
12/27/2016 - 13:43:26: [AMXX] Run time error 10: native error (native "adv_vault_get_prepare")
12/27/2016 - 13:43:26: [AMXX] [0] vips.sma::CargarDatos (line 262)
12/27/2016 - 13:43:26: [AMXX] [1] vips.sma::client_putinserver (line 120)

Last edited by xeloxded; 12-27-2016 at 11:56.
xeloxded 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 18:14.


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