SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/01/2020, 12:42 AM   #1
ItzPacman
Little Clucker
 
Join Date: Oct 2016
Posts: 3
Reputation: 0
Default What it means this code

Hello, I don't know if this is here but me equal ask, my question is what it mean this code, been many days but don't understand this code:mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid); What do those two "ii" mean and that 0? In case someone gives me the answer, could you give me the sources of where that code is? thanks
ItzPacman is offline   Reply With Quote
Old 06/01/2020, 07:25 AM   #2
YouShootIDodge
Big Clucker
 
Join Date: May 2019
Posts: 61
Reputation: 14
Default Re: What it means this code

Code:
mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid);mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid);
I presume this is an old version of the function mysql_query, you're using an old version of mysql, probably older than R40.

This function sends a query to the mysql server often to make changes in the database or retrieve some selective data.

Connection - this is the mysql connection hook.
query - The formatted string representing a query is probably stored in this, it will be received by the 'Connection' database server an executed (Remember, a mysql/sql query is a statement written in SQL Language hence it has a proper syntax, read about SQL for more understanding)

"OnQueryFinish" is a public function that will be executed when the query is executed and the results are received (if any).

"ii" - The data types of parameters of the function "OnQueryFinish" are enclosed in the quotation marks without spaces and for that, format specifiers are used without the '%' symbol. In this case the two parameters are integers so 'i' is used for each without space between then.

Then the following 0, and playerid are the values to be sent as the values of those 2 parameters.
YouShootIDodge is offline   Reply With Quote
Old 06/01/2020, 07:40 AM   #3
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: What it means this code

As YouShootIDodge said, you pass the datatype of the callback parameters.

0 is the `resultid`
playerid is the `extraid`

More specifiers:
SpecifierMeaning
d/iinteger number
sstring
ffloating point number

`SetTimerEx` uses the same method to pass arguments in timer callback.
__________________
Calisthenics is offline   Reply With Quote
Old 06/01/2020, 09:20 PM   #4
ItzPacman
Little Clucker
 
Join Date: Oct 2016
Posts: 3
Reputation: 0
Default Re: What it means this code

Quote:
Originally Posted by YouShootIDodge View Post
Code:
mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid);mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid);
I presume this is an old version of the function mysql_query, you're using an old version of mysql, probably older than R40.

This function sends a query to the mysql server often to make changes in the database or retrieve some selective data.

Connection - this is the mysql connection hook.
query - The formatted string representing a query is probably stored in this, it will be received by the 'Connection' database server an executed (Remember, a mysql/sql query is a statement written in SQL Language hence it has a proper syntax, read about SQL for more understanding)

"OnQueryFinish" is a public function that will be executed when the query is executed and the results are received (if any).

"ii" - The data types of parameters of the function "OnQueryFinish" are enclosed in the quotation marks without spaces and for that, format specifiers are used without the '%' symbol. In this case the two parameters are integers so 'i' is used for each without space between then.

Then the following 0, and playerid are the values to be sent as the values of those 2 parameters.
Quote:
Originally Posted by Calisthenics View Post
As YouShootIDodge said, you pass the datatype of the callback parameters.

0 is the `resultid`
playerid is the `extraid`

More specifiers:
SpecifierMeaning
d/iinteger number
sstring
ffloating point number

`SetTimerEx` uses the same method to pass arguments in timer callback.

Wow, thanks!! I had days browsing what it is. Thanksss
ItzPacman is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
What means this error code? SiNuS Scripting Help 6 21/02/2017 03:29 PM
What this means? LoLeRo Everything and Nothing 23 26/05/2013 09:21 AM
What means with this?? Zloobe Server Support 1 01/04/2013 11:14 PM
[Tool/Web/Other] Code Highlighter - Highlight code to find brackets, organize code, ... Sinner Tools and Files 8 09/03/2012 01:28 PM


All times are GMT. The time now is 03:35 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.