I have big problem, with this plugin. My server shut down after player disconnect(while updating player info with function orm_update). I don't know what to do, please help me. I'am using MySQL R37, operating system is Windows 7.
Code:
Code:
enum pInfo
{
ORM:ORM_ID,
ID,
IP[24],
Name[MAX_PLAYER_NAME+1],
Password[101],
pScore,
pMoney,
pSkin,
pCookies,
pKills,
Float:pPosX,
Float:pPosY,
Float:pPosZ,
Float:pPosA,
bool: Admin,
bool: VIP,
Kalba,
Ispejimai,
Float: PosX,
Float: PosY,
Float: PosZ,
Float: PosA,
Registracija[MAX_PLAYERS],
PaskutinisIP[24],
Email[101]
}
new MySQL = -1;
new PlayerInfo[MAX_PLAYERS][pInfo];
forward OnPlayerDataLoad(playerid);
public OnGameModeInit()
{
mysql_log();
MySQL = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
return 1;
}
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, PlayerInfo[playerid][Name], MAX_PLAYER_NAME);
new ORM:ormid = PlayerInfo[playerid][ORM_ID] = orm_create("playerdata");
orm_addvar_int(ormid, PlayerInfo[playerid][ID], "id");
orm_addvar_string(ormid, PlayerInfo[playerid][Name], MAX_PLAYER_NAME+1, "user");
orm_addvar_string(ormid, PlayerInfo[playerid][Password], 101, "password");
orm_addvar_int(ormid, PlayerInfo[playerid][Kalba], "kalba");
orm_addvar_int(ormid, PlayerInfo[playerid][pScore], "score");
orm_addvar_int(ormid, PlayerInfo[playerid][pMoney], "money");
orm_addvar_int(ormid, PlayerInfo[playerid][pSkin], "skin");
orm_addvar_float(ormid, PlayerInfo[playerid][PosX], "posx");
orm_addvar_float(ormid, PlayerInfo[playerid][PosY], "posy");
orm_addvar_float(ormid, PlayerInfo[playerid][PosZ], "posz");
orm_addvar_float(ormid, PlayerInfo[playerid][PosA], "posa");
orm_addvar_int(ormid, PlayerInfo[playerid][Registracija], "reg");
orm_addvar_string(ormid, PlayerInfo[playerid][IP], 24, "IP");
orm_addvar_string(ormid, PlayerInfo[playerid][PaskutinisIP], 24, "prisijungip");
orm_addvar_string(ormid, PlayerInfo[playerid][Email], 101, "email");
orm_setkey(ormid, "user");
orm_select(ormid, "OnPlayerDataLoad", "d", playerid);
return 1;
}
public OnPlayerDataLoad(playerid)
{
switch(orm_errno(PlayerInfo[playerid][ORM_ID]))
{
case ERROR_OK:
{
// Login
}
case ERROR_NO_DATA:
{
// Register
}
}
orm_setkey(PlayerInfo[playerid][ORM_ID], "ID");
printf("» Ћaidėjas %s prisijungė!", GetName(playerid));
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(PlayerInfo[playerid][ID] != 0)
{
GetPlayerPos(playerid,PlayerInfo[playerid][PosX],PlayerInfo[playerid][PosY],PlayerInfo[playerid][PosZ]);
GetPlayerFacingAngle(playerid,PlayerInfo[playerid][PosA]);
orm_update(PlayerInfo[playerid][ORM_ID]);
}
orm_destroy(PlayerInfo[playerid][ORM_ID]);
return 1;
}
mysql_log.txt info:
Code:
[13:12:31] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "freeroam", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[13:12:31] [DEBUG] CMySQLHandle::Create - creating new connection..
[13:12:31] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called
[13:12:31] [DEBUG] CMySQLHandle::Create - connection created (id: 1)
[13:12:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:12:31] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:12:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:12:31] [DEBUG] mysql_errno - connection: 1
[13:12:31] [DEBUG] mysql_format - connection: 1, len: 2000, format: "UPDATE serveris SET sname = 'FreeRoam', sip = '127.0.0.1', sport = '7777', sgmv = 'SA-FR 0.0.1 Beta', s..."
[13:12:31] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE serveris SET sname = 'FreeRoam', si", callback: "(null)", format: "(null)"
[13:12:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:12:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:12:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:12:31] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:12:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:12:31] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:12:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:12:31] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:12:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:12:31] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[13:12:31] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 29.807 milliseconds
[13:12:31] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
[13:13:13] [DEBUG] orm_create - table: "playerdata", connectionHandle: 1
[13:13:13] [DEBUG] COrm::Create - creating new orm object..
[13:13:13] [DEBUG] COrm::Create - orm object created (id: 1)
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879C34, datatype: 0, varname: "id", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879C98, datatype: 2, varname: "user", var_maxlen: 25
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879CFC, datatype: 2, varname: "password", var_maxlen: 101
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879EBC, datatype: 0, varname: "kalba", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879E90, datatype: 0, varname: "score", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879E94, datatype: 0, varname: "money", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879E98, datatype: 0, varname: "skin", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879EC4, datatype: 1, varname: "posx", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879EC8, datatype: 1, varname: "posy", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879ECC, datatype: 1, varname: "posz", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879ED0, datatype: 1, varname: "posa", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879ED4, datatype: 0, varname: "reg", var_maxlen: 1
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 03879C38, datatype: 2, varname: "IP", var_maxlen: 24
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 0387A0B8, datatype: 2, varname: "prisijungip", var_maxlen: 24
[13:13:13] [DEBUG] orm_addvar - orm_id: 1, var: 0387A118, datatype: 2, varname: "email", var_maxlen: 101
[13:13:13] [DEBUG] orm_setkey - orm_id: 1, varname: "user"
[13:13:13] [DEBUG] orm_select - orm_id: 1, callback: "OnPlayerDataLoad", format: "d"
[13:13:13] [DEBUG] CMySQLQuery::Execute[OnPlayerDataLoad] - starting query execution
[13:13:13] [DEBUG] CMySQLQuery::Execute[OnPlayerDataLoad] - query was successfully executed within 0.545 milliseconds
[13:13:13] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '0', data: "90"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '1', data: "1845c5654ddfca52d6d38181a93ade47"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '2', data: "0"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '3', data: "0"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '4', data: "0"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '5', data: "0"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '6', data: "0"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '7', data: "0"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '8', data: "0"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '9', data: "0"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '10', data: "4"
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '11', data: ""
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '12', data: ""
[13:13:13] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '13', data: "test@gmail.com"
[13:13:13] [DEBUG] Calling callback "OnPlayerDataLoad"..
[13:13:13] [DEBUG] orm_errno - orm_id: 1
[13:13:13] [DEBUG] orm_setkey - orm_id: 1, varname: "ID"
[13:13:13] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[13:13:25] [DEBUG] mysql_escape_string - source: "123456789", connection: 1, max_len: 101
[13:13:30] [DEBUG] orm_update - orm_id: 1
crashinfo:
Code:
Loaded Modules:
samp-server.exe A: 0x00400000 - 0x004F5000 (C:\Users\Auksinis\Desktop\MySQL\samp-server.exe)
ntdll.dll A: 0x77650000 - 0x7778C000 (C:\Windows\SYSTEM32\ntdll.dll)
kernel32.dll A: 0x75FE0000 - 0x760B4000 (C:\Windows\system32\kernel32.dll)
KERNELBASE.dll A: 0x75930000 - 0x7597B000 (C:\Windows\system32\KERNELBASE.dll)
SHELL32.dll A: 0x76240000 - 0x76E8A000 (C:\Windows\system32\SHELL32.dll)
msvcrt.dll A: 0x775A0000 - 0x7764C000 (C:\Windows\system32\msvcrt.dll)
SHLWAPI.dll A: 0x77540000 - 0x77597000 (C:\Windows\system32\SHLWAPI.dll)
GDI32.dll A: 0x771C0000 - 0x7720E000 (C:\Windows\system32\GDI32.dll)
USER32.dll A: 0x770F0000 - 0x771B9000 (C:\Windows\system32\USER32.dll)
LPK.dll A: 0x76230000 - 0x7623A000 (C:\Windows\system32\LPK.dll)
USP10.dll A: 0x76190000 - 0x7622D000 (C:\Windows\system32\USP10.dll)
WSOCK32.dll A: 0x6D060000 - 0x6D067000 (C:\Windows\system32\WSOCK32.dll)
WS2_32.dll A: 0x770B0000 - 0x770E5000 (C:\Windows\system32\WS2_32.dll)
RPCRT4.dll A: 0x777D0000 - 0x77872000 (C:\Windows\system32\RPCRT4.dll)
NSI.dll A: 0x759C0000 - 0x759C6000 (C:\Windows\system32\NSI.dll)
WINMM.dll A: 0x73040000 - 0x73072000 (C:\Windows\system32\WINMM.dll)
IMM32.DLL A: 0x777B0000 - 0x777CF000 (C:\Windows\system32\IMM32.DLL)
MSCTF.dll A: 0x760C0000 - 0x7618C000 (C:\Windows\system32\MSCTF.dll)
mysql.DLL A: 0x67450000 - 0x6748F000 (C:\Users\Auksinis\Desktop\MySQL\plugins\mysql.DLL)
LIBMYSQL.dll A: 0x10000000 - 0x1023E000 (C:\Users\Auksinis\Desktop\MySQL\LIBMYSQL.dll)
ADVAPI32.dll A: 0x774A0000 - 0x77540000 (C:\Windows\system32\ADVAPI32.dll)
sechost.dll A: 0x77790000 - 0x777A9000 (C:\Windows\SYSTEM32\sechost.dll)
MSVCP110.dll A: 0x673C0000 - 0x67445000 (C:\Windows\system32\MSVCP110.dll)
MSVCR110.dll A: 0x672E0000 - 0x673B6000 (C:\Windows\system32\MSVCR110.dll)
NLAapi.dll A: 0x73B70000 - 0x73B80000 (C:\Windows\system32\NLAapi.dll)
napinsp.dll A: 0x717C0000 - 0x717D0000 (C:\Windows\system32\napinsp.dll)
pnrpnsp.dll A: 0x717A0000 - 0x717B2000 (C:\Windows\system32\pnrpnsp.dll)
mswsock.dll A: 0x750A0000 - 0x750DC000 (C:\Windows\System32\mswsock.dll)
DNSAPI.dll A: 0x74F60000 - 0x74FA4000 (C:\Windows\system32\DNSAPI.dll)
winrnr.dll A: 0x71790000 - 0x71798000 (C:\Windows\System32\winrnr.dll)
rasadhlp.dll A: 0x70590000 - 0x70596000 (C:\Windows\system32\rasadhlp.dll)
sscanf.DLL A: 0x01220000 - 0x0122B000 (C:\Users\Auksinis\Desktop\MySQL\plugins\sscanf.DLL)
MSVCR90.dll A: 0x6EE50000 - 0x6EEF3000 (C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCR90.dll)
streamer.DLL A: 0x69640000 - 0x6966D000 (C:\Users\Auksinis\Desktop\MySQL\plugins\streamer.DLL)
MSVCP90.dll A: 0x6B640000 - 0x6B6CE000 (C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCP90.dll)
dbghelp.dll A: 0x64690000 - 0x6477B000 (C:\Windows\system32\dbghelp.dll)
MSVCP100.dll A: 0x5BBB0000 - 0x5BC19000 (C:\Windows\system32\MSVCP100.dll)
MSVCR100.dll A: 0x71B60000 - 0x71C1F000 (C:\Windows\system32\MSVCR100.dll)
wshtcpip.dll A: 0x74B30000 - 0x74B35000 (C:\Windows\System32\wshtcpip.dll)
IPHLPAPI.DLL A: 0x73790000 - 0x737AC000 (C:\Windows\system32\IPHLPAPI.DLL)
WINNSI.DLL A: 0x73780000 - 0x73787000 (C:\Windows\system32\WINNSI.DLL)
CRYPTBASE.dll A: 0x755E0000 - 0x755EC000 (C:\Windows\system32\CRYPTBASE.dll)
uxtheme.dll A: 0x742C0000 - 0x74300000 (C:\Windows\system32\uxtheme.dll)
PROPSYS.dll A: 0x74400000 - 0x744F5000 (C:\Windows\system32\PROPSYS.dll)
OLEAUT32.dll A: 0x75E20000 - 0x75EAF000 (C:\Windows\system32\OLEAUT32.dll)
comctl32.dll A: 0x74540000 - 0x746DE000 (C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll)
apphelp.dll A: 0x75590000 - 0x755DC000 (C:\Windows\system32\apphelp.dll)
CLBCatQ.DLL A: 0x759D0000 - 0x75A53000 (C:\Windows\system32\CLBCatQ.DLL)
api-ms-win-downlevel-advapi32-l1-1-0.dll A: 0x758B0000 - 0x758B5000 (C:\Windows\system32\api-ms-win-downlevel-advapi32-l1-1-0.dll)
api-ms-win-downlevel-shlwapi-l1-1-0.dll A: 0x756E0000 - 0x756E4000 (C:\Windows\system32\api-ms-win-downlevel-shlwapi-l1-1-0.dll)
SETUPAPI.dll A: 0x77270000 - 0x7740D000 (C:\Windows\system32\SETUPAPI.dll)
CFGMGR32.dll A: 0x758F0000 - 0x75917000 (C:\Windows\system32\CFGMGR32.dll)
DEVOBJ.dll A: 0x758C0000 - 0x758D2000 (C:\Windows\system32\DEVOBJ.dll)
ntmarta.dll A: 0x74BB0000 - 0x74BD1000 (C:\Windows\system32\ntmarta.dll)
WLDAP32.dll A: 0x77210000 - 0x77255000 (C:\Windows\system32\WLDAP32.dll)
Secur32.dll A: 0x75550000 - 0x75558000 (C:\Windows\system32\Secur32.dll)
SSPICLI.DLL A: 0x75570000 - 0x7558B000 (C:\Windows\system32\SSPICLI.DLL)
api-ms-win-downlevel-advapi32-l2-1-0.dll A: 0x707C0000 - 0x707C4000 (C:\Windows\system32\api-ms-win-downlevel-advapi32-l2-1-0.dll)
Crash Detect info:
Code:
[12:43:28] [debug] Server crashed while executing SA-FR.amx
[12:43:28] [debug] AMX backtrace:
[12:43:28] [debug] #0 native orm_update () [673daec0] from mysql.DLL
[12:43:28] [debug] #1 00046bac in ?? (0x00000000) from SA-FR.amx
[12:43:28] [debug] #2 00016004 in ?? (0x00000000, 0x00000001) from SA-FR.amx
[12:43:28] [debug] #3 00005fd0 in public Itter_OnPlayerDisconnect (0x00000000, 0x00000001) from SA-FR.amx
[12:43:28] [debug] #4 00001d14 in public OnPlayerDisconnect (0x00000000, 0x00000001) from SA-FR.amx
[12:43:28] [debug] Native backtrace:
[12:43:28] [debug] #0 673d17f5 in ?? () from plugins\mysql.DLL
[12:43:28] [debug] #1 673dafdf in ?? () from plugins\mysql.DLL
[12:43:28] [debug] #2 004010b6 in ?? () from samp-server.exe
[12:43:28] [debug] #3 673158ca in ?? () from plugins\crashdetect.DLL
[12:43:28] [debug] #4 6731774f in ?? () from plugins\crashdetect.DLL
[12:43:28] [debug] #5 67310834 in ?? () from plugins\crashdetect.DLL
[12:43:28] [debug] #6 6731591a in ?? () from plugins\crashdetect.DLL
[12:43:28] [debug] #7 0046cc7b in ?? () from samp-server.exe
[12:43:28] [debug] #8 0046600e in ?? () from samp-server.exe
[12:43:28] [debug] #9 673c15e3 in ?? () from plugins\mysql.DLL
[12:43:28] [debug] #10 004877cb in ?? () from samp-server.exe
[12:43:28] [debug] #11 5c8b01f8 in ?? () from samp-server.exe
[12:43:28] [debug] #12 61750824 in ?? () from samp-server.exe