SA-MP Forums Archive
Mysql R38 to R35 Please Help [+REP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql R38 to R35 Please Help [+REP] (/showthread.php?tid=562041)



Mysql R38 to R35 Please Help [+REP] - HydraHumza - 06.02.2015

PHP код:
stock CheckAchievements(playerid)
{
    new 
rowsfields;
    new 
Query;
    
cache_get_data(rowsfieldsMySQL);
    if(
rows)
    {
        
cache_get_field_content(0"Username"AInfo[playerid][Username], MySQL24);
        
AInfo[playerid][Ach1] = cache_get_field_content_int(0"Ach1"MySQL);
        
AInfo[playerid][Ach2] = cache_get_field_content_int(0"Ach2"MySQL);
        
AInfo[playerid][Ach3] = cache_get_field_content_int(0"Ach3"MySQL);
        
AInfo[playerid][AchsCompleted] = cache_get_field_content_int(0"AchsCompleted"MySQL);
    }
    else
    {
        
mysql_format(MySQLQuery256"INSERT INTO `"Achievements_"` (Username, Ach1, Ach2, Ach3, AchsCompleted) VALUES ('%s', '0', '0', '0', '0')"GetPName(playerid));
        
mysql_query(Query);
    }
    return 
1;

Getting Error of undefined symbol cache_get_field_content_int
due to i have r35 and its r38 so can anyone convert this r35

+rep who help me


Re: Mysql R38 to R35 Please Help [+REP] - HazardouS - 06.02.2015

Actually cache_get_field_content_int is defined in R35.


Re: Mysql R38 to R35 Please Help [+REP] - HydraHumza - 06.02.2015

its not it r37 and r38


Re: Mysql R38 to R35 Please Help [+REP] - HazardouS - 06.02.2015

I could give you the commits from github.com regarding this plugin, to prove I'm right, but this is not the point here (not to mention that I've used that function in R34 successfully).
Let's talk about your script. Here are my suggestions:
1. Make CheckAchievements a public function instead of stock.
pawn Код:
forward CheckAchievements(playerid);
public CheckAchievements(playerid)
{
    new rows, fields;
    new Query;
    cache_get_data(rows, fields, MySQL);
    if(rows)
    {
        cache_get_field_content(0, "Username", AInfo[playerid][Username], MySQL, 24);
        AInfo[playerid][Ach1] = cache_get_field_content_int(0, "Ach1", MySQL);
        AInfo[playerid][Ach2] = cache_get_field_content_int(0, "Ach2", MySQL);
        AInfo[playerid][Ach3] = cache_get_field_content_int(0, "Ach3", MySQL);
        AInfo[playerid][AchsCompleted] = cache_get_field_content_int(0, "AchsCompleted", MySQL);
    }
    else
    {
        mysql_format(MySQL, Query, 256, "INSERT INTO `"Achievements_"` (Username, Ach1, Ach2, Ach3, AchsCompleted) VALUES ('%s', '0', '0', '0', '0')", GetPName(playerid));
        mysql_query(Query);
    }
    return 1;
}
2. Use mysql_tquery to send a threaded query and get the result in CheckAchievements function.
pawn Код:
mysql_tquery(MySQL, <some query>, "CheckAchievements", "d", playerid);
Replace <some query> with your achievements loading query (should be a SELECT query).

Try these things. Also, Achievements_ is a #define, right? I guess it won't work otherwise.


Re: Mysql R38 to R35 Please Help [+REP] - HydraHumza - 07.02.2015

not working anyone other can please?