Pedido hud permanente optimizado
#1
hola gente ya se que hay como 6 post con huds permanentes pero siempre me tiran errores me podrian dejar la estructura de un hudsyncobj bien optimizado , Desde ya muchisimas gracias al que me quiera ayuda
Saludos
cLi;^

c++ [5%]
@2007

Responder
#2
Que clase de errores te da?
[Imagen: b_350_20_323957_202743_f19a15_111111.png]

Estudia siempre; el tiempo es oro, lo material se puede recuperar pero el tiempo no se puede recuperar.
(02/10/2016, 05:05 PM)meTaLiCroSS escribió: Siempre me gusta ayudar cuando alguien esta interesado realmente en ver que esta programando.
(08/08/2019, 05:32 PM)meTaLiCroSS escribió: grax x el dato cr4ck


Mis aportes

PLUGINS
MAPAS
Menú LANG [SF] Sistema de Frags
Say System (Admin Prefix)
Responder
#3
Fijate yo lo hago asi, tal vez sea un asco pero bueno. Fijate si te sirve

Código PHP:
new Hud

public 
plugin_init() 
{
    
    
Hud CreateHudSyncObj() 
}

public 
client_putinserver(id)
{
    
set_task(1.0"ShowHud"id+570,_,_"b")
}

public 
ShowHud(id)
{
    
id -= 570
    
    set_hudmessage
(255255255, -1.00.506.012.0)
    
ShowSyncHudMsg(idHud"AKA VA LO DEL HUD")

Responder
#4
(21/05/2015, 01:12 AM)totopizza escribió: Que clase de errores te da?

errores de hud peruanos

(21/05/2015, 01:18 AM)kiiioN escribió: Fijate yo lo hago asi, tal vez sea un asco pero bueno. Fijate si te sirve

Código PHP:
new Hud

public 
plugin_init() 
{
    
    
Hud CreateHudSyncObj() 
}

public 
client_putinserver(id)
{
    
set_task(1.0"ShowHud"id+570,_,_"b")
}

public 
ShowHud(id)
{
    
id -= 570
    
    set_hudmessage
(255255255, -1.00.506.012.0)
    
ShowSyncHudMsg(idHud"AKA VA LO DEL HUD")


Gracias por tu ayuda igualmente eso de 570 ya me lo veo que es el de k.-
despues si tengo el problema paso logs
Saludos
cLi;^

c++ [5%]
@2007

Responder
#5
(21/05/2015, 01:39 AM)Mrlindorcovas escribió:
(21/05/2015, 01:12 AM)totopizza escribió: Que clase de errores te da?

errores de hud peruanos

(21/05/2015, 01:18 AM)kiiioN escribió: Fijate yo lo hago asi, tal vez sea un asco pero bueno. Fijate si te sirve

Código PHP:
new Hud

public 
plugin_init() 
{
    
    
Hud CreateHudSyncObj() 
}

public 
client_putinserver(id)
{
    
set_task(1.0"ShowHud"id+570,_,_"b")
}

public 
ShowHud(id)
{
    
id -= 570
    
    set_hudmessage
(255255255, -1.00.506.012.0)
    
ShowSyncHudMsg(idHud"AKA VA LO DEL HUD")


Gracias por tu ayuda igualmente eso de 570 ya me lo veo que es el de k.-
despues si tengo el problema paso logs

No es el de K-, Va que yo sepa, nunca lo vi en un tutorial de el. Total fijate si te sirve yo lo hago de esa manera Sonrisa
Responder
#6
(21/05/2015, 01:39 AM)Mrlindorcovas escribió: Gracias por tu ayuda igualmente eso de 570 ya me lo veo que es el de k.-
despues si tengo el problema paso logs
Ohhhh, cuidado, por asignar un valor a un task ya es de una persona?

Madre mía, no me quiero ni imaginar cuantas veces habrás cambiado el autor de un plugin solo porque añadiste una variable o vete a saber que.

Offtopic, sí, pero es que... RagestartRagestart
(17/04/2015, 03:36 PM)Neeeeeeeeeel.- escribió: No se va a volver a conectar a internet en toda su puta vida... nadie sube porno a mi foro y vive para contarlo.
Responder
#7
optimizar? pacman puedes poner unas cuantas const para editarlo mas fácil es todo

Código PHP:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

enum (+= 300)
{
    
TASK_HUD 5694,
    
/* OTRO_TASK,  // esto es un ejemplo, puedes agregar los task que quieras y usarlos
    OTRO_TASK */  // cada uno valdrá lo mismo que el de arriba +300
}

const 
Float:HUD_STATS_X 0.01
const Float:HUD_STATS_Y 0.22
const HUD_STATS_CHANNEL 1
new g_hudsync


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_hudsync CreateHudSyncObj()
}

public 
client_putinserver(id)
{
    
set_task(1.0"ShowHud"id+TASK_HUD__"b")
}

public 
client_disconnect(id)
{
    
remove_task(id+TASK_HUD)
}

public 
ShowHud(id)
{
    
id -= TASK_HUD
    
    
if(!is_user_alive(id))
        return;
        
    
set_hudmessage(00255HUD_STATS_XHUD_STATS_Y00.01.00.00.0HUD_STATS_CHANNEL)
    
ShowSyncHudMsg(idg_hudsync"Guenas noshes soi un jud")

[Imagen: 76561198068808877.png]
Responder
#8
Gracias a todos . Me sirvio todo
Saludos
cLi;^

c++ [5%]
@2007

Responder
#9
Aguante las entidades...
Código PHP:
new g_iMsgSync;
new 
g_iMaxPlayers[1 char];
new const 
g_szEntityHUD[] = "Entity_PlayerHUD";

public 
plugin_precache()
{
    new 
iEntity create_entity("info_target");
    
entity_set_string(iEntityEV_SZ_classnameg_szEntityHUD);
    
entity_set_float(iEntityEV_FL_nextthinkget_gametime() + 0.1);
    
register_think(g_szEntityHUD"Think_PlayerHUD");
}

public 
plugin_init()
{
    
g_iMsgSync CreateHudSyncObj();
    
g_iMaxPlayers{0} = get_maxplayers();
}

public 
Fwd_PlayerThink_HUD(iEntity)
{
    if (!
is_valid_ent(iEntity))
        return;
    
    static 
id;
    for (
id 1id <= g_iMaxPlayers{0}; id++)
    {
        if (!
is_user_alive(id))
            continue;
        
        
set_hudmessage(255255255, -1.00.5);
        
ShowSyncHudMsg(idg_iMsgSync"Hola^nSoy una entidad");
    }
    
    
entity_set_float(iEntityEV_FL_nextthinkget_gametime() + 0.1);

Free agent - Vendo plugins, mods o apps del foro IPB (Invision community)
Contactarme vía Discord >>> AtselTV#8202
Responder
#10
Una entidad para un simple hud? eso solo seria necesario si se necesitara llamar al hud, mas rápido de lo que un task soporta (0.1)
NO RESPONDO MP POR SOPORTE
Responder
#11
(21/05/2015, 07:21 PM)FloresMagon escribió: Una entidad para un simple hud? eso solo seria necesario si se necesitara llamar al hud, mas rápido de lo que un task soporta (0.1)
Eh ?.
Esto sirve si necesitas hacer un HUD permanente.
Con un HUD hecho con tasks, puede funcionar pero puede desaparecer debido a los retrasos que tendrá el servidor y la cantidad de jugadores conectados.
Free agent - Vendo plugins, mods o apps del foro IPB (Invision community)
Contactarme vía Discord >>> AtselTV#8202
Responder
#12
(21/05/2015, 08:46 PM)CSAxel escribió:
(21/05/2015, 07:21 PM)FloresMagon escribió: Una entidad para un simple hud? eso solo seria necesario si se necesitara llamar al hud, mas rápido de lo que un task soporta (0.1)
Eh ?.
Esto sirve si necesitas hacer un HUD permanente.
Con un HUD hecho con tasks, puede funcionar pero puede desaparecer debido a los retrasos que tendrá el servidor y la cantidad de jugadores conectados.

En eso tiene razòn.
Responder
#13
LOGS LOGS LOGS LOGS logs everiwhere
Código:
L 05/21/2015 - 22:12:06: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:07: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:07: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:07: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:11: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:11: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:11: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:12: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:12: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:12: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:16: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:16: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:16: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:17: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:17: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:17: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:21: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:21: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:21: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:22: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:22: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:22: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:26: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:26: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:26: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 05/21/2015 - 22:12:27: HudSyncObject -1 is invalid
L 05/21/2015 - 22:12:27: [AMXX] Run time error 10 (plugin "DeathrunMod.amxx") (native "ShowSyncHudMsg") - debug not enabled!
L 05/21/2015 - 22:12:27: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).


siempre ando con los mismos errores D:
Saludos
cLi;^

c++ [5%]
@2007

Responder
#14
Pasa el code, No somos adivinos.. Guiño
Responder
#15
Código PHP:
/* Deathrun Extreme:
    @Release 1.0:
        -Creacion: 19/5/15
        -Rangos
        -Tienda
        -Vidas
        -Hud
            1.3
        +Dividida la tienda en 2 secciones Tienda por gemas y tienda por oro                    //HUD
        +Agregada venta de vidas                            
        -Model TT                                    /---------------------------\
        -Nuevo say                                    [Frags: 0]    [Muertes: 0]
        +Agregado un minimo de 3 players para obtener ganancias                [Vidas: 0]    [Gemas: 0]
        +Agregados nuevos rango                                [Rango: Nuevo]    [Promedio: 0] 
        +Cuchillos                                    \----------------------------/
        2.0
        
        
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
/*-----------
    ENUMS
-------------*/
enum _:mTiendaNOMBRE[40] ,COSTO }
enum _:gTiendaCANTIDAD[251], COST }
enum _:gCuchillos
    
FAKA[24],
    
RANGO,    
    
MDL[24],
    
PMDL[24

/*-----------
     CONST
-------------*/
new const DataTienda[][mTienda] = {
    {
"Flashban"3},
    {
"Granada"7},
    {
"Deaggle (1Bala)"15},
    {
"Ak-47 (2Balas)"20},
    {
"-50 Gravedad" ,25}
}

new const 
TiendaGemas[][gTienda] = {
    {
5,9},
    {
15,17},
    {
30,32},
    {
90,60},
    {
250,280}
}
new const 
NOMBREG[] = {"Recien llegado" ,"Novato","Experimentado" ,"BunnyHopper" "Scroller","Jumper","Jumper Elite","Agente""Arg-Community","Leyenda""Dios","Anda a dormir"}
new const 
FRAGSRANGO[] = {
    
0,
    
15
    
40
    
80,
    
105,
    
125,
    
145,
    
200,
    
230,
    
245,
    
350,
    
999999
}
new const 
MenuCuchillos[][gCuchillos] = {
    {
"Normal"0"v_knife""p_knife"},
    {
"Venenoso"2,"v_knife_venon""p_knife_venon"},
    {
"Corta plumas",5,"v_corta_plumas""p_corta_plumas"},
    {
"Mortal"10,"v_knife_mortal""p_knife_mortal"}
}
new const 
OroUp[] = {"buttons/bell1.wav"}
new const 
Compra[] = {"arg-community/compra.wav"}
new const 
Activador[] = {"models/arg-community/terrorista.mdl"}

/*-----------
     VARS
-------------*/
new Prefix[] = "[COMUNIDAD]"

new gFrags33 ];
new 
gMuertes33 ];
new 
gGemas33 ]; 
new 
gOro33 ];
new 
gVidas33 ]; /*cs_user_spawn*/
new gRango33 ];
new 
gCuchi33 ]; /*Cuchillo seleccionado*/
new gHudStyle33 ];
new 
Muteados33 ];



new 
hud
new line
new gMaxPlayers
new ContadorAdmins
/*--------------
     PRECACHE
---------------*/
public plugin_precache(){
    static 
Cantidad[200]
    for (new 
1sizeof(MenuCuchillos); i++){
        
formatex(Cantidad,199,"models/arg-community/%s.mdl"MenuCuchillos[i][MDL])
        
formatex(Cantidad,199,"models/arg-community/%s.mdl"MenuCuchillos[i][PMDL])
    }
    
/*models*/
    
    
line precache_model("sprites/white.spr")
    
precache_model(Activador)
    
/*Sonidos*/
    
precache_sound(Compra)
}
/*--------------
      INIT
---------------*/
public plugin_init() {
    
register_plugin("Deathrun Mod""1.3""amx-ES&YO:3")
    
    
register_clcmd("nightvision","cmdTeam")

    
register_clcmd("say /admins""MostrarAdmins")
    
register_clcmd("say /time" ,"MostrarHora")
    
    
register_clcmd("say""message_saytext")
    
    
register_event("DeatgMsg","Deathmsg""a")
    
    
RegisterHamHam_Spawn,"player""HAMRoundStart"1)
    
RegisterHam(Ham_Item_Deploy"weapon_knife""Ham_KnifeDeploy_Post"true);

    
hud CreateHudSyncObj()
    
gMaxPlayers get_maxplayers()
    
    
}
/*-------------------
    [PUTIN SERVER]
---------------------*/
public client_putinserver(id){
    
gFrags[id] = 0
    gHudStyle
[id] = 1
    gMuertes
[id] = 0
    gOro
[id] = 5
    gGemas
[id] = 1
    gVidas
[id] = 3
    gRango
[id] = 0
    set_task
(5.0,"SHOWHUD",id+570,_,_,"b")
    if(
is_user_admin(id) && ADMIN_KICK){
        
ContadorAdmins++
    }
    
}

public 
client_disconnect(id){
    if(
is_user_admin(id) && ADMIN_KICK){
        
ContadorAdmins--
    }
}


/*-------------------
    [ROUND-START]
---------------------*/
public HAMRoundStart(id){
    if(
cs_get_user_team(id) == CS_TEAM_T){
        
cs_set_user_model(id,Activador)
        
chat(id,"!g%s!y En esta ronda seras el !tTerrorista!y.Tiraloos a todoss",Prefix)
        return 
PLUGIN_HANDLED;
    }
    
cs_reset_user_model(id)
    return 
PLUGIN_HANDLED
}
/*-------------------
    [HUD]
---------------------*/
public SHOWHUD(id)
{
    
id -= 570
    
new name[32],target
    get_user_name
(targetnamecharsmax(name))
    if(
ContConectados() < 3){
        
set_hudmessage(150150150, -1.00.2206.012.0)
        
ShowSyncHudMsg(idhud,  "No se obtienen ganancias^nhay muy pocos jugadores online")
        return 
PLUGIN_HANDLED;
    }
        
    if(!
is_user_alive(id)){
        
set_hudmessage(255000.170.1206.012.0)
        
ShowSyncHudMsg(idhud"Especteando a %s^nGemas :%d^nOro %d^nFrags %d^nMuertes %d"name,gGemas[target],gOro[target],gFrags[target],gMuertes[target])
        return 
PLUGIN_HANDLED;
    }
    if(
gHudStyle[id] == && ContConectados() > 3){ //si elijio el estilo 1 y hay mas de 3 personas conectadas...
        
set_hudmessage(851702550.170.1206.012.0)
        
ShowSyncHudMsg(idhud"/---------------------------\^n[Frags: %d]    [Muertes: %d]^n[Vidas: %d]    [Gemas: %d]^n[Rango: %s]        [Promedio: %d] ^n\----------------------------/",gFrags[id],gMuertes[id],gVidas[id],gGemas[id],NOMBREG[gRango[id]], gFrags[id] + gMuertes[id] / 2)
        return 
PLUGIN_HANDLED;
    }
    if(
gHudStyle[id] == && ContConectados() > 3){ //si elijio el estilo 2 y hay mas de 3 personas conectdaas...
        
new namestyle[33]
        
get_user_name(id,namestyle,32)
        
set_hudmessage(255000.130.1016.012.0)
        
show_hudmessage(id"Nombre:%s^nRango:%s^nFrags:%d^nMuertes:%d^nGemas:%d^nOro:%d^nVidas:%d",namestyle,NOMBREG[gRango[id]],gFrags[id],gMuertes[id],gGemas[id],gOro[id],gVidas[id])
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
        
}


/*-------------------
     [DEATH-MSG]
---------------------*/
public Deathmsg(){
//NOTA : ACA SE ENCUENTRAN TODAS LAS GANANCIAS AL MATAR O MORIR
    
if(ContConectados() < 3){
        

        new 
asesino read_data(1)
        new 
victima read_data(2)
        new 
VictimaName[33]
        new 
AsesinoName[33]
    
        
get_user_name(asesino,AsesinoName,32)
        
get_user_name(victima,VictimaName,32)
        if(
victima == asesino || !is_user_connected(asesino) || !is_user_connected(victima))    return PLUGIN_HANDLED;
    
        if(
get_user_team(asesino) == 1){
            
gVidas[asesino]++ 
            
gFrags[asesino]++
            
gOro[asesino]+= 7
            CheckGemas
(asesino)
            
CheckRango(asesino)
            
chat(asesino,"!g%s!t Ganaste !y7 monedas de oro!t y !y1 vida!t por matar a!g %s",PrefixVictimaName)
            return 
PLUGIN_HANDLED;
        }
        
/*Asesino siendo ct*/
        
gOro[asesino]+= 5
        gFrags
[asesino]++
        
CheckGemas(asesino)
        
CheckRango(asesino
        
chat(asesino,"!g%s !tGanaste !y5 monedas de oro!t por matar a !g%s"Prefix,VictimaName)
    
        
/*Victima*/
        
gMuertes[victima]++
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}
/*******************************
********* MENUPRINCIPAL  *******
********************************/
public ShowMenu(id){
    new 
menu,szTitle[300]
    
formatex(szTitle,299,"\r====================================^n\wDeathrun Mod \dBy COMUNIDAD\w^n\yMenu principal^n\r====================================^n")
    
menu menu_create(szTitle"handMenuPrincipal")
    
menu_additem(menu,"\wIr a la\y tienda""1")
    
menu_additem(menu,"\wSeleccionar\y cuchillo""2")
    
menu_additem(menu,"\wMis\y vidas""3")
    
menu_additem(menu,"\yConfiguraciones^n^n""4")
    
menu_additem(menu,"\dADMINISTRADORES""5")
    
menu_setprop(menu,MPROP_EXITNAME,"\rSalir")
    
menu_display(id,menu)
}
public 
handMenuPrincipal(id,menu,item){
    if(
item == MENU_EXIT){
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    switch(
item){
        case 
0:ShowSupermercado(id)
        case 
1:ShowCuchisMenu(id)
        case 
2:cmdVidas(id)
        case 
3:Configuraciones(id)
        case 
4:ShowAdminMenu(id)
    }
    return 
PLUGIN_HANDLED;
}
    


/*-------------------
      [TIENDAS]
---------------------*/    
public ShowSupermercado(id){
    new 
menu menu_create("\ySelecciona una de las tiendas""HandSuper")
    
menu_additem(menu,"Tienda por\r Oro","1")
    
menu_additem(menu,"Tienda por\r Gemas""2")
    
menu_display(id,menu)
}
public 
HandSuper(id,menu,item){
    if(
item == MENU_EXIT){
        
ShowMenu(id)
    }
    switch(
item){
        case 
0:ShowTiendaMonedas(id)
        case 
1:ShowTiendaGemas(id)
    }
    return 
PLUGIN_HANDLED;
}


//-----------<TIENDA POR GEMAS>---------//
public ShowTiendaGemas(id){
    new 
menuTitle[300],Len[700],i
    formatex
(Title,299,"Deathrun Mod \dBy COMUNIDAD^n\wTienda^nTienes \y%d\w gema%s",gGemas[id], gGemas[id] > "s" "")
    
menu menu_create(Title,"handmenugemas")
    for(
0sizeof(TiendaGemas); i++) {
        if(
gGemas[id] < TiendaGemas[i][COST]){
            
formatex(Len,299,"\dPack [%d Vidas] $%d Gemas",TiendaGemas[i][CANTIDAD],TiendaGemas[i][COST])
        }else{
            
formatex(Len,299,"\yPack [%d Vidas] \r$%d Gemas",TiendaGemas[i][CANTIDAD],TiendaGemas[i][COST])
        }
        
menu_additem(menu,Len)
        
    }
    
menu_display(id,menu)
    return 
PLUGIN_HANDLED;
}
public 
handmenugemas(id,menu,item){
    if(
item == MENU_EXIT){
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    if(
gGemas[id] < TiendaGemas[item][COST]){
        return 
ITEM_IGNORE
    
}
    else if(
gGemas[id] >= TiendaGemas[item][COST]){
        switch(
item){
            case 
0:{
                
gVidas[id]+= 5
                
            
}
            case 
1:{
                
gVidas[id]+= 15
            
}
            case 
2:{
                
gVidas[id]+= 30
            
}
            case 
3:{
                
gVidas[id]+= 90
            
}
            case 
4:{
                
gVidas[id]+= 250
            
}
        }
        
chat(id,"!g%s !tTu compra fue efectuada con!g exito!t compraste !y%d gemas"Prefix,TiendaGemas[item][CANTIDAD])
        
gGemas[id] -= TiendaGemas[item][COST]
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED
}
/*
Tienda por monedas de oro en esta tienda se puede comprar items extras como granadas gravedad etc.
*/
//---------<TIENDA POR MONEDAS>---------//
public ShowTiendaMonedas(id){
    new 
menu,Title[300],len[700],i
    formatex
(Title,299,"Deathrun Mod \dBy COMUNIDAD^n\wTienda^nTienes \y%d\w moneda%s",gOro[id],gOro[id] > "s" "")
    
menu menu_create(Title,"HandTienda")
    for(
0sizeof(DataTienda); i++) {
        if(
gOro[id] < DataTienda[i][COSTO]){
            
formatex(len,699,"\d%s \r[Costo:%d]",DataTienda[i][NOMBRE],DataTienda[i][COSTO])
        }else{
            
formatex(len,699,"\w%s \y[Costo: %d]",DataTienda[i][NOMBRE],DataTienda[i][COSTO])
        }
        
menu_additem(menu,len,_,_,menu_makecallback("CallbackTienda"))
    }
    
menu_display(id,menu)
}
public 
CallbackTienda(id,menu,item){
    if(
gOro[id] < DataTienda[item][COSTO]){
        return 
ITEM_DISABLED;
    }
    return 
PLUGIN_HANDLED;
}
public 
HandTienda(id,menu,item){
    if(
item == MENU_EXIT){
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED;
    }
    switch(
item){
        case 
0:
        {
            
give_item(id,"weapon_flashbang")
        
        }
        case 
1:
        {
            
give_item(id,"weapon_hegrenade")
            
        }
        case 
2:
        {
            
give_item(id,"weapon_deagle")
            
cs_set_user_bpammo(id,CSW_DEAGLE,1)
        }
        case 
3:
        {
            
give_item(id,"weapon_ak47")
            
cs_set_user_bpammo(id,CSW_AK47,2)
        }
        case 
4:
        {
            
set_user_gravity(id,0.9)
        }
    }
    
    
chat(id,"!g%s !t compraste !y %s"PrefixDataTienda[item][NOMBRE])
    
gOro[id] -= DataTienda[item][COSTO]
    return 
PLUGIN_HANDLED;
}
    
/*-------------< CUCHILLOS >------------*/    
public ShowCuchisMenu(id){
    new 
menu,Title[300],Len[300],i
    formatex
(Title,299,"Selecciona un cuchillo")
    
menu menu_create(Title,"HandCuchisMenu")
    for(
0sizeof(MenuCuchillos); i++) {
        if(
gRango[id] < MenuCuchillos[i][RANGO]){
            
formatex(Len,299,"\d%s\r[BLOQUEADO]"MenuCuchillos[i][FAKA])
        }else{
            
formatex(Len,299,"\w%s \y[DESBLOQUEADO|"MenuCuchillos[i][FAKA])
        }
        
menu_additem(menu,Len)
    }
    
menu_display(id,menu)
}
public 
HandCuchisMenu(id,menu,item){
    if(
gRango[id] < MenuCuchillos[item][RANGO]){
        return 
ITEM_IGNORE;
    }
    if(
gCuchi[id] == item){
        return 
PLUGIN_HANDLED;
    }
    if(
item == MENU_EXIT){
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED;
    }
    switch(
item){
        case 
0:gCuchi[id] = item
        
case 1:gCuchi[id] = item
        
case 2:gCuchi[id] = item
        
case 3:gCuchi[id] = item
    
}
    
chat(id,"!g%s !tseleccionaste el cuchillo !y%s" ,Prefix,MenuCuchillos[item][FAKA])
    return 
PLUGIN_HANDLED;
}
    
//Nota: Para efectuar el cambio de cuchillos
public Ham_KnifeDeploy_Post(iWeapon)
{
    new 
iOwner get_pdata_cbase(iWeapon414);
    if (!
pev_valid(iOwner))
        return;
    
    
set_pev(iOwnerpev_viewmodelMenuCuchillos[gCuchi[iOwner]][MDL]);
    
set_pev(iOwnerpev_weaponmodel2MenuCuchillos[gCuchi[iOwner]][PMDL])
}    
/*-------------< SYS. VIDAS >------------*/
public cmdVidas(id){
    if(!
is_user_alive(id)){
        
ShowMenuVidas(id)
        return 
PLUGIN_HANDLED;
    }
    
chat(id,"!g%s !tEstas vivo .debes estar !ymuerto!t para usar vidas"Prefix)
    return 
PLUGIN_HANDLED;
}

public 
ShowMenuVidas(id){
    if(
gVidas[id] > 0){
        new 
menu,Title[300]
        
formatex(Title,299,"Deathrun Mod \dBy COMUNIDAD^n\w^nTienes %d vidas^n"gVidas[id])
        
menu menu_create(Title,"HandVidasMenu")
        
menu_additem(menu,"Usar 1 vida" "1")
        
menu_additem(menu,"No quiero usarla aun""2")
        
menu_display(id,menu)
    }
    else if(
gVidas[id] == 0){
        
chat(id"!g%s !tNo tienes ninguna vida",Prefix)
    }
    return 
PLUGIN_HANDLED;
}
public 
HandVidasMenu(id,menu,item){
    if(
item == MENU_EXIT){
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    switch(
item){
        case 
0:
        {
            if(
JugadoresVivos(1) < 2){
                
chat(id,"!g%s!t hay muy pocos policias vivos para usar !y1 vida!t.",Prefix);  return PLUGIN_HANDLED;
            }
            else if(
JugadoresVivos(1) > 2){
                
chat(id,"!g%s!t usaste !y1 vida!t ahora te quedan !y%d,!t fuiste revivido!",Prefix,gVidas[id])
                
gVidas[id]--
                
cs_user_spawn(id)
            }
        }
        case 
1menu_destroy(menu)
    }
    return 
PLUGIN_HANDLED;
}
    

/*--------------------------
    Configuraciones
---------------------------*/
public Configuraciones(id){
    new 
Letras[300], menu
    menu 
menu_create("\yConfiguraciones \dDeathrun Mod","HandConfigs")
    
formatex(Letras,299,"\wEstilo del hud: \y%d^n\r2. \wMicrofonos %s^n",gHudStyle[id] > "2" "1"Muteados[id] > "\d[Desactivados]" :"\y[Activados]")
    
menu_additem(menu,Letras)
    
menu_display(id,menu)
}
public 
HandConfigs(id,menu,item){
    if(
item == MENU_EXIT){
        
ShowMenu(id)
        return 
PLUGIN_HANDLED
    
}
    switch(
item){
        case 
0:{
            if(
gHudStyle[id] == 1){
                
gHudStyle[id]++
                
chat(id,"!g%s!t Cambiaste el estilo de tu !yHUD.",Prefix)
                return 
PLUGIN_HANDLED;
                
            }
            if(
gHudStyle[id] == 2){
                
gHudStyle[id]--
                
chat(id,"!g%s!t Cambiaste el estilo de tu !yHUD.",Prefix)
                return 
PLUGIN_HANDLED;
            }
        }
        case 
1:cmdMute(id)
    }
    return 
PLUGIN_HANDLED;
}
            
    
//Para mutear demutaer microfonos
public cmdMute(id){
    if(
Muteados[id] == 0){
        
        
chat(id,"!g%s!t desactivaste todos los !ymicrofonos!t, /mute para re-activarlos",Prefix)
        
client_cmd(id,"voice_enable 0")
        
Muteados[id] = 1
    
}
    else{
        
chat(id,"!g%s!t re-activaste todos los !ymicrofonos!t, /mute para desactivarlos",Prefix)
        
client_cmd(id,"voice_enable 1")
        
Muteados[id] = 0
    
}
        
    return 
PLUGIN_HANDLED
}

//////////////////////////////
///Menu de administradores/////
//////////////////////////////

public ShowAdminMenu(id){
    new 
menu menu_create("Menu de administracion" "handMenuAdmins" )
    
menu_additem(menu,"Dar kick","1")
    
menu_additem(menu,"Dar Ban""2")
    
menu_additem(menu,"Banear Cuenta""3")
    
menu_additem(menu,"Mapas" "4")
    
menu_additem(menu,"Iniciar Votemap""5")
    
menu_display(id,menu)
}
public 
handMenuAdmins(id,menu,item){
    if (
item == MENU_EXIT){
        
ShowMenu(id)
        return 
PLUGIN_HANDLED
    
}
    switch(
item){
        case 
0client_cmd(id,"amx_kickmenu")
        case 
1client_cmd(id,"amx_banmenu")
        case 
2chat(id,"en dessarrollo")
        case 
3client_cmd(id,"amx_mapmenu")
        case 
4client_cmd(id,"amx_votemapmenu")
    }
    return 
PLUGIN_HANDLED
}

/*-------------< HOOK-SAY >------------*/
public message_saytext(id


    static 
szSay[192
    
    
read_args(szSaycharsmax(szSay)) 
    
remove_quotes(szSay
    
replace_all(szSaycharsmax(szSay), "%"" "
    
    static 
szNombre[32
    
get_user_name(idszNombre32
    
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_CT
        {
            if(
is_user_alive(id)) 
            {
                
chat(0"!t%s!g[!y%s!g]!g[!y%d!g]!y: %s"szNombreNOMBREG[gRango[id]],gVidas[id], szSay// mensaje que es CT , nombre , level , lo que escribio
            
}
            else 
chat(0"!y*MUERTO*!t%s!g[!y%s!g]!g[!y%d!g]!y: %s"szNombreNOMBREG[gRango[id]],gVidas[id], szSay// lo mismo pero tambien que esta muerto
        
}     
        
        case 
CS_TEAM_T// si es TT
        
{
            if (
is_user_alive(id)) // si esta vivo el TT
            
{
                
chat(0"!t%s!g[!y%s!g]!g[!y%d!g]!y: %s"szNombreNOMBREG[gRango[id]],gVidas[id], szSay// mensaje que es TT , nombre , level , lo que escribio
            
}
            else 
chat(0"!y*MUERTO*!t%s!g[!y%s!g]!g[!y%d!g]!y: %s"szNombreNOMBREG[gRango[id]],gVidas[id], szSay)// lo mismo pero te muestra que estas muerto.
        

        
        case 
CS_TEAM_SPECTATOR:
        {
            
chat(0"!t*Spectator* %s!y: %s"szNombreszSay)
        }
    } 
    return 
PLUGIN_HANDLED 
}    
    
            
                       
                
//NOTA: CHECKEAMOS SI TIENE 25 MONEDAS DE ORO O MAS Y SE LA CAMBIAMOS POR 1 GEMA
public CheckGemas(id){
    if(
gOro[id] > 25){
        
gGemas[id]++
        
gOro[id] = 0
        client_cmd
(id,"spk %s"OroUp)
        
/*-----------*/
        
new origin[3]
        
get_user_origin(idorigin1)

        
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
        
write_byte (TE_BEAMENTPOINT)
        
write_short(id 0x1000// lean el comentario de abajo :D
        
write_coord (origin[0])        // Start X
        
write_coord (origin[1])        // Start Y
        
write_coord (origin[2])        // Start Z
        
write_short(line)        // Sprite
        
write_byte (1)              // Start frame                
        
write_byte (10)             // Frame rate                    
        
write_byte (1)            // Life
        
write_byte (5)           // Line width                
        
write_byte (0)            // Noise
        
write_byte (200)         // Red
        
write_byte (80)        // Green
        
write_byte (200)        // Blue
        
write_byte (150)             // Brightness                    
        
write_byte (25)              // Scroll speed                    
        
message_end()  
        
/*-----------*/
        
        
set_task(0.1,"CheckGemas",id)
        
    }
}
//NOTA: CHECKEAMOS SI TIENE LOS SUFICIENTES FRAGS PARA PASAR DE RANGO Y LE DAMOS EL OTRO RANGO
public CheckRango(id){
    if(
gFrags[id] >= FRAGSRANGO[gRango[id]]){
        
gRango[id]++  /*Mostrar Rango 'NOMBREG[g_Rango[id]])'*/
        
    
}
}



////////////////////////////////////
//////////Funciones:SAY/////////////
////////////////////////////////////

public MostrarAdmins(id){
    if(
ContadorAdmins ){
        
chat(id,"!g%s !t Hay !y%d!t admin%s online"PrefixContadorAdmins,ContadorAdmins "s" "")
    }
    return 
PLUGIN_HANDLED;
}
public 
MostrarHora(id){
    new 
CurrentTime[9]
    
get_time("%H:%M"CurrentTime,8)
    
chat(id,"!g%s!t Son las !y%s!t en arg-community[ARGENTINA]"Prefix,CurrentTime)
}






/****************************************
********        [STOCKS]    *********
****************************************/
stock chat(id, const input[], any:...)
{
    static 
szMsg[191];
    
vformat(szMsg190input3);
    
    
replace_all(szMsg190"!g""^x04");
    
replace_all(szMsg190"!y""^x01");
    
replace_all(szMsg190"!t""^x03");
    
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTget_user_msgid("SayText"), .player id);
    
write_byte(id id 33);
    
write_string(szMsg);
    
message_end();
}

ContConectados()
{
    static 
iCon;
    for (new 
1<= gMaxPlayersi++)
    {
        if (
is_user_connected(i))
            
iCon++;
    }
    return 
iCon;
}

JugadoresVivos(team)
{
    new 
iPlayers[32], pnum
    get_players
(iPlayerspnum"ae"team "CT" "TERRORIST")
    return 
pnum;

public 
cmdTeam(id){
    if(
get_user_team(id) == || get_user_team(id) == ){
        
ShowMenu(id)
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED


ese es el codigo que llevo , perdonen el desorden y si ven algun desastre a simple vista diganme
Saludos
cLi;^

c++ [5%]
@2007

Responder
#16
Activa debug, algun error esta siendo causado que no deja que "hud" setee su valor correctamente. Siempre pasa lo mismo.
Responder
#17
(21/05/2015, 06:47 PM)CSAxel escribió: Aguante las entidades...
Código PHP:
new g_iMsgSync;
new 
g_iMaxPlayers[1 char];
new const 
g_szEntityHUD[] = "Entity_PlayerHUD";

public 
plugin_precache()
{
    new 
iEntity create_entity("info_target");
    
entity_set_string(iEntityEV_SZ_classnameg_szEntityHUD);
    
entity_set_float(iEntityEV_FL_nextthinkget_gametime() + 0.1);
    
register_think(g_szEntityHUD"Think_PlayerHUD");
}

public 
plugin_init()
{
    
g_iMsgSync CreateHudSyncObj();
    
g_iMaxPlayers{0} = get_maxplayers();
}

public 
Fwd_PlayerThink_HUD(iEntity)
{
    if (!
is_valid_ent(iEntity))
        return;
    
    static 
id;
    for (
id 1id <= g_iMaxPlayers{0}; id++)
    {
        if (!
is_user_alive(id))
            continue;
        
        
set_hudmessage(255255255, -1.00.5);
        
ShowSyncHudMsg(idg_iMsgSync"Hola^nSoy una entidad");
    }
    
    
entity_set_float(iEntityEV_FL_nextthinkget_gametime() + 0.1);


Llmacenar los jugadores en una variable char utilizando los bytes, buena No tbad
[Imagen: 76561198068808877.png]
Responder
#18
(22/05/2015, 12:13 AM)zoolk escribió:
(21/05/2015, 06:47 PM)CSAxel escribió: Aguante las entidades...
Código PHP:
new g_iMsgSync;
new 
g_iMaxPlayers[1 char];
new const 
g_szEntityHUD[] = "Entity_PlayerHUD";

public 
plugin_precache()
{
    new 
iEntity create_entity("info_target");
    
entity_set_string(iEntityEV_SZ_classnameg_szEntityHUD);
    
entity_set_float(iEntityEV_FL_nextthinkget_gametime() + 0.1);
    
register_think(g_szEntityHUD"Think_PlayerHUD");
}

public 
plugin_init()
{
    
g_iMsgSync CreateHudSyncObj();
    
g_iMaxPlayers{0} = get_maxplayers();
}

public 
Fwd_PlayerThink_HUD(iEntity)
{
    if (!
is_valid_ent(iEntity))
        return;
    
    static 
id;
    for (
id 1id <= g_iMaxPlayers{0}; id++)
    {
        if (!
is_user_alive(id))
            continue;
        
        
set_hudmessage(255255255, -1.00.5);
        
ShowSyncHudMsg(idg_iMsgSync"Hola^nSoy una entidad");
    }
    
    
entity_set_float(iEntityEV_FL_nextthinkget_gametime() + 0.1);


Llmacenar los jugadores en una variable char utilizando los bytes, buena No tbad

Diferencia: ninguna
Responder
#19
Pero que no se utiliza menos bits así? o solo aplica a las variables con celdas? xD
[Imagen: 76561198068808877.png]
Responder
#20
(22/05/2015, 01:39 AM)zoolk escribió: Pero que no se utiliza menos bits así? o solo aplica a las variables con celdas? xD

Ok, usas menos bits, si, 3 bytes menos con los que no alimentas ni a medio niño en Africa, te creo estuvieses optimizando 20MB de memoria... es "una buena practica", pero para proyectos grandes
Responder
#21
(22/05/2015, 02:43 AM)meTaLiCroSS escribió:
(22/05/2015, 01:39 AM)zoolk escribió: Pero que no se utiliza menos bits así? o solo aplica a las variables con celdas? xD

Ok, usas menos bits, si, 3 bytes menos con los que no alimentas ni a medio niño en Africa, te creo estuvieses optimizando 20MB de memoria... es "una buena practica", pero para proyectos grandes

Hmm entiendo solo quería saber si se ahorraba así.
Yo me pregunto, si g_maxplayers[1 char] lo puedes dividir en 4 para almacenar números de 0 - 255, que pasaría con las otras 3 partes restantes?
Simplemente se quedan ahí y no se usan o se quedan almacenadas
No se la verdad me preocupo mucho por nada xD
[Imagen: 76561198068808877.png]
Responder
#22
Si vas a usar más variables como g_iMaxPlayers, podrías usar los demás arrays de memoria así no lo tenes al pedo, yo lo hago.
Free agent - Vendo plugins, mods o apps del foro IPB (Invision community)
Contactarme vía Discord >>> AtselTV#8202
Responder
#23
(22/05/2015, 02:16 PM)zoolk escribió:
(22/05/2015, 02:43 AM)meTaLiCroSS escribió:
(22/05/2015, 01:39 AM)zoolk escribió: Pero que no se utiliza menos bits así? o solo aplica a las variables con celdas? xD

Ok, usas menos bits, si, 3 bytes menos con los que no alimentas ni a medio niño en Africa, te creo estuvieses optimizando 20MB de memoria... es "una buena practica", pero para proyectos grandes

Hmm entiendo solo quería saber si se ahorraba así.
Yo me pregunto, si g_maxplayers[1 char] lo puedes dividir en 4 para almacenar números de 0 - 255, que pasaría con las otras 3 partes restantes?
Simplemente se quedan ahí y no se usan o se quedan almacenadas
No se la verdad me preocupo mucho por nada xD

Tu mismo lo dijiste. De ser asi, revisa todos los arrays que has creado en tu plugin, y concluye cuales "llegaran" al tamaño maximo de ese array, o revisa cual vendria a ser su uso máximo, y te daras cuenta que estas desperdiciando más bytes que 3 bytes de una simple variable. Sonrisa
Responder
#24
Podes leer con atención esto:
https://amxmodx-es.com/Thread-TUT-Compre...de-digitos

Y esto para guiarte:
https://amxmodx-es.com/Thread-TUT-Llaves...les-y-char
Free agent - Vendo plugins, mods o apps del foro IPB (Invision community)
Contactarme vía Discord >>> AtselTV#8202
Responder
#25
ya lei el de destro como 4 veces y lo entiendo el de metalicros todavía no se muy bien del todo eso de recorrer bits y lo demás, pero gracias
[Imagen: 76561198068808877.png]
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)