SA-MP Forums Archive
ayuda en localhots - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: ayuda en localhots (/showthread.php?tid=627225)



ayuda en localhots - GOM3Z - 25.01.2017

Intento subir la base de mysql de KRISSTI4N y todo bien pero cuando incio el sam server no se me conecta y asi lo tengo en el pawno

Quote:

#define SQL_HOST "localhost"
#define SQL_USUARIO "root"
#define SQL_CONTRA "usb"
#define SQL_DB "servidor"

En #define SQL_DB "servidor" el servidor es la base de datos
Pero cuando conecto el samp-server pone conectando...
y finalmente pone no se pudo conectar


Respuesta: ayuda en localhots - Eloy - 25.01.2017

checa en OnGameModeInit


PHP код:
public OnGameModeInit() 

    
mysql_log(LOG_ALL); 
    
mysql mysql_connect(SQL_HOSTSQL_USUARIOSQL_DBSQL_CONTRA); 
    if(
mysql_errno() != 0
    { 
        
printf("[MySQL] Conexiуn Fallida"); 
        
SendRconCommand("exit");
    } 
    else 
    { 
        
printf("[MySQL] Conexiуn Realizada"); 
    } 
    return 
true

PD: Si la variable donde almacenas la conexiуn es mysql dejala, sino modificala y adaptala


Respuesta: ayuda en localhots - GOM3Z - 25.01.2017

lo tengo asi
Quote:

public OnGameModeInit()
{
SetGameModeText("Roleplay");
MySQL = mysql_connect(SQL_HOST,SQL_USUARIO,SQL_DB,SQL_CONT RA);
print("Conectando...");
if(mysql_errno() != 0)
{
print("No se pudo conectar.");
}
else
{
print("Conectado.");
}
return 1;
}




Respuesta: ayuda en localhots - mcreed - 26.01.2017

Si tu versiуn del plugin MySQL es igual o superior a la R40, entonces seria de la siguiente manera:
PHP код:
// Declaraciуn de la variable.
new MySQL:hMySQL;
// Callback OnGameModeInit.
public OnGameModeInit()
{
    
SetGameModeText("Roleplay");
    
hMySQL mysql_connect(SQL_HOSTSQL_USUARIOSQL_CONTRASQL_DB);
    print(
"Conectando...");
    if(
mysql_errno() != 0)
    {
        print(
"No se pudo conectar.");
    }
    else
    {
        print(
"Conectado.");
    }
    return 
1;

Quote:
+R40 sufriу cambios en la ubicaciуn de los parametros de mysql_connect.

Quote:

Tambiйn se aсadio el tag MySQL, por eso al momento de crear la variable de conexiуn le aсadн dicho tag.

En caso de que tengas una versiуn anterior a la R40, te recomendaria: