Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: Plen Ki Mun poslato Mart 12, 2018, 16:09:01 POSLE PODNE

Naslov: Server Crashuje
Poruka od: Plen Ki Mun poslato Mart 12, 2018, 16:09:01 POSLE PODNE
Problem(error/warning): Kod registracije je sve u redu, ali kada idem login upisem sifru server se crashuje
Dio skripte: [pawn]case DIALOG_LOGIN:
      {
         if ( !response ) return Kick ( playerid );
         if( response )
         {
            new hashpass[ 129 ], string[ 180 ];
            WP_Hash(hashpass,sizeof(hashpass), inputtext);
            if(!strcmp(hashpass, PInfo[playerid][Pass], false))
            {
               INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
               
               GivePlayerMoneyEx(playerid, PInfo[playerid][Cash]);
               SetPlayerScore(playerid,PInfo[playerid][Score]);

                 if(PInfo[playerid][pclanID] != -1 && clanInfo[PInfo[playerid][pclanID]][gActive] == 0)
               {
                   PInfo[playerid][pclanID] = -1;
                  PInfo[playerid][pclanRank] = 0;
               }
            }
            else
            {
               format(string, sizeof(string), "Dobrodosao %s "COL_WHITE"na CnR Server.\nUpisite sifru", GetName(playerid));
                 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", string, "Login", "Exit");
               PInfo[playerid][FailToLogin]++;
               switch (PInfo[playerid][FailToLogin])
               {
                     case 1: SCM(playerid, COLOR_ORANGE_RED, "Kriva sifra (1/3)");
                   case 2: SCM(playerid, COLOR_ORANGE_RED, "Kriva sifra (2/3)");
                   case 3:
                   {
                     SCM(playerid, COLOR_ORANGE_RED, "Upisao si sifru vise puta krivo i izbacensi (3/3)");
                     SetTimerEx("KickPlayer", 100,false,"i",playerid);
                  }
                  }
                  return 1;
               
            }
            return 1;
         }
      }[/pawn]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [16:05:46] [join] Rakija has joined the server (0:127.0.0.1)
[16:06:19] [debug] Server crashed while executing CNR.amx
[16:06:19] [debug] AMX backtrace:
[16:06:19] [debug] #0 000ac58c in public OnDialogResponse () from CNR.amx
[16:06:20] [debug] Native backtrace:
[16:06:20] [debug] #0 6620abc9 in ?? () from plugins\crashdetect.DLL
[16:06:20] [debug] #1 6620c8c7 in ?? () from plugins\crashdetect.DLL
[16:06:20] [debug] #2 66211489 in ?? () from plugins\crashdetect.DLL
[16:06:21] [debug] #3 66211666 in ?? () from plugins\crashdetect.DLL
[16:06:21] [debug] #4 6620a207 in ?? () from plugins\crashdetect.DLL
[16:06:21] [debug] #5 6620c87a in ?? () from plugins\crashdetect.DLL
[16:06:21] [debug] #6 65ec4629 in ?? () from plugins\streamer.DLL
[16:06:21] [debug] #7 0046ec31 in ?? () from samp-server.exe
[16:06:21] [debug] #8 00452270 in ?? () from samp-server.exe
[16:06:21] [debug] #9 0049eef9 in ?? () from samp-server.exe
[16:06:21] [debug] #10 004aa31e in ?? () from samp-server.exe

Slika/video ingame problema(obavezno ako je ingame problem): Nije potrebno
Naslov: Odg: Server Crashuje
Poruka od: PekiDaBoss poslato Mart 12, 2018, 16:36:26 POSLE PODNE
vrati u udb_hash i update crashdetect
Naslov: Odg: Server Crashuje
Poruka od: Plen Ki Mun poslato Mart 12, 2018, 16:41:35 POSLE PODNE
Citat: Belegija poslato Mart 12, 2018, 16:36:26 POSLE PODNE
vrati u udb_hash i update crashdetect

Ti boga mi nisi normal, sve radi kako treba što bih vraćao lol.
Naslov: Odg: Server Crashuje
Poruka od: PekiDaBoss poslato Mart 12, 2018, 17:34:24 POSLE PODNE
@Vantage  pa jel tebi kresuje ili svima?
Naslov: Odg: Server Crashuje
Poruka od: Plen Ki Mun poslato Mart 12, 2018, 17:37:37 POSLE PODNE
Citat: Belegija poslato Mart 12, 2018, 17:34:24 POSLE PODNE
@Vantage  pa jel tebi kresuje ili svima?

Ovo je na test serveru, to jest kucnom. Sve je ok, ali kada upisem lozinku odmah se server crashuje.
Naslov: Odg: Server Crashuje
Poruka od: Ino42O poslato Mart 12, 2018, 18:11:39 POSLE PODNE
Crasha kada upises pravilnu sifru ili kada pogrijesis sifru?
Naslov: Odg: Server Crashuje
Poruka od: Plen Ki Mun poslato Mart 12, 2018, 18:34:51 POSLE PODNE
Citat: Ino42O poslato Mart 12, 2018, 18:11:39 POSLE PODNE
Crasha kada upises pravilnu sifru ili kada pogrijesis sifru?

Kada upisem pravilnu crashuje server, a kada upisem krivu sifru to jest s kojom se nisam registrirao sve je ok... To jest provjera za krivu sifru uopce ne reagira

@Ino42O
Naslov: Odg: Server Crashuje
Poruka od: Plen Ki Mun poslato Mart 12, 2018, 18:43:17 POSLE PODNE
Oprostite na DP ali nema button za edit. Sada kada upisem krivu lozinku, daje mi poruku da je kriva sifra, sto je uredu. Ali i dalje crashuje kada upisem tocnu lozinku nakon krive upisane lozinke i prvi puta kada se moram login.

Jos se jednom ispricavam moderatoru ali nemoj lock temu zbog DP, morao sam jer nema edit button.
Naslov: Odg: Server Crashuje
Poruka od: Ino42O poslato Mart 12, 2018, 18:48:51 POSLE PODNE
Ovako, postavi ovo umjesto statementa gdje je uspjesan login

[pawn]
print(" :: DEBUG :: 1");
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);


print(" :: DEBUG :: 2");
GivePlayerMoneyEx(playerid, PInfo[playerid][Cash]);


print(" :: DEBUG :: 3");
SetPlayerScore(playerid,PInfo[playerid][Score]);


print(" :: DEBUG :: 4");

if(PInfo[playerid][pclanID] != -1 && clanInfo[PInfo[playerid][pclanID]][gActive] == 0)
{
   PInfo[playerid][pclanID] = -1;
   PInfo[playerid][pclanRank] = 0;
}


print(" :: DEBUG :: 5");
[/pawn]

i kada crasha vidi u server_log.txt koje je sve debug korake ispisalo
Naslov: Odg: Server Crashuje
Poruka od: Plen Ki Mun poslato Mart 12, 2018, 18:56:49 POSLE PODNE
Log:

[18:52:50] [join] Rakija has joined the server (0:127.0.0.1)
[18:52:58]  :: DEBUG :: 1
[18:52:58]  :: DEBUG :: 2
[18:52:58] [debug] Server crashed while executing CNR.amx
[18:52:58] [debug] AMX backtrace:
[18:52:58] [debug] #0 000ac5dc in public OnDialogResponse () from CNR.amx
[18:53:00] [debug] Native backtrace:
[18:53:00] [debug] #0 6994abc9 in ?? () from plugins\crashdetect.DLL
[18:53:00] [debug] #1 6994c8c7 in ?? () from plugins\crashdetect.DLL
[18:53:00] [debug] #2 69951489 in ?? () from plugins\crashdetect.DLL
[18:53:00] [debug] #3 69951666 in ?? () from plugins\crashdetect.DLL
[18:53:00] [debug] #4 6994a207 in ?? () from plugins\crashdetect.DLL
[18:53:00] [debug] #5 6994c87a in ?? () from plugins\crashdetect.DLL
[18:53:00] [debug] #6 66fb4629 in ?? () from plugins\streamer.DLL
[18:53:00] [debug] #7 0046ec31 in ?? () from samp-server.exe
[18:53:00] [debug] #8 00452270 in ?? () from samp-server.exe
[18:53:00] [debug] #9 0049eef9 in ?? () from samp-server.exe
[18:53:00] [debug] #10 004aa31e in ?? () from samp-server.exe


Kod:


case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
    ClearChat(playerid, 30);
new hashpass[ 129 ], string[ 180 ];
WP_Hash(hashpass,sizeof(hashpass), inputtext);
if(!strcmp(hashpass, PInfo[playerid][Pass], false))
{
    print(" :: DEBUG :: 1");
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

print(" :: DEBUG :: 2");
GivePlayerMoneyEx(playerid, PInfo[playerid][Cash]);

print(" :: DEBUG :: 3");
SetPlayerScore(playerid,PInfo[playerid][Score]);

LoggedIn[playerid] = 1;

UpdateIP(playerid);

if(PInfo[playerid][Banned] == 1) return Kick(playerid);

                    print(" :: DEBUG :: 4");
      if(PInfo[playerid][pclanID] != -1 && clanInfo[PInfo[playerid][pclanID]][gActive] == 0)
{
    PInfo[playerid][pclanID] = -1;
PInfo[playerid][pclanRank] = 0;
}
print(" :: DEBUG :: 5");
}
else
{
    format(string, sizeof(string), "Dobrodosao %s na CnR server\nUpisite sifru", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", string, "Login", "Exit");
    PInfo[playerid][FailToLogin]++;
switch (PInfo[playerid][FailToLogin])
{
    case 1: SCM(playerid, -1, "Kriva Sifra (1/3)");
    case 2: SCM(playerid, -1, "Kriva Sifra (2/3)");
    case 3:
    {
SCM(playerid, -1, "Izbaceni si, fulao si sanse za login (3/3)");
SetTimerEx("KickPlayer", 100,false,"i",playerid);
}
    }
    return 1;
                }
}
return 1;
}

Naslov: Odg: Server Crashuje
Poruka od: // xunder poslato Mart 12, 2018, 19:01:14 POSLE PODNE
daj funkciju GivePlayerMoneyEx
Naslov: Odg: Server Crashuje
Poruka od: Plen Ki Mun poslato Mart 12, 2018, 19:07:19 POSLE PODNE
Evo poneÅ¡to vezanu uz to. Ali kakve veze ima to sa mojim problemom (Pitam, zelim znati)  :)

Svugdje koristim to jer imam server sided, nisam ima prije sa time problema.

forward GivePlayerMoneyEx(playerid,ammount);


public GivePlayerMoneyEx(playerid,ammount)
{
      OldMoney[playerid] = GetPlayerMoney(playerid);
      NewMoney[playerid] = ammount;
      GivePlayerMoneyEx(playerid,ammount);

      return 1;
}




Naslov: Odg: Server Crashuje
Poruka od: // xunder poslato Mart 12, 2018, 19:08:59 POSLE PODNE
Funkcija poziva samo sebe i tako stvara infinite loop.
Eo fix:
public GivePlayerMoneyEx(playerid,ammount)
{
      OldMoney[playerid] = GetPlayerMoney(playerid);
      NewMoney[playerid] = ammount;
      GivePlayerMoney(playerid,ammount);

      return 1;
}
Naslov: Odg: Server Crashuje
Poruka od: Bašovski poslato Mart 12, 2018, 19:12:32 POSLE PODNE

public GivePlayerMoneyEx(playerid,ammount)
{
      OldMoney[playerid] = GetPlayerMoney(playerid);
      NewMoney[playerid] = ammount + OldMoney[playerid];
      GivePlayerMoney(playerid,ammount);

      return 1;
}

Ne znam sta si zamislio sa ovim old i newmoney. Probaj sada.
Naslov: Odg: Server Crashuje
Poruka od: Plen Ki Mun poslato Mart 12, 2018, 19:16:20 POSLE PODNE
Citat: .ксундер poslato Mart 12, 2018, 19:08:59 POSLE PODNE
Funkcija poziva samo sebe i tako stvara infinite loop.
Eo fix:
public GivePlayerMoneyEx(playerid,ammount)
{
      OldMoney[playerid] = GetPlayerMoney(playerid);
      NewMoney[playerid] = ammount;
      GivePlayerMoney(playerid,ammount);

      return 1;
}


Hvala ti puno. Daj adresu da ti doÄ'em ljubit noge  :D
Naslov: Odg: Server Crashuje
Poruka od: Ino42O poslato Mart 12, 2018, 19:19:57 POSLE PODNE
I pretpostavio sam da je do te custom funkcije, ali uglavnom kada zapnes opet na slican nacin napravis debug linija po linija i znati ces do koje je problem