[Solucionado] Error: Undefined symbol "fmt"
#1
Hola, tengo este error al compilar este plugin. me pueden ayudar? uso amxmodx 1.8.2

Código PHP:
#include <amxmodx>
#include <amxmisc>

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

new g_maxplayers;
new 
playerid;
new 
Seccion[33];
new 
g_szBanRazon[33][128];
new 
g_szKickRazon[33][128];
new 
BanTime[33];

enum
{
    
BAN,
    
KICK
}

enum _:DATA_TIME 
{
    
zText[32],
    
tiempo
}

new const 
TiempoDeBan[][DATA_TIME]=
{
    {
"5 Minutos"5},
    {
"10 Minutos"10},
    {
"30 Minutos"30},
    {
"1 Hora"60},
    {
"Permanente"0}
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("amx_admincmd""menu_principal"ADMIN_KICK)
    
register_clcmd("Razon_de_ban""IngRazonBan")
    
register_clcmd("Razon_de_kick""IngRazonKick")
    
g_maxplayers get_maxplayers()
}

public 
menu_principal(const id)
{
    new 
menu menu_create("\r___________________^n^n\wMenu de comandos^n\r___________________""HandPrincipal")
    
menu_additem(menu"kickear jugador")
    
menu_additem(menu"Banear jugador")
    
menu_setprop(menuMPROP_EXITNAME"Salir"); menu_setprop(menuMPROP_NEXTNAME"Siguiente"); menu_setprop(menuMPROP_BACKNAME"Volver")
    
menu_display(idmenu)
}

public 
HandPrincipal(const id, const menu, const item)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED;
    }

    switch(
item)
    {
        case 
0:
        { 
            
MenuAndSecciones(id)
            
Seccion[id] = KICK
        
}
        case 
1:         
        { 
            
MenuAndSecciones(id)
            
Seccion[id] = BAN
        
}
    }
    return 
PLUGIN_HANDLED;
}

public 
MenuAndSecciones(const id)
{
    new 
menu menu_create(fmt("\r___________________^n^n\w%s jugador^n\r___________________"Seccion[id] == BAN "Banear" "Kickear"), "HandSelec")
    new 
name[32], IDS[12]
    for(new 
1<= g_maxplayersi++) 
    { 
        if(
is_user_connected(i)) 
        { 
            
get_user_name(inamecharsmax(name))
            
formatex(IDScharsmax(IDS), "%d %d"iget_user_userid(i))
            
menu_additem(menufmt("%s%s"is_user_admin(i) ? "\y" "\w"name), IDS
        }
    }
    
menu_setprop(menuMPROP_EXITNAME"Salir"); menu_setprop(menuMPROP_NEXTNAME"Siguiente"); menu_setprop(menuMPROP_BACKNAME"Volver")
    
menu_display(idmenu)
}

public 
HandSelec(const id, const menu, const item)
{
    new 
lolbuffer[12], userid
    menu_item_getinfo
(menuitemlolbuffercharsmax(buffer), __lol)

    new 
szid[3], szuserid[9
    
parse(bufferszidcharsmax(szid), szuseridcharsmax(szuserid))
    
playerid str_to_num(szid)
    
userid str_to_num(szuserid

    if(!
is_user_connected(playerid))
    { 
        return 
PLUGIN_HANDLED
    }

    if(
userid != get_user_userid(playerid)) 
    { 
        return 
PLUGIN_HANDLED
    }

    if(
is_user_admin(playerid))
    {
        
client_print(idprint_center"El usuario es admin")
        return 
PLUGIN_HANDLED;
    }

    
menu_to_player(id)
    return 
PLUGIN_HANDLED
}

public 
menu_to_player(id)
{
    new 
name[32]; get_user_name(playeridnamecharsmax(name))
    new 
ip[15]; get_user_ip(playeridipcharsmax(ip))
    new 
status[15]; get_user_authid(playeridstatuscharsmax(status))

    new 
menu menu_create(fmt("\r___________________^n^n\w%s: \y%s^n\wip:\y %s^n\wstatus:\y %s^n\r___________________"Seccion[id] == BAN "Banear ah" "Kickear ah"nameipstatus), "Hand_menu_to_player")
    
menu_additem(menufmt("Razon de %s: \y%s"Seccion[id] == BAN "ban" "kick"Seccion[id] == BAN g_szBanRazon[id] : g_szKickRazon[id]))

    if(
Seccion[id] == BANmenu_additem(menufmt("Tiempo de ban: \y%s"TiempoDeBan[BanTime[id]][zText]))

    
menu_additem(menufmt("%s jugador"Seccion[id] == BAN "Banear" "Kickear"), __menu_makecallback( (Seccion[id] == BAN) ? "CallBackBan" "CallBackKick"))
    
menu_setprop(menuMPROP_EXITNAME"Salir"); menu_setprop(menuMPROP_NEXTNAME"Siguiente"); menu_setprop(menuMPROP_BACKNAME"Volver")
    
menu_display(idmenu)
}

public 
CallBackKick(const id, const menu, const item)
{
    if(
strlen(g_szKickRazon[id]) < 1)    
        return 
ITEM_DISABLED;
    return 
ITEM_ENABLED;
}

public 
CallBackBan(const id, const menu, const item)
{
    if(
strlen(g_szBanRazon[id]) < 1)    
        return 
ITEM_DISABLED;
    return 
ITEM_ENABLED;
}


public 
Hand_menu_to_player(const id, const menu, const item)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        
Seccion[id] = 0
        
return PLUGIN_HANDLED;
    }

    if(
Seccion[id] == BAN)
    {
        switch(
item)
        {
            case 
0client_cmd(id"messagemode ^"Razon_de_ban^"");
            case 
1:
            {
                switch(
BanTime[id])
                {
                    case 
0..3:
                    {
                        
BanTime[id]++
                    }
                    case 
4BanTime[id] = 0;
                }
                
menu_to_player(id)
            }
            case 
2:
            {
                
BanTime[id] = 0
                client_cmd
(id"amx_ban ^"#%i^" ^"%d^" ^"%s^"", get_user_userid(playerid), TiempoDeBan[BanTime[id]][tiempo], g_szBanRazon[id])
                
formatex(g_szBanRazon[id], charsmax(g_szBanRazon), "")
            }
        }
    }
    else if(
Seccion[id] == KICK)
    {
        switch(
item)
        {
            case 
0client_cmd(id"messagemode ^"Razon_de_kick^""); 
            case 
1:
            {
                
client_cmd(id"amx_kick #%i 'Razon: %s'"get_user_userid(playerid), g_szKickRazon[id])    
                
formatex(g_szKickRazon[id], charsmax(g_szKickRazon), "")                            
            }
        }
    
    }

    return 
PLUGIN_HANDLED;
}

public 
IngRazonBan(index)
{
    
read_args(g_szBanRazon[index], charsmax(g_szBanRazon[]));
    
remove_quotes(g_szBanRazon[index]);
    
trim(g_szBanRazon[index]);

    if( 
strlen(g_szBanRazon[index]) < 
    {
        
client_print(indexprint_center"Razon muy corta"); 
        
client_cmd(index"messagemode ^"Razon_de_ban^"");    
        return 
PLUGIN_HANDLED
    }

    if( 
strlen(g_szBanRazon[index]) > 20 )
    {
        
client_print(indexprint_center"Razon muy larga"); 
        
client_cmd(index"messagemode ^"Razon_de_ban^"");
        return 
PLUGIN_HANDLED
    }

    
menu_to_player(index)
    return 
PLUGIN_HANDLED;


public 
IngRazonKick(index)
{
    
read_args(g_szKickRazon[index], charsmax(g_szKickRazon[]));
    
remove_quotes(g_szKickRazon[index]);
    
trim(g_szKickRazon[index]);

    if( 
strlen(g_szKickRazon[index]) < 
    {
        
client_print(indexprint_center"Razon muy corta"); 
        
client_cmd(index"messagemode ^"Razon_de_kick^"");    
        return 
PLUGIN_HANDLED
    }

    if( 
strlen(g_szKickRazon[index]) > 20 )
    {
        
client_print(indexprint_center"Razon muy larga"); 
        
client_cmd(index"messagemode ^"Razon_de_kick^"");
        return 
PLUGIN_HANDLED
    }

    
menu_to_player(index)
    return 
PLUGIN_HANDLED;



Código:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "fmt" on line 80
Error: Undefined symbol "fmt" on line 88
Error: Undefined symbol "fmt" on line 131
Error: Undefined symbol "fmt" on line 132
Error: Undefined symbol "fmt" on line 134
Error: Undefined symbol "fmt" on line 136

6 Errors.
Could not locate output file C:\Users\Reynolds\Desktop\bankick.amx (compile failed).
"Cada golpe es una lección, y cada lección te hace mejor."

[Imagen: b_350_20_000000_8a7300_ffffff_eeff00.png]
[Imagen: 76561198371193937.png]
Responder
#2
Te falta crear la variable "fmt"
Responder
#3
fmt es de AMXX 1.9.0
Responder
#4
(13/04/2019, 01:36 PM)metita escribió: fmt es de AMXX 1.9.0

Gracias, no tenia idea que es de 1.9
"Cada golpe es una lección, y cada lección te hace mejor."

[Imagen: b_350_20_000000_8a7300_ffffff_eeff00.png]
[Imagen: 76561198371193937.png]
Responder
#5
Algo anda mal...
Código PHP:
#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author" 
Responder
#6
(13/04/2019, 01:36 PM)metita escribió: fmt es de AMXX 1.9.0

1.8.3
Competitive/Face it Pick Up Game (PUG) servidor de prueba: 45.77.94.109:27016 Click para Entrar
[Imagen: b_350_20_5A6C3E_383F2D_D2E1B5_2E3226.png]

(14/08/2015, 10:15 PM)Sugisaki escribió: "El mundo es caotico, irracional e injusto. No tiene ningun significado"
Palabras que desde hace mucho tiempo he buscado para describir, ¿Que es el mundo?
Crab

Código PHP:
if(ayuda && free)
{
    exit();

Responder
#7
Proba si te anda esto...
server_print(fmt("su nombre es %s", "jose"));
Código PHP:
const MAX_FMT_LENGTH 256;
stock fmt(const format[], any:...)
{
    static 
formatted[MAX_FMT_LENGTH];
    
vformat(formattedcharsmax(formatted), format2);
    
#emit LOAD.S.PRI 0x8 // Get size of arguments (count of arguments multiply by sizeof(cell))
    #emit ADDR.ALT 0xC // This is the pointer to first argument
    #emit ADD // Now in PRI we have the pointer to hidden return argument
    #emit LOAD.I // Now in PRI we have the pointer to return buffer
    #emit MOVE.ALT
    #emit CONST.PRI formatted
    
const MAX_FMT_LENGTH_X4 MAX_FMT_LENGTH 4;
    
#emit MOVS MAX_FMT_LENGTH_X4 // Copy from formatted buffer to return buffer
    //encrypt(formatted, charsmax(formatted));
    #emit RETN // Don't execute the code for copy return generated by compiler
    
return formatted;

Responder
#8
(13/04/2019, 08:17 PM)Kreeze escribió: Proba si te anda esto...
server_print(fmt("su nombre es %s", "jose"));
Código PHP:
const MAX_FMT_LENGTH 256;
stock fmt(const format[], any:...)
{
    static 
formatted[MAX_FMT_LENGTH];
    
vformat(formattedcharsmax(formatted), format2);
    
#emit LOAD.S.PRI 0x8 // Get size of arguments (count of arguments multiply by sizeof(cell))
    #emit ADDR.ALT 0xC // This is the pointer to first argument
    #emit ADD // Now in PRI we have the pointer to hidden return argument
    #emit LOAD.I // Now in PRI we have the pointer to return buffer
    #emit MOVE.ALT
    #emit CONST.PRI formatted
    
const MAX_FMT_LENGTH_X4 MAX_FMT_LENGTH 4;
    
#emit MOVS MAX_FMT_LENGTH_X4 // Copy from formatted buffer to return buffer
    //encrypt(formatted, charsmax(formatted));
    #emit RETN // Don't execute the code for copy return generated by compiler
    
return formatted;


Muchas gracias, en amxx 1.9 no me saltaba el error, coloqué el stock con 1.8.2 y compiló. Gran sonrisa una excelente forma para los que no quieran o puedan pasarse a amxx 1.9
"Cada golpe es una lección, y cada lección te hace mejor."

[Imagen: b_350_20_000000_8a7300_ffffff_eeff00.png]
[Imagen: 76561198371193937.png]
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)