Raised This Month: $ Target: $400
 0% 

SQL_TQuery help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 03-17-2015 , 13:40   SQL_TQuery help
Reply With Quote #1

Hey, I've never made a plugin that uses SQL before and thus I'm experiencing what I assume is a few minor problems here and there. Most of it I've been able to work out myself but this I'm a bit confused on.

In the SQL_TQuery function it has an any:data parameter that allows extra data to be passed to the callback. I wanted to know if it was possible to pass more than 1 piece of extra data. Reason being I need to pass the client index as well as an argument from a user command but can only pass one..

Any help appreciated
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 03-17-2015 , 13:46   Re: SQL_TQuery help
Reply With Quote #2

You want to use a datapack for this. Here's is an example for timers, but the idea is the same. Just be sure to close its handle in the callback when you're done with it.
Another thing, please don't pass client indexes to asynchronous functions, use a client serial and convert it back to an index in the callback.
__________________

Last edited by Impact123; 03-17-2015 at 13:57.
Impact123 is offline
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 03-17-2015 , 16:02   Re: SQL_TQuery help
Reply With Quote #3

if second argument is just an int, you can pass them both as one interger. Considering each of them fit in int16

Last edited by xf117; 03-17-2015 at 16:02.
xf117 is offline
Send a message via ICQ to xf117
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 03-18-2015 , 04:59   Re: SQL_TQuery help
Reply With Quote #4

Quote:
Originally Posted by Impact123 View Post
You want to use a datapack for this. Here's is an example for timers, but the idea is the same. Just be sure to close its handle in the callback when you're done with it.
Another thing, please don't pass client indexes to asynchronous functions, use a client serial and convert it back to an index in the callback.
Thanks for the help, especially the links as they were extremely helpful. I've now used a datapack to achieve what I want and it works exactly as expected

Also I changed it so instead of passing the client index I pass the client serial. Can I ask why this is so important with asynchronous functions?
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
seekenz
Member
Join Date: Mar 2015
Location: Poland
Old 03-18-2015 , 06:39   Re: SQL_TQuery help
Reply With Quote #5

Because during executing asynchronous function player can quit the game. And in his place another player can enter.
So after executing asynchronous function index can point on another player.
seekenz is offline
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 03-18-2015 , 17:07   Re: SQL_TQuery help
Reply With Quote #6

Quote:
Originally Posted by seekenz View Post
Because during executing asynchronous function player can quit the game. And in his place another player can enter.
So after executing asynchronous function index can point on another player.
Ahhh very true, I didn't think about that. Thanks for explaining
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:32.


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