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

[ES] Cambiar el menu de registro


  
 
 
Thread Tools Display Modes
Author Message
Ciio
Veteran Member
Join Date: Oct 2009
Location: Arica, Chile
Old 11-22-2010 , 18:11   [ES] Cambiar el menu de registro
#1

Hola ^^ bueno me puse a ver el plugin de parpadeo y lo probe (con un zp virgen), la cosa esque el menu de registro sale al inicio de la partida, y sale apenas uno aparece, no alcanzo a apretar "registrar" y me sale el menu de las armas del zp, quise editarlo, pero me aleje mucho del pawn y no encuentro como mierda xd.. estoy medio perdido y queria ver si me podian ayudar a cambiarlo al tipico, osea que salga cuando uno entra al servidor y se le borre el "elegir team" y le aparesca "Login" y "registrarce".

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <sqlx>

#define PLUGIN "Creacion cuenta + pw"
#define VERSION "0.1"
#define AUTHOR ";SoNNy"

#define AUTO_TEAM_JOIN_DELAY 0.1
#define is_valid_player(%1) (1 <= %1 <= 32)

//#define DisabledChoiseMenu // Sacarle los "//" para desavilitar el uso de la M ocea choseteam.

new bool:Connected[33]
new 
cvar_password_prefijo
/*================================================================================
                [MySQLx Vars, other]
=================================================================================*/
new Handle:g_hTuple;
new 
NickSQL[33]
new 
passwordSQl[33]
new 
mysqlx_hostmysqlx_usermysqlx_dbmysqlx_pass;

/*================================================================================
                [Iniciacion Plugin]
=================================================================================*/
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
// Comandos en say
    
register_clcmd("ingresar_password""login")
    
register_clcmd("_password""crear_cuenta")
    
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
    
    
#if defined DisabledChoiseMenu
    
register_concmd("chooseteam""cmdtopin")  
    
#endif
    
    // PCVARS
    
cvar_password_prefijo register_cvar("account_password_prefijo""_zw")

    
// Event
    
register_forwardFM_ClientUserInfoChanged"FWClientUserInfoChanged" )
    
register_event("TeamInfo""HookJoinTeam""a""2!UNASSIGNED")
    
    
/*=================================================================================*/
    // SQLx cvars
    
mysqlx_host register_cvar ("reg_host""localhost"); 
    
mysqlx_user register_cvar ("reg_user""usuario"); 
    
mysqlx_pass register_cvar ("reg_pass""pass"); 
    
mysqlx_db   register_cvar ("reg_dbname""Base de datos"); 
    
/*=================================================================================*/
    
MySQLx_Init()
}
/*=================================================================================*/
#if defined DisabledChoiseMenu
public cmdtopin () return PLUGIN_HANDLED  
#endif
/*=================================================================================*/
public client_putinserver(id)
{
    
LoadCuenta(id);
    
Connected[id] = true
}
/*=================================================================================*/
public client_disconnect(id)
{
    
Connected[id] = false
}
/*=================================================================================*/
public FWClientUserInfoChangedIndexBuffer )
{
    if( !
is_user_connectedIndex ) )
        return 
FMRES_IGNORED;
    
    static 
NickName[32], NickOld[32]; get_user_nameIndexNickOld31 )
    
engfuncEngFunc_InfoKeyValueBuffer"name"NickName31 
    
    if( 
equalNickNameNickOld ) )
        return 
FMRES_IGNORED;
    
    
engfuncEngFunc_SetClientKeyValueIndexBuffer"name"NickOld )
    
    
client_cmdIndex"name ^"%s^"; setinfo name ^"%s^""NickOldNickOld )
    
    return 
FMRES_SUPERCEDE;
}  
/*================================================================================
                [MENU Join]
=================================================================================*/
public HookJoinTeam() 

    static 
idid read_data(1)
    
    switch(
CheckCuentaMenu(id))
    {
        case 
0..3:
        {
            if(
Connected[id])
            {
                new 
Menu menu_create("\yMenu de Login/Registro""showMenuLoginReg"
                
menu_additem(Menu"\wLogin"            "1"0
                
menu_additem(Menu"\wRegistrar Cuenta"    "2"0
                 
                
menu_setprop(Menu,MPROP_EXITNAME,"Salir"
                
menu_setprop(MenuMPROP_EXITMEXIT_ALL
                 
                
menu_display(idMenu0
                
Connected[id] = true
            
}
        }

    }
    return 
PLUGIN_HANDLED 

/*=================================================================================*/
public showMenuLoginReg(idMenuitem

    if (
item == MENU_EXIT
    { 
        
menu_destroy(Menu
        return 
PLUGIN_HANDLED 
    

     
    new 
iData[6]; 
    new 
iAccess
    new 
iCallback
    new 
iName[64]; 
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback
      
    switch (
str_to_num(iData)) 
    { 
        case 
1
        { 
            
client_cmd(id"messagemode ingresar_password");
            
Connected[id] = false
        

        case 
2
        { 
            
client_cmd(id"messagemode _password");
            
Connected[id] = false
        

    } 
     
    return 
PLUGIN_HANDLED 


/*================================================================================
                [Func Login y Create Cuenta]
=================================================================================*/
public crear_cuenta(id)
{
    

    if(
NickSQL[id])
    {
        
client_print(idprint_chat"La cuenta Ya Existe... Por Favor Inserte el password de su cuenta")
        
client_cmd(id"messagemode ingresar_password");
    }
    else
    {
        new 
say[300]
        
// Obtenemos en un string lo que escribio como password
        
read_args(saycharsmax(say))
        
// Lo preparamos para analizar
        
remove_quotes(say), trim(say)
        
// Si solamente apreto enter lo omitiremos
        
if(equal(say""))
        return 
PLUGIN_HANDLED
        
// Verificamos que la password solo contenga una palabra
        
if(contain(say" ") != -1)
        {
        
client_print(idprint_chat"La contrasenia debe ser 1 (una) palabra")
        return 
PLUGIN_HANDLED
        
}
        
        
copy(passwordSQl[id], charsmax(passwordSQl), say)
        
        new 
prefijo[8]
        
// Guardamos el nick en la variable 'name'
        
get_user_name(idNickSQL[id], charsmax(NickSQL))
        
SaveCuenta(id);
        
        
get_pcvar_string(cvar_password_prefijoprefijocharsmax(prefijo))
        
client_cmd(id"setinfo %s %s"prefijopasswordSQl[id])
        
client_cmd(id"writecfg config")
        
client_print(idprint_chat"Has sido registrado!. Nick: %s - Password: %s"NickSQL[id], passwordSQl[id])
        
engclient_cmd(id"joinclass""5");
        
Connected[id] = false
        
    
}    
    
    return 
PLUGIN_CONTINUE
}
/*=================================================================================*/
public login(id)
{
    new 
say[300]

    
read_args(saycharsmax(say))
    
remove_quotes(say), trim(say)

    if(
equal(say""))
    return 
PLUGIN_HANDLED

    
if(contain(say" ") != -1)
    {
    
client_print(idprint_chat"La contrasenia debe ser 1 (una) palabra")
    return 
PLUGIN_HANDLED
    
}
    
    new 
password[32]
    
copy(passwordcharsmax(password), say)
    
    new 
name[32], prefijo[8]
    
get_user_name(idnamecharsmax(name))
    
    if(!
NickSQL[id])
    {    
        
// Al no existir, cancelamos
        
client_print(idprint_chat"Debes Registrarte!... Ingresa una Contraseņa para registrar nueva cuenta.");
        
client_cmd(id"messagemode _password");
        
Connected[id] = true;
        return 
PLUGIN_HANDLED
    
}
     
    
get_pcvar_string(cvar_password_prefijoprefijocharsmax(prefijo))
    
    if(
equali(passwordSQl[id], password)) 
    { 
        
client_print(idprint_chat"* [ZP] Contraseņa Aceptada"
        
client_print(idprint_center"Login Exitoso!")
        
client_cmd(id"setinfo ^"%s^" ^"%s^"",prefijo,password)
        
client_cmd(id"writecfg config")
        
engclient_cmd(id"joinclass""5"); 
        
Connected[id] = false;
    } 
    else 
    { 
        
client_cmd(id"messagemode ingresar_password");
        
ChatColor(id"!g[ZP]!y Debe Ingresar su Contraseņa para Acceder a su cuenta!"
        
HookJoinTeam();
        
Connected[id] = true;
    } 
    
    return 
PLUGIN_HANDLED
}
/*=================================================================================*/
CheckCuentaMenu(id)
{
    new 
password[32]
    
    
get_datos(idpassword)
    
    if(!
NickSQL[id])
    {    
        
// Al no existir, cancelamos
        
return 0
    
}
    if(
equali(passwordSQl[id], password)) 
    { 
        
engclient_cmd(id"joinclass""5"); 
        
Connected[id] = false;
    } 
    else 
    { 
        
Connected[id] = true;
        return 
2
    


    return 
PLUGIN_HANDLED
}
/*=================================================================================*/
get_datos(id,password[32])
{
    new 
prefijo[8]
    
get_pcvar_string(cvar_password_prefijoprefijocharsmax(prefijo))
    
get_user_info(idprefijopasswordcharsmax(password))
}
/*================================================================================
                [Auto Join]
=================================================================================*/
public message_show_menu(msgiddestid
{

    static 
team_select[] = "#Team_Select"
    
static menu_text_code[sizeof team_select]
    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1)
    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}
/*=================================================================================*/
set_force_team_join_task(idmenu_msgid)
{
    static 
param_menu_msgid[2]
    
param_menu_msgid[0] = menu_msgid
    set_task
(AUTO_TEAM_JOIN_DELAY"task_force_team_join"idparam_menu_msgidsizeof param_menu_msgid)
}
/*=================================================================================*/
public task_force_team_join(menu_msgid[], id
{
    if (
get_user_team(id))
        return

    
force_team_join(id)
}


/*================================================================================
                [MySQLx]
=================================================================================*/
public MySQLx_Init()
{
    new 
szHost[64], szUser[32], szPass[32], szDB[128];
    
    
get_pcvar_stringmysqlx_hostszHostcharsmaxszHost ) );
    
get_pcvar_stringmysqlx_userszUsercharsmaxszUser ) );
    
get_pcvar_stringmysqlx_passszPasscharsmaxszPass ) );
    
get_pcvar_stringmysqlx_dbszDBcharsmaxszDB ) );
    
    
g_hTuple SQL_MakeDbTupleszHostszUserszPassszDB );
    
}
/*=================================================================================*/
SaveCuenta(id)

    static 
szQuery128 ]; 
    
formatexszQuery127"REPLACE INTO `account` (`nick`, `password`) VALUES ('%s', '%s');"NickSQL[id] , passwordSQl[id] );
    
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery);
}
/*=================================================================================*/

LoadCuenta(id)
{
    static 
szQuery128 ], iData];
    new 
zwname[33]
    
get_user_name(id,zwname,charsmax(zwname))
    
    
formatexszQuery127"SELECT `nick`, `password` FROM `account` WHERE ( `nick` = '%s' );"zwname );  

    
iData] = id;
    
SQL_ThreadQueryg_hTuple"QuerySelectData"szQueryiData);
}
/*=================================================================================*/

public QuerySelectDataiFailStateHandle:hQueryszError[ ], iErroriData[ ], iDataSizeFloat:fQueueTime 

    if( 
iFailState == TQUERY_CONNECT_FAILED 
    
|| iFailState == TQUERY_QUERY_FAILED 
    { 
        
log_amx"%s"szError );
        
        return;
    } 
    else 
    { 
        new 
id iData];
        
        new 
ColPass SQL_FieldNameToNum(hQuery"password"
        new 
ColName SQL_FieldNameToNum(hQuery"nick")
        
        while (
SQL_MoreResults(hQuery)) 
        {
            
SQL_ReadResult(hQueryColNameNickSQL[id], charsmax(NickSQL))
            
SQL_ReadResult(hQueryColPasspasswordSQl[id], charsmax(passwordSQl))
            
SQL_NextRow(hQuery)
        }
    } 
}
/*=================================================================================*/
public QuerySetDataiFailStateHandle:hQueryszError[ ], iErroriData[ ], iDataSizeFloat:fQueueTime 

    if( 
iFailState == TQUERY_CONNECT_FAILED 
    
|| iFailState == TQUERY_QUERY_FAILED 
    { 
        
log_amx"%s"szError ); 
        
        return;
    } 

/*================================================================================
                [Stocks]
=================================================================================*/
stock force_team_join(id
{
    static 
jointeam[] = "jointeam"
    
engclient_cmd(idjointeam"5")
    return
}
/*=================================================================================*/
stock check_user_name(id, const name[32] = "")
{
    new 
plrname[32]
   
    if(
equal(name""))
    {
        
get_user_name(idplrname31)
    }
    else
    {
        
plrname name
    
}
    
//load_cuentas(id)
}
/*=================================================================================*/
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
         for (new 
0counti++)
         {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
         }
         }
     
    }
}
/*=================================================================================*/ 
Gracias ^^
__________________
Ciio is offline
Send a message via MSN to Ciio
Tinchooo
BANNED
Join Date: Oct 2010
Old 11-23-2010 , 20:02   Re: [ES] Cambiar el menu de registro
#2

La Verdad que ni Idea quisas Agregandole algo para que se Abra el Menu tipeando /registrarse pero ni idea como
Tinchooo is offline
p4rp4d30
Veteran Member
Join Date: Mar 2007
Old 11-23-2010 , 21:02   Re: [ES] Cambiar el menu de registro
#3

Quote:
Originally Posted by Ciio View Post
Hola ^^ bueno me puse a ver el plugin de parpadeo y lo probe (con un zp virgen), la cosa esque el menu de registro sale al inicio de la partida, y sale apenas uno aparece, no alcanzo a apretar "registrar" y me sale el menu de las armas del zp, quise editarlo, pero me aleje mucho del pawn y no encuentro como mierda xd.. estoy medio perdido y queria ver si me podian ayudar a cambiarlo al tipico, osea que salga cuando uno entra al servidor y se le borre el "elegir team" y le aparesca "Login" y "registrarce".

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <sqlx>

#define PLUGIN "Creacion cuenta + pw"
#define VERSION "0.1"
#define AUTHOR ";SoNNy"

#define AUTO_TEAM_JOIN_DELAY 0.1
#define is_valid_player(%1) (1 <= %1 <= 32)

//#define DisabledChoiseMenu // Sacarle los "//" para desavilitar el uso de la M ocea choseteam.

new bool:Connected[33]
new 
cvar_password_prefijo
/*================================================================================
                [MySQLx Vars, other]
=================================================================================*/
new Handle:g_hTuple;
new 
NickSQL[33]
new 
passwordSQl[33]
new 
mysqlx_hostmysqlx_usermysqlx_dbmysqlx_pass;

/*================================================================================
                [Iniciacion Plugin]
=================================================================================*/
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
// Comandos en say
    
register_clcmd("ingresar_password""login")
    
register_clcmd("_password""crear_cuenta")
    
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
    
    
#if defined DisabledChoiseMenu
    
register_concmd("chooseteam""cmdtopin")  
    
#endif
    
    // PCVARS
    
cvar_password_prefijo register_cvar("account_password_prefijo""_zw")

    
// Event
    
register_forwardFM_ClientUserInfoChanged"FWClientUserInfoChanged" )
    
register_event("TeamInfo""HookJoinTeam""a""2!UNASSIGNED")
    
    
/*=================================================================================*/
    // SQLx cvars
    
mysqlx_host register_cvar ("reg_host""localhost"); 
    
mysqlx_user register_cvar ("reg_user""usuario"); 
    
mysqlx_pass register_cvar ("reg_pass""pass"); 
    
mysqlx_db   register_cvar ("reg_dbname""Base de datos"); 
    
/*=================================================================================*/
    
MySQLx_Init()
}
/*=================================================================================*/
#if defined DisabledChoiseMenu
public cmdtopin () return PLUGIN_HANDLED  
#endif
/*=================================================================================*/
public client_putinserver(id)
{
    
LoadCuenta(id);
    
Connected[id] = true
}
/*=================================================================================*/
public client_disconnect(id)
{
    
Connected[id] = false
}
/*=================================================================================*/
public FWClientUserInfoChangedIndexBuffer )
{
    if( !
is_user_connectedIndex ) )
        return 
FMRES_IGNORED;
    
    static 
NickName[32], NickOld[32]; get_user_nameIndexNickOld31 )
    
engfuncEngFunc_InfoKeyValueBuffer"name"NickName31 
    
    if( 
equalNickNameNickOld ) )
        return 
FMRES_IGNORED;
    
    
engfuncEngFunc_SetClientKeyValueIndexBuffer"name"NickOld )
    
    
client_cmdIndex"name ^"%s^"; setinfo name ^"%s^""NickOldNickOld )
    
    return 
FMRES_SUPERCEDE;
}  
/*================================================================================
                [MENU Join]
=================================================================================*/
public HookJoinTeam() 

    static 
idid read_data(1)
    
    switch(
CheckCuentaMenu(id))
    {
        case 
0..3:
        {
            if(
Connected[id])
            {
                new 
Menu menu_create("\yMenu de Login/Registro""showMenuLoginReg"
                
menu_additem(Menu"\wLogin"            "1"0
                
menu_additem(Menu"\wRegistrar Cuenta"    "2"0
                 
                
menu_setprop(Menu,MPROP_EXITNAME,"Salir"
                
menu_setprop(MenuMPROP_EXITMEXIT_ALL
                 
                
menu_display(idMenu0
                
Connected[id] = true
            
}
        }

    }
    return 
PLUGIN_HANDLED 

/*=================================================================================*/
public showMenuLoginReg(idMenuitem

    if (
item == MENU_EXIT
    { 
        
menu_destroy(Menu
        return 
PLUGIN_HANDLED 
    

     
    new 
iData[6]; 
    new 
iAccess
    new 
iCallback
    new 
iName[64]; 
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback
      
    switch (
str_to_num(iData)) 
    { 
        case 
1
        { 
            
client_cmd(id"messagemode ingresar_password");
            
Connected[id] = false
        

        case 
2
        { 
            
client_cmd(id"messagemode _password");
            
Connected[id] = false
        

    } 
     
    return 
PLUGIN_HANDLED 


/*================================================================================
                [Func Login y Create Cuenta]
=================================================================================*/
public crear_cuenta(id)
{
    

    if(
NickSQL[id])
    {
        
client_print(idprint_chat"La cuenta Ya Existe... Por Favor Inserte el password de su cuenta")
        
client_cmd(id"messagemode ingresar_password");
    }
    else
    {
        new 
say[300]
        
// Obtenemos en un string lo que escribio como password
        
read_args(saycharsmax(say))
        
// Lo preparamos para analizar
        
remove_quotes(say), trim(say)
        
// Si solamente apreto enter lo omitiremos
        
if(equal(say""))
        return 
PLUGIN_HANDLED
        
// Verificamos que la password solo contenga una palabra
        
if(contain(say" ") != -1)
        {
        
client_print(idprint_chat"La contrasenia debe ser 1 (una) palabra")
        return 
PLUGIN_HANDLED
        
}
        
        
copy(passwordSQl[id], charsmax(passwordSQl), say)
        
        new 
prefijo[8]
        
// Guardamos el nick en la variable 'name'
        
get_user_name(idNickSQL[id], charsmax(NickSQL))
        
SaveCuenta(id);
        
        
get_pcvar_string(cvar_password_prefijoprefijocharsmax(prefijo))
        
client_cmd(id"setinfo %s %s"prefijopasswordSQl[id])
        
client_cmd(id"writecfg config")
        
client_print(idprint_chat"Has sido registrado!. Nick: %s - Password: %s"NickSQL[id], passwordSQl[id])
        
engclient_cmd(id"joinclass""5");
        
Connected[id] = false
        
    
}    
    
    return 
PLUGIN_CONTINUE
}
/*=================================================================================*/
public login(id)
{
    new 
say[300]

    
read_args(saycharsmax(say))
    
remove_quotes(say), trim(say)

    if(
equal(say""))
    return 
PLUGIN_HANDLED

    
if(contain(say" ") != -1)
    {
    
client_print(idprint_chat"La contrasenia debe ser 1 (una) palabra")
    return 
PLUGIN_HANDLED
    
}
    
    new 
password[32]
    
copy(passwordcharsmax(password), say)
    
    new 
name[32], prefijo[8]
    
get_user_name(idnamecharsmax(name))
    
    if(!
NickSQL[id])
    {    
        
// Al no existir, cancelamos
        
client_print(idprint_chat"Debes Registrarte!... Ingresa una Contraseņa para registrar nueva cuenta.");
        
client_cmd(id"messagemode _password");
        
Connected[id] = true;
        return 
PLUGIN_HANDLED
    
}
     
    
get_pcvar_string(cvar_password_prefijoprefijocharsmax(prefijo))
    
    if(
equali(passwordSQl[id], password)) 
    { 
        
client_print(idprint_chat"* [ZP] Contraseņa Aceptada"
        
client_print(idprint_center"Login Exitoso!")
        
client_cmd(id"setinfo ^"%s^" ^"%s^"",prefijo,password)
        
client_cmd(id"writecfg config")
        
engclient_cmd(id"joinclass""5"); 
        
Connected[id] = false;
    } 
    else 
    { 
        
client_cmd(id"messagemode ingresar_password");
        
ChatColor(id"!g[ZP]!y Debe Ingresar su Contraseņa para Acceder a su cuenta!"
        
HookJoinTeam();
        
Connected[id] = true;
    } 
    
    return 
PLUGIN_HANDLED
}
/*=================================================================================*/
CheckCuentaMenu(id)
{
    new 
password[32]
    
    
get_datos(idpassword)
    
    if(!
NickSQL[id])
    {    
        
// Al no existir, cancelamos
        
return 0
    
}
    if(
equali(passwordSQl[id], password)) 
    { 
        
engclient_cmd(id"joinclass""5"); 
        
Connected[id] = false;
    } 
    else 
    { 
        
Connected[id] = true;
        return 
2
    


    return 
PLUGIN_HANDLED
}
/*=================================================================================*/
get_datos(id,password[32])
{
    new 
prefijo[8]
    
get_pcvar_string(cvar_password_prefijoprefijocharsmax(prefijo))
    
get_user_info(idprefijopasswordcharsmax(password))
}
/*================================================================================
                [Auto Join]
=================================================================================*/
public message_show_menu(msgiddestid
{

    static 
team_select[] = "#Team_Select"
    
static menu_text_code[sizeof team_select]
    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1)
    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}
/*=================================================================================*/
set_force_team_join_task(idmenu_msgid)
{
    static 
param_menu_msgid[2]
    
param_menu_msgid[0] = menu_msgid
    set_task
(AUTO_TEAM_JOIN_DELAY"task_force_team_join"idparam_menu_msgidsizeof param_menu_msgid)
}
/*=================================================================================*/
public task_force_team_join(menu_msgid[], id
{
    if (
get_user_team(id))
        return

    
force_team_join(id)
}


/*================================================================================
                [MySQLx]
=================================================================================*/
public MySQLx_Init()
{
    new 
szHost[64], szUser[32], szPass[32], szDB[128];
    
    
get_pcvar_stringmysqlx_hostszHostcharsmaxszHost ) );
    
get_pcvar_stringmysqlx_userszUsercharsmaxszUser ) );
    
get_pcvar_stringmysqlx_passszPasscharsmaxszPass ) );
    
get_pcvar_stringmysqlx_dbszDBcharsmaxszDB ) );
    
    
g_hTuple SQL_MakeDbTupleszHostszUserszPassszDB );
    
}
/*=================================================================================*/
SaveCuenta(id)

    static 
szQuery128 ]; 
    
formatexszQuery127"REPLACE INTO `account` (`nick`, `password`) VALUES ('%s', '%s');"NickSQL[id] , passwordSQl[id] );
    
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery);
}
/*=================================================================================*/

LoadCuenta(id)
{
    static 
szQuery128 ], iData];
    new 
zwname[33]
    
get_user_name(id,zwname,charsmax(zwname))
    
    
formatexszQuery127"SELECT `nick`, `password` FROM `account` WHERE ( `nick` = '%s' );"zwname );  

    
iData] = id;
    
SQL_ThreadQueryg_hTuple"QuerySelectData"szQueryiData);
}
/*=================================================================================*/

public QuerySelectDataiFailStateHandle:hQueryszError[ ], iErroriData[ ], iDataSizeFloat:fQueueTime 

    if( 
iFailState == TQUERY_CONNECT_FAILED 
    
|| iFailState == TQUERY_QUERY_FAILED 
    { 
        
log_amx"%s"szError );
        
        return;
    } 
    else 
    { 
        new 
id iData];
        
        new 
ColPass SQL_FieldNameToNum(hQuery"password"
        new 
ColName SQL_FieldNameToNum(hQuery"nick")
        
        while (
SQL_MoreResults(hQuery)) 
        {
            
SQL_ReadResult(hQueryColNameNickSQL[id], charsmax(NickSQL))
            
SQL_ReadResult(hQueryColPasspasswordSQl[id], charsmax(passwordSQl))
            
SQL_NextRow(hQuery)
        }
    } 
}
/*=================================================================================*/
public QuerySetDataiFailStateHandle:hQueryszError[ ], iErroriData[ ], iDataSizeFloat:fQueueTime 

    if( 
iFailState == TQUERY_CONNECT_FAILED 
    
|| iFailState == TQUERY_QUERY_FAILED 
    { 
        
log_amx"%s"szError ); 
        
        return;
    } 

/*================================================================================
                [Stocks]
=================================================================================*/
stock force_team_join(id
{
    static 
jointeam[] = "jointeam"
    
engclient_cmd(idjointeam"5")
    return
}
/*=================================================================================*/
stock check_user_name(id, const name[32] = "")
{
    new 
plrname[32]
   
    if(
equal(name""))
    {
        
get_user_name(idplrname31)
    }
    else
    {
        
plrname name
    
}
    
//load_cuentas(id)
}
/*=================================================================================*/
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
         for (new 
0counti++)
         {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
         }
         }
     
    }
}
/*=================================================================================*/ 
Gracias ^^
El menu esta echo que apenas entres al server aparesca el menu donde podes Logearte o Registrar

Ahora si vos te registrartes y ya tenes la setinfo con tu password cuando volves a entrar o haces retry el login valida tu setinfo y entonces te deja entrar directamente no hace falta que te aparesca el MENU... si qures que te aparesca el menu pones setinfo _zw "" apretas enter y haces retry y te aparece el menu de login o registro

Puse que valide el setinfo y busque a la db si el user que tiene y el pass en setinfo esta bien en db si esta bien entonces te deja entrar directamaente al server y no te aparece el menu ya que lo vi al pedo que cada ves que entres te tenga que aparecer el menu ocea es irritador que te tengas que logear siempre cada ves que entras xD

salu2
p4rp4d30 is offline
 



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 06:41.


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