MySQL - Assistance needed :d
#1

Hey, sorry for seeming like a noob, but I've been working on converting BlueG's MYSQL Clothing System to the older version of a_mysql.inc (so I don't have to convert my gamemode of 14k lines just yet.



There is some issues with loading clothes, everything else but loading works so I'm interested in some expertise in this field by someone who knows how to do this stuff. I've been stuck with this problem for three days now, so if anyone here knows a solution, It'd be appreaciateful.

CODE:
PHP код:
stock LoadPlayerClothes(playerid)
{
    
format(querysizeof(query), "SELECT * FROM `clothes` WHERE `holder` = '%s'"GetName(playerid));
    
mysql_query(query);
    
mysql_store_result();
    new
        
1;
    new 
xidxmodelxbonexoffsetxxoffsetyxoffsetzxrotxxrotyxrotzxscalexxscaleyxscalez;
    if(
mysql_num_rows() > 0) {
        while(
mysql_fetch_row_format(query"|")) {
            
mysql_fetch_row(query);
            
sscanf(query"p<|>iiifffffffff"cIDcModelIDcBoneIDcOffsetXcOffsetYcOffsetZcRotXcRotYcRotZcScaleXcScaleYcScaleZ);
            
ClothesInfo[playerid][i][xid] = mysql_fetch_field_row(query"id");
            
ClothesInfo[playerid][i][xmodel] = mysql_fetch_field_row(query"model");
            
ClothesInfo[playerid][i][xbone] = mysql_fetch_field_row(query"bone");
            
ClothesInfo[playerid][i][xoffsetx] = mysql_fetch_field_row(query"offsetx");
            
ClothesInfo[playerid][i][xoffsetx] = mysql_fetch_field_row(query"offsety");
            
ClothesInfo[playerid][i][xoffsetz] = mysql_fetch_field_row(query"offsetz");
            
ClothesInfo[playerid][i][xrotx] = mysql_fetch_field_row(query"rotx");
            
ClothesInfo[playerid][i][xroty] = mysql_fetch_field_row(query"roty");
            
ClothesInfo[playerid][i][xrotz] = mysql_fetch_field_row(query"rotz");
            
ClothesInfo[playerid][i][xscalex] = mysql_fetch_field_row(query"scalex");
            
ClothesInfo[playerid][i][xscaley] = mysql_fetch_field_row(query"scaley");
            
ClothesInfo[playerid][i][xscalez] = mysql_fetch_field_row(query"scalez");
            
ClothesInfo[playerid][i][cOn] = true;
            
i++;
            
clTotal++;
        }
    }
    
mysql_free_result();
    
printf("%i clothing items loaded from the MySQL Database."clTotal);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
LoadPlayerClothes(playerid);
    return 
1;


The database.

Result of code:

[/QUOTE]
Reply
#2

ignore
Reply
#3

ignore
Reply
#4

ignore
Reply
#5

ignore
Reply
#6

Thanks to admin for removing posts from troll user posting image dicks.
Reply
#7

bumping since it's gone on 4th page.
Reply
#8

Instead of:

ClothesInfo[playerid][i][xid] = mysql_fetch_field_row(query, "id");

Try to Use:

ClothesInfo[playerid][i][xid] = cID;


Because you already fetch the row, and after sscanf you use mysql again, while cID already should have the value you want to get.

OR even better try to use as this

pawn Код:
sscanf(query, "p<|>iiifffffffff",
ClothesInfo[playerid][i][xid],ClothesInfo[playerid][i][xmodel],ClothesInfo[playerid][i][xbone],ClothesInfo[playerid][i][xoffsetx],
ClothesInfo[playerid][i][xoffsety],ClothesInfo[playerid][i][xoffsetz],ClothesInfo[playerid][i][xrotx],ClothesInfo[playerid][i][xroty],
ClothesInfo[playerid][i][xrotz], ClothesInfo[playerid][i][xscalex], ClothesInfo[playerid][i][xscaley], ClothesInfo[playerid][i][xscalez]);
also pay attention that in your script you used ClothesInfo[playerid][i][xoffsetx] twice, so check if all other values is assigned properly.
Reply
#9

I've tried that, only made me not load any entries at all.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)