31.12.2014, 15:26
I really need to get my script fixed, I've been working on it for a while and didn't notice the bug till like two days ago.
So here's my server log:
After Newb_Acc has registered (which is done successfully as in it inserts the MySQL stuff properly) the server just dies.
Here's my OnPlayerConnect:
OnDialogResponse - Register & login:
Let me know if you need more of my script. I have tried using CrashDetect but it compiles fine and doesn't output anything odd.
Here's crashinfo.txt:
My "loginPlayer" stock:
The gamemode compiles overall fine, but something screws up.
I get the register dialog, but as soon as I press enter/"Register" the server dies, but the accounts are inserted into my MySQL database. Also, why the insert query is so small is because I have set default values for everything else.
Logging in to a already existing account works fine but not new ones or something.
Edit: Also, why I am not hashing the PW's or such yet is because I'm still working on the gamemode, so I'll add it later.
So here's my server log:
pawn Код:
[17:02:45] ----------------------------------
[17:02:45] Number of vehicle models: 4
[17:02:46]
[17:02:46] ==========================================
[17:02:46] | |
[17:02:46] | A new version (v<html>
) of YSI is |
[17:02:46] | available from: |
[17:02:46] | |
[17:02:46] | [url]www.y-less.com/YSI/YSI_1.0.zip[/url] |
[17:02:46] | |
[17:02:46] ==========================================
[17:02:46]
[17:03:09] Incoming connection: 217.211.239.191:53963
[17:03:09] [join] Newb_Acc has joined the server (0:217.211.239.191)
Here's my OnPlayerConnect:
pawn Код:
public OnPlayerConnect(playerid)
{
if(!IsValidName(playerid))
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Please use an realistic name such as James_Bond. (Firstname_Lastname)");
KickTimer(playerid);
return 1;
}
Player[playerid][loggedOn] = 0;
for(new i = 0; i < 50; i++) { SendClientMessage(playerid, COLOR_WHITE, " "); }
SetPlayerColor(playerid, COLOR_GREY);
new query[128], banQuery[128], ipQuery[128], pName[MAX_PLAYER_NAME], IP[35];
GetPlayerName(playerid, pName, sizeof(pName));
// Check if player is banned by name.
format(banQuery, sizeof(banQuery), "SELECT * FROM users WHERE name = '%s'", pName);
mysql_query(banQuery);
mysql_store_result();
new tBanReason[100], tBannedBy[25], isBanned, str[100], strtwo[100], banappeal[100];
while(mysql_fetch_row(banQuery, "|"))
{
mysql_fetch_field("Banned", banQuery); isBanned = strval(banQuery);
mysql_fetch_field("BanReason", tBanReason);
mysql_fetch_field("BannedBy", tBannedBy);
format(strtwo, sizeof(strtwo), "Banned by: %s", tBannedBy);
format(str, sizeof(str), "Reason: %s", tBanReason);
format(banappeal, sizeof(banappeal), "If you would like to get unbanned, post an ban-appeal at: %s", WEB_URL);
if(isBanned) { SendClientMessage(playerid, COLOR_RED, "You have been banned from this server!"); SendClientMessage(playerid, COLOR_WHITE, strtwo); SendClientMessage(playerid, COLOR_WHITE, str); SendClientMessage(playerid, COLOR_WHITE, banappeal); SetTimerEx("KickEx", 2000, false, "d", playerid); return 1; }
}
// Check if player is banned by IP.
GetPlayerIp(playerid, IP, sizeof(IP));
format(ipQuery, sizeof(ipQuery), "SELECT ip FROM ip_bans WHERE ip = '%s'", IP);
mysql_query(ipQuery);
mysql_store_result();
if(mysql_num_rows() > 0)
{
format(str, sizeof(str), "If you would like to get unbanned, post an ban-appeal at: %s", WEB_URL);
SendClientMessage(playerid, COLOR_RED, "You have been banned from this server!");
SendClientMessage(playerid, COLOR_WHITE, str);
SetTimerEx("KickEx", 2000, false, "d", playerid);
return 1;
}
// Else, let the player login.
format(query, sizeof(query), "SELECT * FROM users WHERE name = '%s'", pName);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() > 0)
{
SendClientMessage(playerid, COLOR_WHITE, WelcomeMsg);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please login to your account by typing your password below.", "Login", "Quit");
SendClientMessage(playerid, -1, "That user is already registered, please login by typing your password.");
} else {
SendClientMessage(playerid, COLOR_WHITE, WelcomeMsg);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "Please register by typing a password below.", "Register", "Quit");
SendClientMessage(playerid, -1, "That user is not registered, please register by choosing a password.");
}
return 1;
}
pawn Код:
case DIALOG_LOGIN:
{
if(response)
{
new query[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT password FROM users WHERE name='%s' AND password='%s'", pName, inputtext);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() > 0)
{
loginPlayer(playerid);
} else {
SendClientMessage(playerid, -1, "You have entered an incorrect password.");
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please login to your account by typing your password below.", "Login", "Quit");
}
} else return Kick(playerid);
}
case DIALOG_REGISTER:
{
if(response)
{
if(strlen(inputtext) < 4)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You need to choose a password with at least 4 characters in order to register.");
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "Please register by typing a password below.", "Register", "Quit");
return 1;
}
strreplace(inputtext, ''', '*');
new query[512], pName[MAX_PLAYER_NAME], dateString[128], Year, Month, Day, Hour, Minute, Second, IP[35];
GetPlayerIp(playerid, IP, sizeof(IP));
GetPlayerName(playerid, pName, sizeof(pName));
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
format(dateString, sizeof(dateString), "%d-%d-%d (%d:%d:%d)", Day, Month, Year, Hour, Minute, Second);
format(query, sizeof(query), "INSERT INTO users (name, password, LastLogin, LastIP) VALUES ('%s', '%s', '%s', '%s')", pName, inputtext, dateString, IP);
mysql_query(query);
loginPlayer(playerid);
SendClientMessage(playerid, -1, "You have been registered successfully!");
SendClientMessage(playerid, -1, "As this is the first time you login, please set your characters details with the following forms..");
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Please insert your characters age below. (16-99)", "Continue", "");
} else return Kick(playerid);
}
Here's crashinfo.txt:
pawn Код:
--------------------------
SA-MP Server: 0.3z
Exception At Address: 0x00401E32 Module: (samp-server.exe)
Registers:
EAX: 0x03D19388 EBX: 0x00000000 ECX: 0x00000030 EDX: 0x03D12DD4
ESI: 0x03D664F8 EDI: 0x0229E208 EBP: 0x03D12E54 ESP: 0x0018F810
EFLAGS: 0x00010297
Stack:
+0000: 0x0018F894 0x0229E208 0x00601258 0x00000015
+0010: 0x00000000 0x00295080 0x0029571C 0x00296240
+0020: 0x00292278 0x00000030 0x00292278 0x03D12DD4
+0030: 0x03D664F8 0x00000000 0x03D10020 0x00053724
+0040: 0x0F694885 0x0229E208 0x0018F8E8 0x00000015
+0050: 0x00000000 0x0229E208 0x00000000 0x69446E4F
+0060: 0x676F6C61 0x70736552 0x65736E6F 0x0F694900
+0070: 0x0229E208 0x0000000D 0x0018F904 0x00000000
+0080: 0x0118F904 0x0018FB58 0x0046DE11 0x00000005
+0090: 0x0018F8E8 0x00000015 0x0229E208 0x00000000
+00A0: 0x0229E208 0x00000001 0x0229E208 0x00000001
+00B0: 0x0229E208 0xFFFFFFFF 0x0229E208 0x0018F904
+00C0: 0x0018F8EC 0x0018FA40 0x03FF873C 0x00000000
+00D0: 0x0018FB41 0x0229E208 0x00000000 0x03FF873C
+00E0: 0x0048DAA2 0x00000015 0x00000001 0x00000001
+00F0: 0xFFFFFFFF 0x00292244 0x021EE2F8 0x0018FB64
+0100: 0x021F0101 0x00000000 0x010C0000 0x0000FFFF
+0110: 0x00000001 0x00000000 0x00000098 0x00000098
+0120: 0x00000090 0x0018FB64 0x00000000 0x00000000
+0130: 0x00000000 0x00000000 0x00000000 0x00000000
--------------------------
Loaded Modules:
samp-server.exe A: 0x00400000 - 0x004F5000 (C:\Users\Mathias\Desktop\SAMP\samp-server.exe)
ntdll.dll A: 0x77C20000 - 0x77DA0000 (C:\Windows\SysWOW64\ntdll.dll)
kernel32.dll A: 0x76C20000 - 0x76D30000 (C:\Windows\syswow64\kernel32.dll)
KERNELBASE.dll A: 0x75980000 - 0x759C7000 (C:\Windows\syswow64\KERNELBASE.dll)
SHELL32.dll A: 0x75F00000 - 0x76B4A000 (C:\Windows\syswow64\SHELL32.dll)
msvcrt.dll A: 0x75A30000 - 0x75ADC000 (C:\Windows\syswow64\msvcrt.dll)
SHLWAPI.dll A: 0x77100000 - 0x77157000 (C:\Windows\syswow64\SHLWAPI.dll)
GDI32.dll A: 0x77480000 - 0x77510000 (C:\Windows\syswow64\GDI32.dll)
USER32.dll A: 0x75880000 - 0x75980000 (C:\Windows\syswow64\USER32.dll)
ADVAPI32.dll A: 0x77180000 - 0x77220000 (C:\Windows\syswow64\ADVAPI32.dll)
sechost.dll A: 0x77780000 - 0x77799000 (C:\Windows\SysWOW64\sechost.dll)
RPCRT4.dll A: 0x75E10000 - 0x75F00000 (C:\Windows\syswow64\RPCRT4.dll)
SspiCli.dll A: 0x755B0000 - 0x75610000 (C:\Windows\syswow64\SspiCli.dll)
CRYPTBASE.dll A: 0x755A0000 - 0x755AC000 (C:\Windows\syswow64\CRYPTBASE.dll)
LPK.dll A: 0x75D80000 - 0x75D8A000 (C:\Windows\syswow64\LPK.dll)
USP10.dll A: 0x75750000 - 0x757ED000 (C:\Windows\syswow64\USP10.dll)
WSOCK32.dll A: 0x74150000 - 0x74157000 (C:\Windows\system32\WSOCK32.dll)
WS2_32.dll A: 0x76B50000 - 0x76B85000 (C:\Windows\syswow64\WS2_32.dll)
NSI.dll A: 0x77770000 - 0x77776000 (C:\Windows\syswow64\NSI.dll)
WINMM.dll A: 0x73DB0000 - 0x73DE2000 (C:\Windows\system32\WINMM.dll)
IMM32.DLL A: 0x77420000 - 0x77480000 (C:\Windows\system32\IMM32.DLL)
MSCTF.dll A: 0x76ED0000 - 0x76F9C000 (C:\Windows\syswow64\MSCTF.dll)
sscanf.DLL A: 0x10000000 - 0x1000D000 (C:\Users\Mathias\Desktop\SAMP\plugins\sscanf.DLL)
MSVCR100.dll A: 0x78220000 - 0x782DF000 (C:\Windows\system32\MSVCR100.dll)
mysql.DLL A: 0x00260000 - 0x0026F000 (C:\Users\Mathias\Desktop\SAMP\plugins\mysql.DLL)
LIBMYSQL.dll A: 0x02740000 - 0x028B6000 (C:\Users\Mathias\Desktop\SAMP\LIBMYSQL.dll)
MSVCR90.dll A: 0x72980000 - 0x72A23000 (C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCR90.dll)
MSVCP90.dll A: 0x71B10000 - 0x71B9E000 (C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCP90.dll)
NLAapi.dll A: 0x6E7C0000 - 0x6E7D0000 (C:\Windows\system32\NLAapi.dll)
napinsp.dll A: 0x6E7B0000 - 0x6E7C0000 (C:\Windows\system32\napinsp.dll)
pnrpnsp.dll A: 0x6E790000 - 0x6E7A2000 (C:\Windows\system32\pnrpnsp.dll)
mswsock.dll A: 0x74180000 - 0x741BC000 (C:\Windows\System32\mswsock.dll)
DNSAPI.dll A: 0x73E20000 - 0x73E64000 (C:\Windows\system32\DNSAPI.dll)
winrnr.dll A: 0x6E780000 - 0x6E788000 (C:\Windows\System32\winrnr.dll)
rasadhlp.dll A: 0x71730000 - 0x71736000 (C:\Windows\system32\rasadhlp.dll)
streamer.DLL A: 0x0F690000 - 0x0F6CF000 (C:\Users\Mathias\Desktop\SAMP\plugins\streamer.DLL)
MSVCP120.dll A: 0x0F290000 - 0x0F301000 (C:\Windows\system32\MSVCP120.dll)
MSVCR120.dll A: 0x0F8E0000 - 0x0F9CE000 (C:\Windows\system32\MSVCR120.dll)
wshtcpip.dll A: 0x74170000 - 0x74175000 (C:\Windows\System32\wshtcpip.dll)
IPHLPAPI.DLL A: 0x74280000 - 0x7429C000 (C:\Windows\system32\IPHLPAPI.DLL)
WINNSI.DLL A: 0x74270000 - 0x74277000 (C:\Windows\system32\WINNSI.DLL)
pawn Код:
stock loginPlayer(playerid)
{
new query[256], pName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(query, sizeof(query), "SELECT * FROM users WHERE name = '%s'", pName);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row(query, "|"))
{
mysql_fetch_field("name", Player[playerid][Name]);
mysql_fetch_field("password", Player[playerid][Password]);
mysql_fetch_field("posX", query); Player[playerid][Position][0] = floatstr(query);
mysql_fetch_field("posY", query); Player[playerid][Position][1] = floatstr(query);
mysql_fetch_field("posZ", query); Player[playerid][Position][2] = floatstr(query);
mysql_fetch_field("skin", query); Player[playerid][Skin] = strval(query);
mysql_fetch_field("admin", query); Player[playerid][AdminLevel] = strval(query);
mysql_fetch_field("minutesPlayed", query); Player[playerid][MinutesPlayed] = strval(query);
mysql_fetch_field("money", query); Player[playerid][Money] = strval(query);
mysql_fetch_field("bank", query); Player[playerid][Bank] = strval(query);
mysql_fetch_field("car1", query); Player[playerid][Car1] = strval(query);
mysql_fetch_field("car2", query); Player[playerid][Car2] = strval(query);
mysql_fetch_field("level", query); Player[playerid][Level] = strval(query);
mysql_fetch_field("totalPlayed", query); Player[playerid][TotalPlayed] = strval(query);
mysql_fetch_field("virtualworld", query); Player[playerid][VirtualWorld] = strval(query);
mysql_fetch_field("interior", query); Player[playerid][Interior] = strval(query);
mysql_fetch_field("age", query); Player[playerid][Age] = strval(query);
mysql_fetch_field("sex", query); Player[playerid][Sex] = strval(query);
mysql_fetch_field("House", query); Player[playerid][HouseID] = strval(query);
mysql_fetch_field("Health", query); Player[playerid][Health] = strval(query);
mysql_fetch_field("Armour", query); Player[playerid][Armour] = strval(query);
mysql_fetch_field("Phone", query); Player[playerid][Phone] = strval(query);
mysql_fetch_field("Phonebook", query); Player[playerid][Phonebook] = strval(query);
mysql_fetch_field("pMember", query); Player[playerid][pMember] = strval(query);
mysql_fetch_field("pRank", query); Player[playerid][pRank] = strval(query);
mysql_fetch_field("pLeader", query); Player[playerid][pLeader] = strval(query);
mysql_fetch_field("IsJailed", query); Player[playerid][IsJailed] = strval(query);
mysql_fetch_field("JailTime", query); Player[playerid][JailTime] = strval(query);
mysql_fetch_field("Business", query); Player[playerid][Business] = strval(query);
mysql_fetch_field("Tikis", query); Player[playerid][Tikis] = strval(query);
mysql_fetch_field("WantedLevel", query); Player[playerid][WantedLevel] = strval(query);
mysql_fetch_field("TotalCrimes", query); Player[playerid][TotalCrimes] = strval(query);
mysql_fetch_field("Hospital", query); Player[playerid][Hospital] = strval(query);
mysql_fetch_field("LastLogin", Player[playerid][LastLogin]);
mysql_fetch_field("HasMask", query); Player[playerid][HasMask] = strval(query);
mysql_fetch_field("Masked", query); Player[playerid][Masked] = strval(query);
mysql_fetch_field("RespectPoints", query); Player[playerid][RespectPoints] = strval(query);
mysql_fetch_field("Weapon1", query); Player[playerid][Weapons][0] = strval(query);
mysql_fetch_field("Weapon2", query); Player[playerid][Weapons][1] = strval(query);
mysql_fetch_field("Weapon3", query); Player[playerid][Weapons][2] = strval(query);
mysql_fetch_field("Weapon4", query); Player[playerid][Weapons][3] = strval(query);
mysql_fetch_field("Weapon5", query); Player[playerid][Weapons][4] = strval(query);
mysql_fetch_field("Weapon6", query); Player[playerid][Weapons][5] = strval(query);
mysql_fetch_field("Weapon7", query); Player[playerid][Weapons][6] = strval(query);
mysql_fetch_field("Weapon8", query); Player[playerid][Weapons][7] = strval(query);
mysql_fetch_field("Weapon9", query); Player[playerid][Weapons][8] = strval(query);
mysql_fetch_field("Weapon10", query); Player[playerid][Weapons][9] = strval(query);
mysql_fetch_field("Weapon11", query); Player[playerid][Weapons][10] = strval(query);
mysql_fetch_field("Weapon12", query); Player[playerid][Weapons][11] = strval(query);
mysql_fetch_field("Weapon13", query); Player[playerid][Weapons][12] = strval(query);
mysql_fetch_field("Ammo1", query); Player[playerid][Ammo][0] = strval(query);
mysql_fetch_field("Ammo2", query); Player[playerid][Ammo][1] = strval(query);
mysql_fetch_field("Ammo3", query); Player[playerid][Ammo][2] = strval(query);
mysql_fetch_field("Ammo4", query); Player[playerid][Ammo][3] = strval(query);
mysql_fetch_field("Ammo5", query); Player[playerid][Ammo][4] = strval(query);
mysql_fetch_field("Ammo6", query); Player[playerid][Ammo][5] = strval(query);
mysql_fetch_field("Ammo7", query); Player[playerid][Ammo][6] = strval(query);
mysql_fetch_field("Ammo8", query); Player[playerid][Ammo][7] = strval(query);
mysql_fetch_field("Ammo9", query); Player[playerid][Ammo][8] = strval(query);
mysql_fetch_field("Ammo10", query); Player[playerid][Ammo][9] = strval(query);
mysql_fetch_field("Ammo11", query); Player[playerid][Ammo][10] = strval(query);
mysql_fetch_field("Ammo12", query); Player[playerid][Ammo][11] = strval(query);
mysql_fetch_field("Ammo13", query); Player[playerid][Ammo][12] = strval(query);
mysql_fetch_field("Banned", query); Player[playerid][Banned] = strval(query);
mysql_fetch_field("BanReason", Player[playerid][BanReason]);
mysql_fetch_field("BannedBy", Player[playerid][BannedBy]);
mysql_fetch_field("fMember", query); Player[playerid][fMember] = strval(query);
mysql_fetch_field("fRank", query); Player[playerid][fRank] = strval(query);
mysql_fetch_field("licenseDriver", query); Player[playerid][Licenses][0] = strval(query);
mysql_fetch_field("licensePilot", query); Player[playerid][Licenses][1] = strval(query);
mysql_fetch_field("licenseSailor", query); Player[playerid][Licenses][2] = strval(query);
mysql_fetch_field("licenseWeapon", query); Player[playerid][Licenses][3] = strval(query);
mysql_fetch_field("Map", query); Player[playerid][Map] = strval(query);
mysql_fetch_field("bookedTest", query); Player[playerid][bookedTest] = strval(query);
mysql_fetch_field("bookedType", query); Player[playerid][bookedType] = strval(query);
mysql_fetch_field("newbieTag", query); Player[playerid][newbieTag] = strval(query);
mysql_fetch_field("Helper", query); Player[playerid][Helper] = strval(query);
mysql_fetch_field("Developer", query); Player[playerid][Developer] = strval(query);
LoadVehicle(Player[playerid][Car1]);
LoadVehicle(Player[playerid][Car2]);
}
Player[playerid][IsHidden] = 0;
Player[playerid][justLogged] = 1;
format(string, sizeof(string), "Welcome back, %s! Your character has been loaded.", GetAdminRPName(playerid));
SendClientMessage(playerid, -1, string);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, Player[playerid][Money]);
SetPlayerScore(playerid, Player[playerid][Level]);
SetPlayerVirtualWorld(playerid, Player[playerid][VirtualWorld]);
SetPlayerInterior(playerid, Player[playerid][Interior]);
SetPlayerColor(playerid, COLOR_WHITE);
SetPlayerWantedLevel(playerid, Player[playerid][WantedLevel]);
if(Player[playerid][Masked])
{
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
} else {
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
}
}
I get the register dialog, but as soon as I press enter/"Register" the server dies, but the accounts are inserted into my MySQL database. Also, why the insert query is so small is because I have set default values for everything else.
Logging in to a already existing account works fine but not new ones or something.
Edit: Also, why I am not hashing the PW's or such yet is because I'm still working on the gamemode, so I'll add it later.