[Ajuda] Servidor SQL
#1

Olб galera estou com o seguinte problema, eu tenho 1 servidor em Sql, quando executo o servidor as tabelas sгo criadas automaticamente atй ai normal, quando eu entro no servidor com uma conta pela primeira vez, ele registra e salva no banco de dados normal, sу que quando loga com a mesma conta pela segunda vez o samp_server fecha sozinho, no server_log nгo tem nenhum erro !!! Alguйm pode me ajudar ?
Reply
#2

Da algum erro antes do "samp_server" fechar automaticamente ?
Reply
#3

Quote:
Originally Posted by xJasonxX
Посмотреть сообщение
Da algum erro antes do "samp_server" fechar automaticamente ?
pawn Код:
[13:32:46] Incoming connection: 189.10.38.17:2820
[13:32:46] [join] chupo has joined the server (0:189.10.38.17)
As ъltimas linhas do server_log, ai fecho o samp_server.
Reply
#4

Tem certeza que existe a tabela? a database?
Se estiver usando alguma coisa em .ini, ou atй logs, verifique se existe a pasta.
Reply
#5

Manda o log do mysql! #debug
Reply
#6

Quote:
Originally Posted by Dolpin
Посмотреть сообщение
Tem certeza que existe a tabela? a database?
Se estiver usando alguma coisa em .ini, ou atй logs, verifique se existe a pasta.
Sim, tabelas criadas perfeitamente, utilizo o xampp, tudo certo a conta й registrada quando loga pela primeira vez, a coluna password, que estб me deixando confuso, ela nгo salva a senha q o cara coloca, ela salva um monte de cуdigo tipo ex: ff1211g14451g1h1h2. Serб que pode ser o problema? mais jб coloquei Vchar 40, Int, e nunca salva com os nъmeros corretos, mais acho q isso nгo й o problema, o problema й na segunda vez q loga com a mesma conta o samp_Server fecha sozinho. (Nгo uso .Ini)
Reply
#7

Quote:
Originally Posted by Schocc
Посмотреть сообщение
Manda o log do mysql! #debug
Debug SQL:
pawn Код:
[18:19:05] ---------------------------

[18:19:05] MySQL Debugging activated (12/26/14)

[18:19:05] ---------------------------

[18:19:05]  

[18:19:48] >> mysql_real_escape_string( Connection handle: 1 )

[18:19:48] CMySQLHandler::EscapeString(testandoo); - Escaped 9 characters to testandoo.

[18:19:48] >> mysql_query( Connection handle: 1 )

[18:19:48] CMySQLHandler::Query(SELECT * FROM `bandata` WHERE(`player`='testandoo' OR `IP`='189.10.38.17') AND `banned`=1 LIMIT 1) - Successfully executed.

[18:19:48] >> mysql_store_result( Connection handle: 1 )

[18:19:48] CMySQLHandler::StoreResult() - Result was stored.

[18:19:48] >> mysql_num_rows( Connection handle: 1 )

[18:19:48] CMySQLHandler::NumRows() - Returned 0 row(s)

[18:19:48] >> mysql_free_result( Connection handle: 1 )

[18:19:48] CMySQLHandler::FreeResult() - Result was successfully free'd.

[18:19:48] >> mysql_real_escape_string( Connection handle: 1 )

[18:19:48] CMySQLHandler::EscapeString(testandoo); - Escaped 9 characters to testandoo.

[18:19:48] >> mysql_query( Connection handle: 1 )

[18:19:48] CMySQLHandler::Query(SELECT IP FROM `playerdata` WHERE user = '
testandoo' LIMIT 1) - Successfully executed.

[18:19:48] >> mysql_store_result( Connection handle: 1 )

[18:19:48] CMySQLHandler::StoreResult() - Result was stored.

[18:19:48] >> mysql_num_rows( Connection handle: 1 )

[18:19:48] CMySQLHandler::NumRows() - Returned 0 row(s)

[18:19:48] >> mysql_free_result( Connection handle: 1 )

[18:19:48] CMySQLHandler::FreeResult() - Result was successfully free'
d.

[18:19:54] >> mysql_real_escape_string( Connection handle: 1 )

[18:19:54] CMySQLHandler::EscapeString(1234); - Escaped 4 characters to 1234.

[18:19:54] >> mysql_real_escape_string( Connection handle: 1 )

[18:19:54] CMySQLHandler::EscapeString(testandoo); - Escaped 9 characters to testandoo.

[18:19:54] >> mysql_query( Connection handle: 1 )

[18:19:54] CMySQLHandler::Query(INSERT INTO playerdata(user, password, IP, money, scores, adminlevel, helperlevel, kills, deaths) VALUES('testandoo', SHA1('1234'), '189.10.38.17', 0, 0, 0, 0, 0, 0)) - Successfully executed.

[18:20:05] >> mysql_query( Connection handle: 1 )

[18:20:05] CMySQLHandler::Query(UPDATE `playerdata` SET `scores`='0', `kills`='0' ,`deaths`='0' ,`money`='0' ,`adminlevel`='0' , `helperlevel`='0' WHERE `user`='testandoo') - Successfully executed.

[18:20:28] >> mysql_real_escape_string( Connection handle: 1 )

[18:20:28] CMySQLHandler::EscapeString(testandoo); - Escaped 9 characters to testandoo.

[18:20:28] >> mysql_query( Connection handle: 1 )

[18:20:28] CMySQLHandler::Query(SELECT * FROM `bandata` WHERE(`player`='testandoo' OR `IP`='189.10.38.17') AND `banned`=1 LIMIT 1) - Successfully executed.

[18:20:28] >> mysql_store_result( Connection handle: 1 )

[18:20:28] CMySQLHandler::StoreResult() - Result was stored.

[18:20:28] >> mysql_num_rows( Connection handle: 1 )

[18:20:28] CMySQLHandler::NumRows() - Returned 0 row(s)

[18:20:28] >> mysql_free_result( Connection handle: 1 )

[18:20:28] CMySQLHandler::FreeResult() - Result was successfully free'd.

[18:20:28] >> mysql_real_escape_string( Connection handle: 1 )

[18:20:28] CMySQLHandler::EscapeString(testandoo); - Escaped 9 characters to testandoo.

[18:20:28] >> mysql_query( Connection handle: 1 )

[18:20:28] CMySQLHandler::Query(SELECT IP FROM `playerdata` WHERE user = '
testandoo' LIMIT 1) - Successfully executed.

[18:20:28] >> mysql_store_result( Connection handle: 1 )

[18:20:28] CMySQLHandler::StoreResult() - Result was stored.

[18:20:28] >> mysql_num_rows( Connection handle: 1 )

[18:20:28] CMySQLHandler::NumRows() - Returned 1 row(s)

[18:20:28] >> mysql_free_result( Connection handle: 1 )

[18:20:28] CMySQLHandler::FreeResult() - Result was successfully free'
d.

[18:20:33] >> mysql_real_escape_string( Connection handle: 1 )

[18:20:33] CMySQLHandler::EscapeString(1234); - Escaped 4 characters to 1234.

[18:20:33] >> mysql_query( Connection handle: 1 )

[18:20:33] CMySQLHandler::Query(SELECT `user` FROM playerdata WHERE `user` = 'testandoo' AND `password` = SHA1('1234')) - Successfully executed.

[18:20:33] >> mysql_store_result( Connection handle: 1 )

[18:20:33] CMySQLHandler::StoreResult() - Result was stored.

[18:20:33] >> mysql_num_rows( Connection handle: 1 )

[18:20:33] CMySQLHandler::NumRows() - Returned 1 row(s)

[18:20:33] >> mysql_query( Connection handle: 1 )

[18:20:33] CMySQLHandler::Query(SELECT * FROM playerdata WHERE user = 'testandoo') - Successfully executed.

[18:20:33] >> mysql_store_result( Connection handle: 1 )

[18:20:33] CMySQLHandler::StoreResult() - Result was stored.

[18:20:33] >> mysql_fetch_row_format( Connection handle: 1 )

[18:20:33] CMySQLHandler::FetchRow() - Return: testandoo|7110eda4d09e062aa5e4a390b0a572ac0d2c0220|189.10.38.17|0|0|0|0|0|0|NULL

[18:20:33] >> mysql_fetch_field_row( Connection handle: 1 )
Reply
#8

Vocк tem a callback OnQueryFinish em seu gamemode pra ajudar a identificar o problema ?
Qual й a versгo do mysql que vocк esta usando. ?
Reply
#9

@off: mals o double post!


Vai colocando uns prints na callback OnPlayerConnect, mas pra faзa debug perto de comandos SQL, onde tem instruзхes SQL, pois a probabildade й maior (issso se o problema for relacionado ao banco de dados).
Код:
public OnPlayerConnect(...)
{
    if (CONDICAO FOR VERDADEIRA){
        print("1");
    }
    else if (CONDICAO FOR VERDADEIRA) {
        print("2");
    {
    else {
        print("3");
    }
    return 1;
}
O problema pode ser a redefiniзгo de variбveis, verifique se suas variбveis sгo redefinidas quando o jogador se desconecta do servidor.
Reply
#10

Quote:
Originally Posted by Schocc
Посмотреть сообщение
@off: mals o double post!


Vai colocando uns prints na callback OnPlayerConnect, mas pra faзa debug perto de comandos SQL, onde tem instruзхes SQL, pois a probabildade й maior (issso se o problema for relacionado ao banco de dados).

O problema pode ser a redefiniзгo de variбveis, verifique se suas variбveis sгo redefinidas quando o jogador se desconecta do servidor.
Olha a CallBack OnplayerConnect:
pawn Код:
public OnPlayerConnect(playerid)
{
    format(gString, SOS, "Bem Vindo '%s' ao COD - Mundo em ChamaS v1.00", PlayerName(playerid)); SendClientMessage(playerid, COLOR_GREEN, gString);
    SendClientMessage(playerid, COLOR_GREEN, "See /cmds for server commands and see /help for more info on how to play");
    SendClientMessage(playerid, green, "Use /playstream [link] to play songs");
    SendClientMessage(playerid, green, "Visite http://www.fb/sttlasvegas.com nosso ********");
   
    TogglePlayerSpectating(playerid,true);
    SetPlayerWeather(playerid, 2);
    TextDrawShowForPlayer(playerid, Textdraw[0]);
    TextDrawShowForPlayer(playerid, Textdraw[1]);
    TextDrawShowForPlayer(playerid, Textdraw[2]);
    TextDrawShowForPlayer(playerid, Textdraw[3]);
    TextDrawShowForPlayer(playerid, Textdraw[4]);
    TextDrawShowForPlayer(playerid, Textdraw[5]);
    TextDrawShowForPlayer(playerid, Textdraw[6]);
    TextDrawShowForPlayer(playerid, Textdraw[7]);
    TextDrawShowForPlayer(playerid, Textdraw[8]);
    TextDrawShowForPlayer(playerid, Textdraw[9]);
    TextDrawShowForPlayer(playerid, Textdraw[10]);
   
    if(CountIP(GetIPP(playerid)) >= 6) return Kick(playerid), 0;
    MAX_PLAYERS_ = playerid > MAX_PLAYERS_ ? playerid : GetHighestID(),
    npc[playerid] = bool:IsPlayerNPC(playerid),
    var[playerid] = SetTimerEx("BSS",2500,false,"i",playerid),
    warns[playerid] = 0;
       
    Spree[playerid] = 0;
    DeleteObjects(playerid);
   
    SetPVarInt(playerid, "vehicleid", 0);
   
    foreach (Zones, i)
    {
        SetPlayerMapIcon(playerid, 30 + i, ZoneInfo[i][pointPos][0],ZoneInfo[i][pointPos][1],ZoneInfo[i][pointPos][2], 19, MAPICON_GLOBAL);
        GangZoneShowForAll(Zone[i], 0x00000043);
        CapturingZone[playerid] = -1;
        if (tCP[i] == NONE) GangZoneShowForAll(Zone[i], -66);
        else if (tCP[i] == USA) GangZoneShowForAll(Zone[i], USA_GZ_COLOR);
        else if (tCP[i] == RF) GangZoneShowForAll(Zone[i], RF_GZ_COLOR);
        else if (tCP[i] == AI) GangZoneShowForAll(Zone[i], AI_GZ_COLOR);
        else if (tCP[i] == IU) GangZoneShowForAll(Zone[i], IU_GZ_COLOR);
        else if (tCP[i] == EA) GangZoneShowForAll(Zone[i], EA_GZ_COLOR);
//      else if (tCP[i] == AA) GangZoneShowForAll(Zone[i], AA_GZ_COLOR);
//      else if (tCP[i] == LG) GangZoneShowForAll(Zone[i], LG_GZ_COLOR);
//      else if (tCP[i] == GW) GangZoneShowForAll(Zone[i], GW_GZ_COLOR);
    }

    capturebar[playerid] = CreatePlayerProgressBar(playerid, 40, 320, 100, 10, COLOR_GREEN, 25);

   
   
    ClassTaken[playerid] = 1;
    FirstSpawn[playerid] = 0;
   
    PlayerInfo[playerid][pVIP] = 0; //Setting the VIP level 0 on player connect-
    Enablevheal[playerid] = 1; //Enabling the /vheal command on player connect--
    Enablevbonus[playerid] = 1; //Enabling the /vbonus command on player connect
    HasSpawnedCar[playerid] = 0;//-Setting the value to 0
    //-------------Checking and creating the player account in database---------


   
    new ggString[200];
    format(ggString, sizeof(ggString), "%s has ~g~joined ~w~the server!", PlayerName(playerid));
    //SendClientMessageToAll(-1, ggString);
    SendBoxMessage(playerid, ggString);
   
    MapIcons(playerid);
   

   
   
    //--------------------------------
    GangZoneShowForAll(GZ_ZONE_U, USA_GZ_COLOR); //usa GZ
    GangZoneShowForAll(GZ_ZONE_I, IU_GZ_COLOR); //Indian GZ
    GangZoneShowForAll(GZ_ZONE_E, EA_GZ_COLOR); //euro GZ
    //GangZoneShowForAll(GZ_ZONE4, EA_GZ_COLOR); //europe GZ
    //GangZoneShowForAll(GZ_ZONE5, LG_GZ_COLOR); //latino GZ
    GangZoneShowForAll(GZ_ZONE_R, RF_GZ_COLOR); //Russia GZ
    GangZoneShowForAll(GZ_ZONE_A, AI_GZ_COLOR);//arabia GZ
    //GangZoneShowForAll(GZ_ZONE8, AA_GZ_COLOR); //aussie GZ
   

   
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pHelper] = 0;
    PlayerInfo[playerid][pJailed] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pScores] = 0;
    PlayerInfo[playerid][pMoney] = 0;
    PlayerInfo[playerid][AdminDuty] = 0;
    PlayerInfo[playerid][pWarns] = 0;
    PlayerInfo[playerid][pSpamTime] = 0;
    PlayerInfo[playerid][Paused] = 0;
    PlayerInfo[playerid][LastDeath] = 0;
    PlayerInfo[playerid][DeathSpam] = 0;
    PlayerInfo[playerid][pLogged] = 0;
    PlayerInfo[playerid][pMuted] = 0;
    PlayerInfo[playerid][FailLogin] = 0;
    PlayerInfo[playerid][A51Spawn] = 0;
    PlayerInfo[playerid][DASpawn] = 0;
    PlayerInfo[playerid][BIGSpawn] = 0;
    PlayerInfo[playerid][NorSpawn] = 1;
    HasSpawnedCar[playerid] = 0;
    DND[playerid] = 0;
    //--------------------------------
    MySQL_BanCheck(playerid);
    //--------------------------------
    //--------Account registration----
    new query[200];
    format(query, sizeof(query),"SELECT IP FROM `playerdata` WHERE user = '%s' LIMIT 1", escpname(playerid));
    mysql_query(query);
    mysql_store_result();
    new rows = mysql_num_rows();
    if(!rows)
    {
       ShowPlayerDialog(playerid, R_DIALOG, DIALOG_STYLE_PASSWORD,"Register","Your account is "cred"not "corange"registered\nPlease type your password to register","Register","Quit");
    }
    if(rows == 1)
    {
       ShowPlayerDialog(playerid, L_DIALOG, DIALOG_STYLE_PASSWORD,"Login",""corange"Your account is already registered\nPlease type your password to login","Login","Quit");
    }
    mysql_free_result();
    //---------------------------------

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)