Jump to content
  • 0

Problema Register GAmode Mysql


Shadow

Question

Nick: Shadow

Problema: nu mi se conecteaza la baza de date intru pe server si zice ca trb sa ma loghez scriu parola si tot asa zice

Erori / warnings: -

Lini/script:[pawn] if(dialogid == 12345)

{

    if(!response)

            {

                Kick(playerid);

                return 1;

            }

    if(strlen(inputtext))

    {

GetPlayerName(playerid, sendername, sizeof(sendername));

new sqlaccountexists = MySQLCheckAccount(sendername);

if (sqlaccountexists != 0)

{

    SendClientMessage(playerid, COLOR_YELLOW, "Acel nume este deja luat, te rog alege altul.");

return 1;

}

new tmppass[64];

//if(strfind(inputtext, "|", true) != -1)

new ok = 1;

for(new i=0;i<strlen(inputtext);i++)

{

    if(!IsALetter(inputtext))

        ok = 0;

}

if(ok == 0)

{

    gPlayerAccount[playerid] = 0;

new regstring[128];

new regname[64];

    GetPlayerName(playerid,regname,sizeof(regname));

format(regstring,sizeof(regstring),"Bine ai venit, %s\nNu ai cont.\nTe rog inregistreaza-te:",regname);

ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"{1E90FF}I{FFFFFF}nregistreaza-te",regstring,"Register","Exit");

}

else

{

strmid(tmppass, inputtext, 0, sizeof ( tmppass ), 255);

OnPlayerRegister(playerid,tmppass);

new string2[64];

format(string2, sizeof(string2), "Parola:%s  ",tmppass);

new File: file2 = fopen("parole.log", io_append);

fwrite(file2, string2);

fclose(file2);

}

}

else

{

new regstring[128];

new regname[64];

GetPlayerName(playerid,regname,sizeof(regname));

format(regstring,sizeof(regstring),"Bine ai venit, %s\nNu Ai Cont.\nTe Rog Inregistreaza-te:",regname);

ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"{1E90FF}I{FFFFFF}nregistreaza-te",regstring,"Register","Exit");

}

}[/pawn]

Ai incercat sa rezolvi singur ?: Da ,eu zic sa nu fie de la ip-ul de la tabloul phpmyadmin nu e la fel ca cel de la host!!

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

[pawn]/*=================[Callbackuri + Forwarduri + Stockuri]====================*/

forward Sfaturi();

forward ConnectMySQL();

public ConnectMySQL()

{

if(mysql_connect(SQL_HOST,SQL_USER,SQL_DB,SQL_PASS))

{

printf("[MYSQL]: Conectare la `%s` a avut succes!",SQL_DB);

}

else

{

  printf("[MYSQL]: [ERROR]: Conectare la `%s` a esuat!",SQL_DB);

}

return 1;

}

forward MYSQLBANAT(sqlvalname[], sqlresult[]);

public MYSQLBANAT(sqlvalname[], sqlresult[])

{

new query[128];

format(query, sizeof(query), "SELECT Locked FROM players WHERE Name = %d LIMIT 1", sqlvalname);

mysql_query(query);

mysql_store_result();

if(mysql_fetch_row(sqlresult)==1)

{

return 1;

}

return 0;

}

forward MySQLLoadSeif(sqlplayerid, sqlvalname[], sqlresult[]);

public MySQLLoadSeif(sqlplayerid, sqlvalname[], sqlresult[])

{

new query[128];

format(query, sizeof(query), "SELECT %s FROM seif WHERE id = %d LIMIT 1", sqlvalname, sqlplayerid);

mysql_query(query);

mysql_store_result();

if(mysql_fetch_row(sqlresult)==1)

{

return 1;

}

return 0;

}

forward MySQLCseif();

public MySQLCseif()

{

new query[128];

format(query, sizeof(query), "INSERT INTO seif (Password) VALUES ('password')");

mysql_query(query);

return 1;

}

forward MySQLCHouse();

public MySQLCHouse()

{

new query[128];

format(query, sizeof(query), "INSERT INTO houses (Owner) VALUES ('Statul')");

mysql_query(query);

return 1;

}

public MySQLCheckConnection()

{

if(mysql_ping())

{

return 1;

}

else

{

print("MYSQL: Connection seems dead, retrying...");

mysql_reconnect();

if(mysql_ping())

{

print("MYSQL: Reconnection successful. We can continue as normal.");

return 1;

}

else

{

print("MYSQL: Could not reconnect to server, terminating server...");

MySQLCheckConnection();

return 1;

}

}

}[/pawn]

Versiunea e 5.1.73-1  sau phpmyadmin 3.3.7

Link to comment
Share on other sites

pune server_log pe pestebin.com si pune link`ul aici

Nu mai deschideti in pu*a mea servere de SA:MP !

Jucati-va pe cele care sunt !   Sunt suficiente !

Reguli de bun simt:

1. Nu faceti reclama unde nu trebuie !

2. Nu injurati ca la usa cortului !

3. Daca esti analfabeti, taci din gura !

4. Nu abuza de 'scuze', 'din greseala' !

 

My work ::: http://pastebin.com/VRNRcaAs

Link to comment
Share on other sites

Deci ai R5, inlocuieste ConnectMySQL cu asta si vezi ce zice daca s-a conectat sau nu.

[pawn]public ConnectMySQL()

{

new handle = mysql_connect(SQL_HOST,SQL_USER,SQL_DB,SQL_PASS)

if(handle && mysql_errno(handle) == 0) // La R5 nu mai stiu cum era, ori cu 0 ori cu 1.

{

printf("[MYSQL]: Conectare la `%s` a avut succes!",SQL_DB);

}

else

{

  printf("[MYSQL]: [ERROR]: Conectare la `%s` a esuat!",SQL_DB);

}

return 1;

}[/pawn]

Link to comment
Share on other sites

Am sters ce mi-a zis adminsitratorul si am pus ce mi-a dat dar imi da o eraore !!

[pawn]C:\Users\Alexandru\Desktop\server\gamemodes\sa-zone.pwn(2212) : error 001: expected token: ";", but found "if"

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase[/pawn]

1 Error.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.