[pomoc]Neizbacuje login

Započeo doktor, April 02, 2012, 20:43:08 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

doktor

Skripta koju koristim:Neki MYSQL
Detaljan opis problemaKada ugasim i ponovo upalim srv nece da mi izbaci login dialog
Dio skripte:
Neke slike/video za lakse dobivanje pomoci(neobavezno):

Snich

Citat: Pringles.cod2 poslato April 02, 2012, 23:05:08 POSLE PODNE
vidi u folderu plugins imas streamer i jel ti u cfg zadano ovo :  plugins streamer ( ako pokreces na linuxu onda moramo ovako pisati  plugins streamer.so
... ne vidim kralju kakve veze ima streamer sa loginom? Streamer je plugin za objekte, pickupe itd ... a ne za logovanje igraca  :-\

doktor


Snich

Pogledaj da li se pod OnPlayerConnect poziva dijalog za logovanje ...

doktor

public OnPlayerConnect(playerid)
{
    RemoveUnderScore(playerid);
    TextDrawHideForPlayer(playerid, Textdraw1);
    MoneyGiven[playerid] = -1;
    JustLogged[playerid] = 0;
    new query[300], pname[24];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "SELECT IP FROM `playerdata` WHERE user = '%s' LIMIT 1", pname);
    mysql_query(query);
    mysql_store_result();
    new rows = mysql_num_rows();
    if(!rows)
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""Blue"Please register",""White"Welcome to "Red""White"!\n"White"In order to start playing, you have to register!\n\n"White"Please insert a password below:", "Register", "Cancel");
    }
    if(rows == 1)
    {
        new IP[2][15];
        mysql_fetch_field_row(IP[0],"IP");
        GetPlayerIp(playerid, IP[1], 15);
        if(strlen(IP[0]) != 0 && !strcmp(IP[0], IP[1], true))
        {
            MySQL_Login(playerid);
        }
        else if(!strlen(IP[0]) || strcmp(IP[0], IP[1], true))
        {
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
            IsRegistered[playerid] = 1;
        }
    }
    mysql_free_result();
    return 1;
}

Daj da vidimo MySQL_Login() funkciju.

Last nick: Paradox

doktor

Izvoli Joey_

stock MySQL_Login(playerid)
{
    new query[300], pname[24], savingstring[20];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "SELECT score, money, level, vip, admin, rank, kills, deaths, muted, jailed, frozen, mutedtimes, jailedtimes, frozentimes, banned, bannedby, logins, posx, posy, posz, posa FROM playerdata WHERE user = '%s'", pname);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(savingstring, "score"); SetPlayerScore(playerid, strval(savingstring));
        mysql_fetch_field_row(savingstring, "money"); MoneyGiven[playerid] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "level"); PlayerInfo[playerid][pLevel] = strval(savingstring);
mysql_fetch_field_row(savingstring, "vip"); PlayerInfo[playerid][pVIP] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "admin"); PlayerInfo[playerid][pAdmin] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "rank"); PlayerInfo[playerid][pRank] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "kills"); PlayerInfo[playerid][pKills] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "deaths"); PlayerInfo[playerid][pDeaths] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "muted"); PlayerInfo[playerid][pMuted] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "jailed"); PlayerInfo[playerid][pJailed] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "frozen"); PlayerInfo[playerid][pFrozen] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "mutedtimes"); PlayerInfo[playerid][pMutedTimes] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "jailedtimes"); PlayerInfo[playerid][pJailedTimes] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "frozentimes"); PlayerInfo[playerid][pFrozenTimes] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "banned"); PlayerInfo[playerid][pBanned] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "bannedby"); PlayerInfo[playerid][pBannedBy] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "logins"); PlayerInfo[playerid][pLogins] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "posx"); PlayerInfo[playerid][pPosX] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "posy"); PlayerInfo[playerid][pPosY] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "posz"); PlayerInfo[playerid][pPosZ] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "posa"); PlayerInfo[playerid][pPosA] = strval(savingstring);
    }
    mysql_free_result();
    JustLogged[playerid] = 1;
    Logged[playerid] = 1;
    PlayerInfo[playerid][pLogins]++;
    SendMessage(playerid, "~g~Info: ~w~You have been logged-in!");
    SetSpawnInfo( playerid, 0, 0, 2231.7495,-1178.9769,29.8044, 269.15, 26, 36, 28, 150, 0, 0 );
    SpawnPlayer(playerid);
    return 1;
}
Poslednja Izmena: April 03, 2012, 14:40:11 POSLE PODNE od Joey_

Daj još pokaži mysql_log.txt datoteku. Ako je nemaš onda dodaj prije mysql_connect() funkcije: mysql_debug(1); i ponovno pokreni mod i probaj se logirat.

Last nick: Paradox

doktor

[20:58:19] ---------------------------

[20:58:19] MySQL Debugging activated (04/02/12)

[20:58:19] ---------------------------

[20:58:19] 

[20:58:42] >> mysql_query( Connection handle: 1 )

[20:58:42] CMySQLHandler::Query(SELECT IP FROM `playerdata` WHERE user = 'doktorC' LIMIT 1) - Successfully executed.

[20:58:42] >> mysql_store_result( Connection handle: 1 )

[20:58:42] CMySQLHandler::StoreResult() - Result was stored.

[20:58:42] >> mysql_num_rows( Connection handle: 1 )

[20:58:42] CMySQLHandler::NumRows() - Returned 1 row(s)

[20:58:42] >> mysql_fetch_field_row( Connection handle: 1 )




Umjesto ovog:

new IP[2][15];
        mysql_fetch_field_row(IP[0],"IP");
        GetPlayerIp(playerid, IP[1], 15);


Stavi ovo (radi debuganja):

new IP[2][16];
mysql_fetch_field_row(IP[0], "IP");
printf("IP[0]: %s", IP[0]);
GetPlayerIp(playerid, IP[1], 16);
printf("IP[1]: %s", IP[1]);


Kasnije ćeš moći izbrisati ove printove.

Last nick: Paradox

doktor

opet neizbacuje login dialog nakon restarta  :'( :'(

Oke. Daj mi sad server log.

Last nick: Paradox

doktor

----------------------
v0.3d-R2, (C)2005-2011 SA-MP Team

[15:07:40] filterscripts = ""  (string)
[15:07:40]
[15:07:40] Server Plugins
[15:07:40] --------------
[15:07:40]  Loading plugin: mysql
[15:07:40]

  > MySQL plugin R6-2 successfully loaded.

[15:07:40]   Loaded.
[15:07:40]  Loading plugin: sscanf
[15:07:40]

[15:07:40]  ===============================

[15:07:40]       sscanf plugin loaded.     

[15:07:40]    (c) 2009 Alex "Y_Less" Cole

[15:07:40]  ===============================

[15:07:40]   Loaded.
[15:07:40]  Loading plugin: streamer
[15:07:40]

*** Streamer Plugin v2.6 by Incognito loaded ***

[15:07:40]   Loaded.
[15:07:40]  Loaded 3 plugins.

[15:07:40]
[15:07:40] Filterscripts
[15:07:40] ---------------
[15:07:40]   Loaded 0 filterscripts.

[15:07:40] Number of vehicle models: 0
[15:07:59] Incoming connection: 127.0.0.1:56428
[15:08:00] [join] doktor has joined the server (0:127.0.0.1)

Ne ispiše ti ništa u konzolu prilikom ulaska u server?

Last nick: Paradox

doktor

ne samo se restartuje  :'( :'(
Jel mi mos na pm poslat neki dobar MySQL mod samo da je reg i log sistem napravljen?