Maxips2, there's a bug with the sizeof operator and enums used together.
pawn Code:
pawn Code:
So you'll have to explicitly (as of plugin R8 or something like that) specify the 4th and 5th parameters (connection and sizeof destination) in your cache_get_row_line. pawn Code:
I was actually thinking of releasing a plugin myself, perhaps called "Simple MySQL plugin" or something due to its stripped down nature (everything except for the cache-related and required functions are removed). Also never have I had to face a crash due to the plugin. |
public OnPlayerConnect( playerid ) { format( gsQuery, 128, "SELECT * FROM `Banlist` WHERE `IP` = '%s' OR `Name` = '%s'", GetPlayerIPEx( playerid ), PlayerName( playerid ) ); mysql_function_query( g_Handle, gsQuery, true, "BanListCheck", "i", playerid ); return 1; }
SQL_Function BanListCheck( playerid ) { if ( !IsPlayerConnected( playerid ) ) return 1; new count_rows, fields; cache_get_data( count_rows, fields, g_Handle ); if ( !count_rows ) OnPlayerConnectEx( playerid ); else { new bField[ 6 ][ 128 ]; cache_get_field_content( 0, "Reason", bField[ 0 ] ); cache_get_field_content( 0, "Admin", bField[ 1 ] ); cache_get_field_content( 0, "BanDate", bField[ 2 ] ); cache_get_field_content( 0, "BanTime", bField[ 3 ] ); cache_get_field_content( 0, "BanDays", bField[ 4 ] ); cache_get_field_content( 0, "Aproove", bField[ 5 ] ); if ( strval( bField[ 4 ] ) < getdate( ) ) OnPlayerConnectEx( playerid ); else { if ( strval( bField[ 5 ] ) != 0 ) OnPlayerConnectEx( playerid ); else { TextDrawShowForPlayer( playerid, Ban_Backround ); TextDrawShowForPlayer( playerid, Ban_Info ); TextDrawShowForPlayer( playerid, Ban_Message ); TextDrawShowForPlayer( playerid, Ban_Details_TD ); TextDrawShowForPlayer( playerid, Ban_Mistake ); format( gsString, 512, "~y~~h~Banned by Administrator: %s~n~Ban Date: %s~n~Ban Time: %s~n~Ban Reason: %s", bField[ 1 ], bField[ 2 ], bField[ 3 ], bField[ 0 ] ); TextDrawSetString( Ban_Details[ playerid ], gsString ); TextDrawShowForPlayer( playerid, Ban_Details[ playerid ] ); SetTimerEx( "KickPlayer", 3500, false, "e", playerid ); } } } return 1; }
mysql_format(cH,string,"UPDATE Accounts SET Pos_y=%f WHERE Nummer=15808 LIMIT 1;",-1705.123456);
Found a bug (only Linux Server)
Current Version: Linux r14 (Static Build) Код:
mysql_format(cH,string,"UPDATE Accounts SET Pos_y=%f WHERE Nummer=15808 LIMIT 1;",-1705.123456); But only if the script is running on a linux server, there isn't a problem with windows. |
[16:58:44] [debug] Server crashed due to an unknown error [16:58:44] [debug] Thread backtrace: [16:58:45] [debug] #0 0049D286 in ?? () from E:\WOS\Build 29\samp-server.exe [16:58:45] [debug] #1 004966C1 in ?? () from E:\WOS\Build 29\samp-server.exe [16:58:45] [debug] #2 75C01154 in BaseThreadInitThunk () from C:\Windows\system32\kernel32.dll [16:58:45] [debug] #3 778BB299 in RtlInitializeExceptionChain () from C:\Windows\SYSTEM32\ntdll.dll [16:58:45] [debug] #4 778BB26C in RtlInitializeExceptionChain () from C:\Windows\SYSTEM32\ntdll.dll
I don't know. That's the reason why i asking. And the crashdetect outputs me strange...
|
You can use the static version of the plugin, it works pretty well for me using CentOS 6.3
|
Using the static version or the normal one, I get this:
"/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by plugins/mysql.so)" |
yum provides libstdc++.so.6
I can help you, but you have to show more information.
When is the server crashing? Show me the code where it happens. |
Код:
public OnPlayerConnect( playerid ) { format( gsQuery, 128, "SELECT * FROM `Banlist` WHERE `IP` = '%s' OR `Name` = '%s'", GetPlayerIPEx( playerid ), PlayerName( playerid ) ); mysql_function_query( g_Handle, gsQuery, true, "BanListCheck", "i", playerid ); return 1; } Код:
SQL_Function BanListCheck( playerid ) { if ( !IsPlayerConnected( playerid ) ) return 1; new count_rows, fields; cache_get_data( count_rows, fields, g_Handle ); if ( !count_rows ) OnPlayerConnectEx( playerid ); else { new bField[ 6 ][ 128 ]; cache_get_field_content( 0, "Reason", bField[ 0 ] ); cache_get_field_content( 0, "Admin", bField[ 1 ] ); cache_get_field_content( 0, "BanDate", bField[ 2 ] ); cache_get_field_content( 0, "BanTime", bField[ 3 ] ); cache_get_field_content( 0, "BanDays", bField[ 4 ] ); cache_get_field_content( 0, "Aproove", bField[ 5 ] ); if ( strval( bField[ 4 ] ) < getdate( ) ) OnPlayerConnectEx( playerid ); else { if ( strval( bField[ 5 ] ) != 0 ) OnPlayerConnectEx( playerid ); else { TextDrawShowForPlayer( playerid, Ban_Backround ); TextDrawShowForPlayer( playerid, Ban_Info ); TextDrawShowForPlayer( playerid, Ban_Message ); TextDrawShowForPlayer( playerid, Ban_Details_TD ); TextDrawShowForPlayer( playerid, Ban_Mistake ); format( gsString, 512, "~y~~h~Banned by Administrator: %s~n~Ban Date: %s~n~Ban Time: %s~n~Ban Reason: %s", bField[ 1 ], bField[ 2 ], bField[ 3 ], bField[ 0 ] ); TextDrawSetString( Ban_Details[ playerid ], gsString ); TextDrawShowForPlayer( playerid, Ban_Details[ playerid ] ); SetTimerEx( "KickPlayer", 3500, false, "e", playerid ); } } } return 1; } |
Can you please, PLEASE, add mysql_wait(handle) function? I NEED to return last insert ID. But instead I have to go through lots of stuff because apparently multi-threading is better. I need a function to damn delay my own server if I want to.
|
public SomeQuery()
{
// ...
mysql_format(mysql, query, "INSERT INTO vehicle (Model) VALUES (%i)", model);
mysql_function_query(mysql, query, false, "InsertMySQL", "i", playerid);
return 1;
}
public InsertMySQL(playerid)
{
SendFormatMessage(playerid, -1, "SERVER: INSERT registered with ID %d", mysql_insert_id());
return 1;
}
stock foo() { mysql_query(...); ... return mysql_insert_id(); } main() { printf("Last insert ID: %d", foo()); }