mysql_pquery crashing server
#1

Hi, I'm making an inventory system, but when it's supposed to load the inventory the server crashes at the mysql_pquery part where it selects the items from the database.
Here's the code:
Код:
forward OnCharacterLoaded(playerid);
public OnCharacterLoaded(playerid)
{
	new rows;
	
	cache_get_row_count(rows);
	
	if (!rows)
	{
		PlayerInfo[playerid][pCharacterID] = 0;
		ShowCharacters(playerid);
	}
	else
	{
		new name[MAX_PLAYER_NAME], query[80];
		
		cache_get_value_name(0, "Name", name, sizeof(name));
		cache_get_value_name_int(0, "Gender", PlayerInfo[playerid][pGender]);
		cache_get_value_name(0, "Birthdate", PlayerInfo[playerid][pBirthdate], 11);
		cache_get_value_name_int(0, "Skin", PlayerInfo[playerid][pSkin]);
		cache_get_value_name_float(0, "PosX", PlayerInfo[playerid][pPos][0]);
		cache_get_value_name_float(0, "PosY", PlayerInfo[playerid][pPos][1]);
		cache_get_value_name_float(0, "PosZ", PlayerInfo[playerid][pPos][2]);
		cache_get_value_name_float(0, "PosA", PlayerInfo[playerid][pPos][3]);
		
		SetPlayerName(playerid, name);
		
		mysql_format(database, query, sizeof(query), "SELECT * FROM inventories WHERE CharacterID = %d LIMIT %d", PlayerInfo[playerid][pCharacterID], MAX_INVENTORY);
		mysql_pquery(database, query, "OnInventoryLoaded", "d", playerid);
	}
	for (new i = 6; i <= 13; i++) PlayerTextDrawHide(playerid, PlayerInfo[playerid][pTextdraw][i]);
	TextDrawHideForPlayer(playerid, g_Textdraw[4]);
}
I've been trying to figure out this for an hour now, but I can't find any mistakes, because the query works, I tried it in phpmyadmin, I have the "OnInventoryLoaded" callback and I have the table.
This is what crashdetect prints:
Код:
[13:50:55] [debug] Server crashed while executing nrp.amx
[13:50:55] [debug] AMX backtrace:
[13:50:55] [debug] #0 native mysql_pquery () from mysql.DLL
[13:50:55] [debug] #1 00021348 in public OnCharacterLoaded (playerid=0) at C:\Users\dell\Desktop\Nevada Roleplay\gamemodes\nrp.pwn:1267
[13:50:55] [debug] Native backtrace:
[13:50:55] [debug] #0 5d278120 in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #1 5d297e69 in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #2 5d29f0a1 in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #3 004010b6 in ?? () from samp-server.exe
[13:50:55] [debug] #4 5da3c6fa in ?? () from plugins\crashdetect.DLL
[13:50:55] [debug] #5 5da42278 in ?? () from plugins\crashdetect.DLL
[13:50:55] [debug] #6 5da3a0d7 in ?? () from plugins\crashdetect.DLL
[13:50:55] [debug] #7 5da3c74a in ?? () from plugins\crashdetect.DLL
[13:50:55] [debug] #8 5d524629 in ?? () from plugins\streamer.DLL
[13:50:55] [debug] #9 5d2789c0 in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #10 5d29677d in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #11 5d29910c in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #12 5d27cfb1 in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #13 5d27d1e3 in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #14 5d27eaae in ?? () from plugins\mysql.DLL
[13:50:55] [debug] #15 00469a66 in ?? () from samp-server.exe
[13:50:55] [debug] #16 0048d4db in ?? () from samp-server.exe
[13:50:55] [debug] #17 0049b4a1 in ?? () from samp-server.exe
[13:50:55] [debug] #18 0049b4b1 in ?? () from samp-server.exe
What's wrong here?

EDIT: By the way the query works anywhere except OnCharacterLoaded.
Reply
#2

I suggest you using dini, because it never crashes the server, Its really easy and fast to use
MySQL......
I hate it, I'll never ever use mySQL in my life
NEVER!
Reply
#3

Quote:
Originally Posted by Arbico
Посмотреть сообщение
I suggest you using dini, because it never crashes the server, Its really easy and fast to use
MySQL......
I hate it, I'll never ever use mySQL in my life
NEVER!
That's not the answer I expected lol.
Reply
#4

Try with this code

mysql_tquery(database, query, "OnInventoryLoaded", "d", playerid);
Reply
#5

Quote:
Originally Posted by Arbico
Посмотреть сообщение
I suggest you using dini, because it never crashes the server, Its really easy and fast to use
MySQL......
I hate it, I'll never ever use mySQL in my life
NEVER!
.
LOL DUDE, are you serious? You're just too afraid to learn SQL, I really encourage you to get rid of the dini shell you're hiding under, and go learn something that's not outdated,

On topic: is the OnInventoryLoaded public forwarded?
Reply
#6

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
On topic: is the OnInventoryLoaded public forwarded?
Of course, as I said above the query works everywhere except OnCharacterLoaded. It only crashes when I execute the query under OnCharacterLoaded.
Reply
#7

Bumping this.
Reply
#8

Quote:
Originally Posted by Arbico
Посмотреть сообщение
I suggest you using dini, because it never crashes the server, Its really easy and fast to use
MySQL......
I hate it, I'll never ever use mySQL in my life
NEVER!
Oh, yeah, it's easy. Piss off. And it's not fast. It's the slowest system in existence. In your words:

Dini.....
I hate it, I'll never ever use dini in my life
NEVER!
Reply
#9

Quote:
Originally Posted by Arbico
Посмотреть сообщение
I suggest you using dini, because it never crashes the server, Its really easy and fast to use
MySQL......
I hate it, I'll never ever use mySQL in my life
NEVER!
Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
That's not the answer I expected lol.
Double lol.
Reply
#10

Quote:
Originally Posted by Vince
Посмотреть сообщение
Oh, yeah, it's easy. Piss off. And it's not fast. It's the slowest system in existence. In your words:

Dini.....
I hate it, I'll never ever use dini in my life
NEVER!


Couldn't resist lmao
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)