AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [SQLx]Thread worked was unable to start (https://forums.alliedmods.net/showthread.php?t=332343)

lexzor 05-06-2021 10:14

[SQLx]Thread worked was unable to start
 
hello
how can i get rid of this error ?

Code:

L 05/06/2021 - 17:08:35: [MySQL] Thread worker was unable to start.
L 05/06/2021 - 17:08:35: [AMXX] Displaying debug trace (plugin "panel.amxx", version "1.0")
L 05/06/2021 - 17:08:35: [AMXX] Run time error 10: native error (native "SQL_ThreadQuery")
L 05/06/2021 - 17:08:35: [AMXX]    [0] panel.sma::InsertDataIntoSql (line 612)

it appears after map is changing and players are joining on server.

i'm using a query for every player to save some data.

Natsheh 05-06-2021 11:57

Re: [SQLx]Thread worked was unable to start
 
How are you suppose to get any help if you're not posting any source code?

lexzor 05-06-2021 12:12

Re: [SQLx]Thread worked was unable to start
 
PHP Code:

public client_putinserver(id)
{
    if (
is_user_bot(id) || is_user_hltv(id) || !is_user_connected(id))
        return 

    
g_iPlayedTime[id][Seconds] = 0
    g_iPlayedTime
[id][Minutes] = 0
    g_iPlayedTime
[id][Hours] = 0

    get_users_info
(id)

    
check_player_sql_info(id)
}

public 
check_player_sql_info(id)
{
    new 
szQuery[512], szData[1]
    
szData[0] = id

    get_users_info
(id)

    
formatex(szQuerycharsmax(szQuery), "SELECT * FROM `%s` WHERE `name` = '%s'"g_szTables[5], g_iPlayersInfo[id][Name])
    
SQL_ThreadQuery(g_SqlTuple"GetPlayerData"szQueryszData1)
}

public 
GetPlayerData(FailStateHandle:QueryszError[], ErrorCodeszData[], iSize)
{
    if(
FailState || ErrorCode)
    {
        
server_print(" ")
        
server_print("[Advanced Panel] SQL ERROR: %s"szError)
        
server_print(" ")
    }

    new 
id szData[0]
    new 
szQuery[512]

    
mysql_escape_string(g_iPlayersInfo[id][Name], charsmax(g_iPlayersInfo[][Name]))

    
get_users_info(id)
    
format_lastvisit_string(id)

    if(
SQL_NumResults(Query) < 1)
    {
        
copy(g_iPlayersInfo[id][LastVisit], charsmax(g_iPlayersInfo[][LastVisit]), g_iPlayersInfo[id][FirstSeen])

        
formatex(szQuerycharsmax(szQuery), "INSERT INTO `%s` ( `name`,`ipaddress`,`steamid`,`frags`,`deaths`,`headshots`,`score`,`firstseen`,`lastvisit`,`total_played_time` ) VALUES ( '%s','%s','%s','0','0','0','0','%s','%s','00:00:00' )"
        
g_szTables[5], g_iPlayersInfo[id][Name], g_iPlayersInfo[id][Address], g_iPlayersInfo[id][AuthID], g_iPlayersInfo[id][FirstSeen], g_iPlayersInfo[id][LastVisit])

        
SQL_ThreadQuery(g_SqlTuple"FreeHandle"szQuery)
    }
    else 
    {
        
formatex(szQuerycharsmax(szQuery), "UPDATE `%s` SET `lastvisit` = '%s'"g_szTables[5], g_iPlayersInfo[id][LastVisit])
        
SQL_ThreadQuery(g_SqlTuple"FreeHandle"szQuery)
    }
}

public 
FreeHandle(FailStateHandle:QueryszError[], ErrorCodeszData[], iSize)
{
    if(
FailState || ErrorCode)
    {
        
server_print(" ")
        
server_print("[Advanced Panel] SQL ERROR: %s"szError)
        
server_print(" ")
    }
    
    
SQL_FreeHandle(Query);


i read a topic where bugsy say this is not a code problem is a sqlx socket problem or smth like this and i was thinking that i don t need to post code and there is a simple solution like create a set_task for every id.

anyway, if you have any advices to improve the code tell me how

Bugsy 05-20-2021 23:04

Re: [SQLx]Thread worked was unable to start
 
I'm not sure if it's a module issue as I've never had this issue with SQLx so it may be a query problem. Have you outputted your queries in a log file to confirm they are formatted correctly?

It's hard for anyone to troubleshoot with only parts of the code. I am not going to spend the time to fill in the blanks to get it to compile and test.

Natsheh 05-21-2021 07:55

Re: [SQLx]Thread worked was unable to start
 
Why you didnt show this function panel.sma::InsertDataIntoSql

Rohanlogs 05-21-2021 14:00

Re: [SQLx]Thread worked was unable to start
 
You're asking how to get rid of an error in code, without showing the code.
Eh..? If you don't want to, you don't have to post the whole script, however we need to see the line where the error occurs and all other functions/variables which are connected/calling that function which causes the error.
Like bugsy said nobody is going to take their time to try and fill in the blanks to somehow reproduce your error..

You thinking you don't need to post the code because its just ''sqlx problem'' which someone said 10 years ago is absurd. I'm detecting a little bit of XY problem here.

We can't give you a magical solution to these kind of errors without seeing the code.

lexzor 05-22-2021 12:05

Re: [SQLx]Thread worked was unable to start
 
I posted the wrong code. Sorry about this.

Problem solved: There must be a delay after map change for query and add is_user_connected check.
PHP Code:

switch(id)
    {
        case 
1..9set_task(0.1"insert_new_player"id PutInTask)
        case 
10..21set_task(0.2"insert_new_player"id PutInTask)
        case 
22..32set_task(0.3"insert_new_player"id PutInTask)
    } 



All times are GMT -4. The time now is 02:39.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.