SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 05/09/2016, 07:16 PM   #11
vannesenn
Gangsta
 
vannesenn's Avatar
 
Join Date: Feb 2011
Posts: 607
Reputation: 15
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

When I replace cache_get_row_int with cache_get_value_index_int, I get warning that number of parameters doesn't match definition.
Here's my code

Code:
_dan = cache_get_row_int(0, 0) + 1;
becomes

Code:
_dan = cache_get_value_index_int(0, 0) + 1;
I like new plugin, and major changes, but you fucked up little bit with changing functions names.
vannesenn is offline   Reply With Quote
Old 05/09/2016, 07:20 PM   #12
IstuntmanI
High-roller
 
IstuntmanI's Avatar
 
Join Date: Mar 2009
Location: Romania
Posts: 1,801
Reputation: 375
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

Quote:
Originally Posted by vannesenn View Post
When I replace cache_get_row_int with cache_get_value_index_int, I get warning that number of parameters doesn't match definition.
Here's my code

Code:
_dan = cache_get_row_int(0, 0) + 1;
becomes

Code:
_dan = cache_get_value_index_int(0, 0) + 1;
I like new plugin, and major changes, but you fucked up little bit with changing functions names.
Quote:
all cache_get_ functions now return their value through a reference parameter instead of returning it directly
So you have to do it like this:
Code:
cache_get_value_index_int(0, 0, _dan);
_dan += 1;
I think that he made a bad decision for getting a column's value through a reference parameter. I get his idea of making every function return a status value, but still.

One important downside: we have to transform all our lines using SetGVar* or SetPVar* to use a temporary variable, which I don't like to.
__________________


IstuntmanI is offline   Reply With Quote
Old 05/09/2016, 07:24 PM   #13
vannesenn
Gangsta
 
vannesenn's Avatar
 
Join Date: Feb 2011
Posts: 607
Reputation: 15
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

Then author should edit topic. Wiki says one, topic says second. Also, some parts of code explanation are weird.
vannesenn is offline   Reply With Quote
Old 05/09/2016, 08:29 PM   #14
vannesenn
Gangsta
 
vannesenn's Avatar
 
Join Date: Feb 2011
Posts: 607
Reputation: 15
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

Well, why I can't use char array?

Code:
	cache_get_value_index_int(0, 20, _HRP_kVisina{_playerid});
	cache_get_value_index_int(0, 21, _HRP_kOMasa{_playerid});
	cache_get_value_index_int(0, 22, _HRP_kMMasa{_playerid});
	cache_get_value_index_int(0, 23, _HRP_kMSala{_playerid});
Code:
error 035: argument type mismatch (argument 3)
I think I'll roll back on R39. I understand why he changed functions names, but why functions don't return value like before R40?
vannesenn is offline   Reply With Quote
Old 05/09/2016, 10:52 PM   #15
nGen.SoNNy
Gangsta
 
nGen.SoNNy's Avatar
 
Join Date: Sep 2009
Location: Romania
Posts: 928
Reputation: 69
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

The same problem with using gvar and pvar... i don't want to store the result in some temporary var and then into the gvar. I think i will stay on R39 till this R40 will return values.
__________________
If i've helped you, please click
nGen.SoNNy is offline   Reply With Quote
Old 05/09/2016, 10:59 PM   #16
Slawiii
Huge Clucker
 
Slawiii's Avatar
 
Join Date: May 2015
Location: Morocco, Missour
Posts: 278
Reputation: 16
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

Nice Work Man
but i saved MySQL R33+ in my memory
its hard to transfer it but i will try i like it so Good Job man
Thank you .
__________________

[FilterScript] SVIP System (0.01%)
Slawiii is offline   Reply With Quote
Old 05/09/2016, 11:03 PM   #17
Spmn
Gangsta
 
Join Date: Jun 2015
Location: Romania
Posts: 490
Reputation: 131
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

Quote:
Originally Posted by IstuntmanI View Post
So you have to do it like this:
Code:
cache_get_value_index_int(0, 0, _dan);
_dan += 1;
I think that he made a bad decision for getting a column's value through a reference parameter. I get his idea of making every function return a status value, but still.

One important downside: we have to transform all our lines using SetGVar* or SetPVar* to use a temporary variable, which I don't like to.
Well, just add wrapper functions for those affected:

Code:
stock cache_get_row_int(row, field_idx, connectionHandle = 1)
{
    #pragma unused connectionHandle

    new retval = cellmin; // so this wrapper function will return cellmin in case of fail
    cache_get_value_index_int(row, field_idx, retval);
    return retval;
}
// and so on for cache_get_row_float, etc
Spmn is offline   Reply With Quote
Old 06/09/2016, 08:37 AM   #18
maddinat0r
Banned
 
Join Date: Jun 2010
Location: Germany
Posts: 845
Reputation: 482
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

Quote:
Originally Posted by vannesenn View Post
Then author should edit topic. Wiki says one, topic says second. Also, some parts of code explanation are weird.
If you'd actually read the tutorial, you would have seen that directly after changing the names of the cache_get_value functions there's the "cache_get_value return their values through a reference parameter" point. The wiki is also correctly describing the new functions, and even provides small examples along them.

Quote:
Originally Posted by nGen.SoNNy View Post
The same problem with using gvar and pvar... i don't want to store the result in some temporary var and then into the gvar. I think i will stay on R39 till this R40 will return values.
Then you're going to stay on R39 forever. I don't intend to change these functions again in the next update.
maddinat0r is offline   Reply With Quote
Old 06/09/2016, 02:47 PM   #19
DandyCorleone
Banned
 
Join Date: May 2016
Posts: 172
Reputation: 3
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

Good job
DandyCorleone is offline   Reply With Quote
Old 09/09/2016, 12:57 PM   #20
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 315
Reputation: 37
Default Re: Updating BlueG's MySQL plugin R33+ scripts to R40

Integer is wrong;

cache_get_value_name(0, "string", dest);
new value = cache_get_value_name(0, "integer");

New;

new value;
cache_get_value_name_int(0, "integer", value);
Max_Andolini 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
Updating BlueG's mysql causes deleted functions to return problems Partner Scripting Help 0 01/11/2014 10:31 PM
[MySQL] From StickenKid's plugin to BlueG's plugin jessejanssen Scripting Help 2 15/06/2014 02:20 AM
Trouble updating with BlueG's mysql R7 2KY Scripting Help 3 25/12/2013 04:46 AM
BlueG MySQL plugin - Failed (plugins/mysql.so: undefined symbol: _Z13stringvprintfPKcPc) linuxthefish Plugin Development 10 13/07/2013 11:56 AM


All times are GMT. The time now is 06:35 PM.


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