using strcmp wrong? -
JaKe Elite - 10.05.2012
My server is always crashing in the part where i login & in the part where i automatic login
I am using strcmp wrong? in automatic login i check if ip match to database
here is the code
/login
Код:
if(!strcmp(params, pData[playerid][Pass], true))
{
pData[playerid][Login] = 1;
SetPlayerName(playerid, pData[playerid][Name]);
SetPlayerScore(playerid, pData[playerid][Score]);
GivePlayerMoney(playerid, pData[playerid][Cash]);
SendClientMessage(playerid, COLOR_GREEN, "You've successfully login!");
format(str, sizeof(str), "You've successfully login\nAdmin: %d\nVIP: %d\nScore: %d\n$%i\nKills: %d\nDeaths: %d", pData[playerid][Admin], pData[playerid][VIP], pData[playerid][Score], pData[playerid][Cash], pData[playerid][Kills], pData[playerid][Deaths]);
ShowPlayerDialog(playerid, SUCCESSFULLOGIN, DIALOG_STYLE_MSGBOX, "Successfully Login:", str, "OK", "");
}
Automatic Login (Base in Seven_of_Nine tutorial (Y_INI))
Код:
new str[128], ip[16];
GetPlayerIp(playerid, ip, sizeof(ip));
if(!strcmp(ip, pData[playerid][IP], true))
{
INI_ParseFile(DataPath(playerid), "DataBase_%s", .bExtra = true, .extra = playerid);
pData[playerid][Login] = 1;
SetPlayerName(playerid, pData[playerid][Name]);
SetPlayerScore(playerid, pData[playerid][Score]);
GivePlayerMoney(playerid, pData[playerid][Cash]);
SendClientMessage(playerid, COLOR_GREEN, "You've automaticlly login!");
format(str, sizeof(str), "You've automaticlly login\nAdmin: %d\nVIP: %d\nScore: %d\n$%i\nKills: %d\nDeaths: %d", pData[playerid][Admin], pData[playerid][VIP], pData[playerid][Score], pData[playerid][Cash], pData[playerid][Kills], pData[playerid][Deaths]);
ShowPlayerDialog(playerid, SUCCESSFULLOGIN, DIALOG_STYLE_MSGBOX, "Successfully Login:", str, "OK", "");
return 1;
}
and i also get crashinfo after the server crash
Код:
--------------------------
SA-MP Server: 0.3d
Exception At Address: 0x004684C4
Registers:
EAX: 0x00000000 EBX: 0x019EE654 ECX: 0x00000000 EDX: 0x00000000
ESI: 0x00000000 EDI: 0x00000000 EBP: 0x0012E620 ESP: 0x0012E4C0
EFLAGS: 0x00010246
Stack:
+0000: 0x00474D32 0x00000000 0x00000000 0x019EE654
+0010: 0x01045568 0x00492028 0x003F0000 0x010455D8
+0020: 0x00000000 0x0012E5B8 0x003F0178 0x0012E5B8
+0030: 0x7C910E91 0x003F0608 0x7C91056D 0x00000000
+0040: 0x010455E0 0x018810EC 0x00000000 0x004AD350
+0050: 0x010455D8 0x003F0178 0x003F68A0 0x010455E0
+0060: 0x0048DA14 0x00000014 0x0048DFE5 0x003F0178
+0070: 0x0048DFDB 0x01047118 0x00000000 0x00000000
+0080: 0xFFFFFFFF 0x0012E534 0x004AD320 0x0012F1B8
+0090: 0x00492028 0x01047120 0x00001008 0x0048DFDB
+00A0: 0x00404F6C 0x004D64B0 0x019EE0F0 0x000000C2
+00B0: 0x0012E668 0x00000000 0x000000C1 0x00000118
+00C0: 0x003F0000 0x00405832 0x004D64B0 0x00000000
+00D0: 0x00000000 0x00000000 0x00000FA0 0x0049A85B
+00E0: 0x0049A863 0x004E6B60 0x00000090 0x7C90D592
+00F0: 0x7C809BBB 0x00000000 0x00000004 0x004946C8
+0100: 0x0049A891 0x003F1FC4 0x00494772 0x00000004
+0110: 0x0049478F 0x00000000 0x004D64B0 0x018810EC
+0120: 0x00000000 0x0012E5D4 0x00492028 0x0012E638
+0130: 0x00492028 0x004AD340 0xFFFFFFFF 0x0049478F
Re: using strcmp wrong? -
JaKe Elite - 10.05.2012
Anyone?
Re: using strcmp wrong? -
Slice - 10.05.2012
Use the
crashdetect plugin.
Re: using strcmp wrong? -
JaKe Elite - 10.05.2012
here is all i get after the crash
Код:
[01:10:48] [debug] Server crashed while executing iP.amx
[01:10:48] [debug] AMX backtrace:
[01:10:48] [debug] #0 native SetPlayerName () [00d256f0] from sscanf.dll
[01:10:48] [debug] #1 00020418 in public S@@_OnPlayerConnect () from iP.amx
[01:10:48] [debug] #2 native CallLocalFunction () [004715a0] from samp-server.exe
[01:10:48] [debug] #3 000014d8 in public Itter_OnPlayerConnect () from iP.amx
[01:10:48] [debug] #4 native CallLocalFunction () [004715a0] from samp-server.exe
[01:10:48] [debug] #5 00000730 in public OnPlayerConnect () from iP.amx
[01:10:48] [debug] Native backtrace:
[01:10:50] [debug] #0 00e7155f in ?? () from C:\Documents and Settings\Romel\My Documents\clan SERVER\plugins\crashdetect.dll
[01:10:50] [debug] #1 00e72844 in ?? () from C:\Documents and Settings\Romel\My Documents\clan SERVER\plugins\crashdetect.dll
[01:10:50] [debug] #2 00e7470e in ?? () from C:\Documents and Settings\Romel\My Documents\clan SERVER\plugins\crashdetect.dll
[01:10:50] [debug] #3 7c862cd3 in UnhandledExceptionFilter () from C:\WINDOWS\system32\kernel32.dll
[01:10:50] [debug] #4 004986b6 in ?? () from C:\Documents and Settings\Romel\My Documents\clan SERVER\samp-server.exe
[01:10:50] [debug] #5 00491af0 in ?? () from C:\Documents and Settings\Romel\My Documents\clan SERVER\samp-server.exe
[01:10:50] [debug] #6 7c816d4f in RegisterWaitForInputIdle () from C:\WINDOWS\system32\kernel32.dll
Re: using strcmp wrong? -
JaKe Elite - 10.05.2012
now when i remove SetPlayerName it is working now except its not functioning properly. i remove the auto login onplayerconnect. now the problem now is the /login
current code
pawn Код:
CMD:login(playerid, params[])
{
new str[128];
INI_ParseFile(DataPath(playerid), "DataBase_%s", .bExtra = true, .extra = playerid);
if(fexist(DataPath(playerid)))
{
if(pData[playerid][Login] == 1) return SendClientMessage(playerid, COLOR_RED, "*** You are already register/login ***");
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /login [pass]");
if(strlen(params) > 30) return SendClientMessage(playerid, COLOR_RED, "*** Maxium Password Length 30 ***");
if(strcmp(params, pData[playerid][Pass], true) == 0)
{
pData[playerid][Login] = 1;
SetPlayerScore(playerid, pData[playerid][Score]);
GivePlayerMoney(playerid, pData[playerid][Cash]);
SendClientMessage(playerid, COLOR_GREEN, "You've successfully login!");
format(str, sizeof(str), "You've successfully login\nAdmin: %d\nVIP: %d\nScore: %d\n$%i\nKills: %d\nDeaths: %d", pData[playerid][Admin], pData[playerid][VIP], pData[playerid][Score], pData[playerid][Cash], pData[playerid][Kills], pData[playerid][Deaths]);
ShowPlayerDialog(playerid, SUCCESSFULLOGIN, DIALOG_STYLE_MSGBOX, "Successfully Login:", str, "OK", "");
}
else
{
SendClientMessage(playerid, COLOR_RED, "_ | - Wrong Password! - | _");
SendClientMessage(playerid, COLOR_RED, "*** Retry using /login again ***");
return 1;
}
} else return SendClientMessage(playerid, COLOR_RED, "*** You do not have account yet please use /register ***");
return 1;
}
Re: using strcmp wrong? -
JaKe Elite - 11.05.2012
Bump?
More Info:
When i ever use /login it just give me
Код:
Admin: 0 | VIP: 0 | Score: 0 | Cash: $0 | Kills: 0 | Deaths: 0
after the login.
and when i ever try the wrong password it just give me this too
Код:
Admin: 0 | VIP: 0 | Score: 0 | Cash: $0 | Kills: 0 | Deaths: 0
plus it give me crashinfo (but although server didn't crash it just don't function correctly)
that is when i use /login without dialog.
Now this time i use /login with dialog.
but when ever i enter in dialog example
when i type my password then press login it just gave me
Код:
Server Closed Connection.
Current code:
pawn Код:
CMD:login(playerid, params[])
{
if(!fexist(DataPath(playerid))) return SendClientMessage(playerid, COLOR_RED, "*** You do not have player acc yet please /register ***");
if(pData[playerid][Login] == 1) return SendClientMessage(playerid, COLOR_RED, "*** You are already register/login ***");
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login to iP clan SERVER", "Welcome back to iP clan SERVER\nPlease login in order\nto use your player acc", "Login", "Quit");
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new str[128], buffer[129];
WP_Hash(buffer, sizeof(buffer), inputtext);
if(dialogid == LOGIN)
{
if(!response) return SendClientMessage(playerid, COLOR_RED, "*** If you don't want to play iP clan SERVER then don't! ***"); Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return SendClientMessage(playerid, COLOR_RED, "*** You leave the password field empty try to /login again! ***");
if(strcmp(pData[playerid][Pass], buffer, false) == 0)
{
INI_ParseFile(DataPath(playerid), "DataBase_%s", .bExtra = true, .extra = playerid);
pData[playerid][Login] = 1;
print("[debug] Login is working fine");
SetPlayerScore(playerid, pData[playerid][Score]);
GivePlayerMoney(playerid, pData[playerid][Cash]);
SendClientMessage(playerid, COLOR_GREEN, "You've successfully login!");
format(str, sizeof(str), "You've successfully login | Admin: %d | VIP: %d | Score: %d | Cash: $%i | Kills: %d | Deaths: %d", pData[playerid][Admin], pData[playerid][VIP], pData[playerid][Score], pData[playerid][Cash], pData[playerid][Kills], pData[playerid][Deaths]);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
else
{
SendClientMessage(playerid, COLOR_RED, "_ | - Wrong Password! - | _");
SendClientMessage(playerid, COLOR_RED, "*** Retry using /login again ***");
}
}
}
return 1;
}