Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] invalid connection handle

 
  • 0 Vote(s) - 0 Average
Pawn invalid connection handle
IdontMIss
Offline

Burgershot Member
Posts: 3
Threads: 1
Joined: Aug 2019
Reputation: 0
#1
2019-08-04, 06:58 PM (This post was last modified: 2019-08-04, 07:10 PM by IdontMIss.)
I started scripting a fresh new TDM script from 0 and I wanted to try out the bcyrpt hashing alg and everything went fine I created a register/login system but when I wanted to test it next things happend:

myScript:
Code:
public OnPlayerConnect(playerid) {
    new query[256];
    mysql_format(SQL, query, sizeof query, "SELECT * FROM `players` WHERE `name`='%e' LIMIT 1", GetPlayerNameEx(playerid)); // 9
    mysql_pquery(SQL, query, "OnAccountCheck", "i", playerid); // 10
    #if defined reg_OnPlayerConnect
        return reg_OnPlayerConnect(playerid);
    #else
        return true;
    #endif
}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect reg_OnPlayerConnect
#if defined reg_OnPlayerConnect
    forward reg_OnPlayerConnect(playerid);
#endif

The errors I get in mysql
Code:
[INFO] changed log level from 'warning, error' to 'debug, info, warning, error'
[DEBUG] CThreadedConnection::WorkerFunc(this=0x41ea020, connection=0x41ea020)
[DEBUG] mysql_format(111, 0x0307AF98, 256, "SELECT * FROM `players` WHERE `name` = '%e'") (modules/register.pwn:10)
[ERROR] mysql_format: invalid connection handle '111' (modules/register.pwn:10)
[DEBUG] mysql_pquery(111, "", "OnAccountCheck", "i") (modules/register.pwn:11)
[ERROR] mysql_pquery: invalid connection handle '111' (modules/register.pwn:11)
[DEBUG] mysql_pquery: return value: '0' (modules/register.pwn:11)

EDIT: I use R41-4 and this happens after OnGameModeInit, and my connection is successful
IdontMIss
Offline

Burgershot Member
Posts: 3
Threads: 1
Joined: Aug 2019
Reputation: 0
#2
2019-08-04, 07:26 PM
For some reason my connection handle changes?

Code:
    new q[256];
    printf("%d // 1", _:SQL);
    mysql_format(1, q, sizeof q, "SELECT * FROM `players` WHERE `name`='%e' LIMIT 1", GetPlayerNameEx(playerid));
    printf("%d // 2", _:SQL);
    mysql_pquery(1, q, "OnAccountCheck", "i", playerid);
    printf("%d // 3", _:SQL);
Returns:

Code:
1 // 1
111 // 2
111 // 3
IdontMIss
Offline

Burgershot Member
Posts: 3
Threads: 1
Joined: Aug 2019
Reputation: 0
#3
2019-08-04, 08:07 PM
Well I found out why,

Code:
forward [MAX_PLAYER_NAME + 1]GetPlayerNameEx(playerid);
GetPlayerNameEx(playerid) {
    new name[MAX_PLAYER_NAME + 1];
    GetPlayerName(playerid, name, sizeof name);
    return name;
}
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode