Код HTML:
function LoadPlayerFurniture(playerid)
{
new rows, fields,name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
cache_get_data(rows,fields);
if(!rows)
{
mysql_format(handle,gQuery, sizeof(gQuery),"INSERT INTO `furniture` (`Name`,`slot1`,`slot2`,`slot3`,`slot4`,`slot5`,`slot6`,`slot7`,`slot8`,`slot9`,`slot10`,`slot11`,`slot12`,`slot13`,`slot14`,`slot15`,`slot16` ,`slot17`,`slot18`,`slot19`,`slot20`,`slot21`,`slot22`,`slot23`,`slot24`,`slot25`,`slot26` ,`slot27`,`slot28`,`slot29`,`slot30`) VALUES ('%e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)", name);
mysql_tquery(handle,gQuery,"");
}
else if(rows)
{
new temp[24],countused;
cache_get_row(0,0,temp); FurnitureInfo[playerid][fid] = strval(temp);
cache_get_row(0,1,temp); format(FurnitureInfo[playerid][FurnName],MAX_PLAYER_NAME,"%s",name);
cache_get_row(0,2,temp); FurnitureInfo[playerid][Slot][0] = strval(temp);
cache_get_row(0,3,temp); FurnitureInfo[playerid][Slot][1] = strval(temp);
cache_get_row(0,4,temp); FurnitureInfo[playerid][Slot][2] = strval(temp);
cache_get_row(0,5,temp); FurnitureInfo[playerid][Slot][3] = strval(temp);
cache_get_row(0,6,temp); FurnitureInfo[playerid][Slot][4] = strval(temp);
cache_get_row(0,7,temp); FurnitureInfo[playerid][Slot][5] = strval(temp);
cache_get_row(0,8,temp); FurnitureInfo[playerid][Slot][6] = strval(temp);
cache_get_row(0,9,temp); FurnitureInfo[playerid][Slot][7] = strval(temp);
cache_get_row(0,10,temp); FurnitureInfo[playerid][Slot][8] = strval(temp);
cache_get_row(0,11,temp); FurnitureInfo[playerid][Slot][9] = strval(temp);
cache_get_row(0,12,temp); FurnitureInfo[playerid][Slot][10] = strval(temp);
cache_get_row(0,13,temp); FurnitureInfo[playerid][Slot][11] = strval(temp);
cache_get_row(0,14,temp); FurnitureInfo[playerid][Slot][12] = strval(temp);
cache_get_row(0,15,temp); FurnitureInfo[playerid][Slot][13] = strval(temp);
cache_get_row(0,16,temp); FurnitureInfo[playerid][Slot][14] = strval(temp);
cache_get_row(0,17,temp); FurnitureInfo[playerid][Slot][15] = strval(temp);
cache_get_row(0,18,temp); FurnitureInfo[playerid][Slot][16] = strval(temp);
cache_get_row(0,19,temp); FurnitureInfo[playerid][Slot][17] = strval(temp);
cache_get_row(0,20,temp); FurnitureInfo[playerid][Slot][18] = strval(temp);
cache_get_row(0,21,temp); FurnitureInfo[playerid][Slot][19] = strval(temp);
cache_get_row(0,22,temp); FurnitureInfo[playerid][Slot][20] = strval(temp);
cache_get_row(0,23,temp); FurnitureInfo[playerid][Slot][21] = strval(temp);
cache_get_row(0,24,temp); FurnitureInfo[playerid][Slot][22] = strval(temp);
cache_get_row(0,25,temp); FurnitureInfo[playerid][Slot][23] = strval(temp);
cache_get_row(0,26,temp); FurnitureInfo[playerid][Slot][24] = strval(temp);
cache_get_row(0,27,temp); FurnitureInfo[playerid][Slot][25] = strval(temp);
cache_get_row(0,28,temp); FurnitureInfo[playerid][Slot][26] = strval(temp);
cache_get_row(0,29,temp); FurnitureInfo[playerid][Slot][27] = strval(temp);
cache_get_row(0,30,temp); FurnitureInfo[playerid][Slot][28] = strval(temp);
cache_get_row(0,31,temp); FurnitureInfo[playerid][Slot][29] = strval(temp);
for(new i = 0; i < 10; i++)
{
if(FurnitureInfo[playerid][Slot][i] != 0) countused++;
}
}
return 1;
}
pawn Код:
function LoadPlayerFurniture(playerid)
{
new
name[MAX_PLAYER_NAME]
;
GetPlayerName(playerid, name, sizeof(name));
if(!cache_get_row_count(MySQL))
{
mysql_format(handle, gQuery, sizeof(gQuery), "INSERT INTO `furniture` (`Name`,`slot1`,`slot2`,`slot3`,`slot4`,`slot5`,`slot6`,`slot7`,`slot8`,`slot9`,`slot10`,`slot11`,`slot12`,`slot13`,`slot14`,`slot15`,`slot16` ,`slot17`,`slot18`,`slot19`,`slot20`,`slot21`,`slot22`,`slot23`,`slot24`,`slot25`,`slot26` ,`slot27`,`slot28`,`slot29`,`slot30`) VALUES ('%e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)", name);
mysql_tquery(handle, gQuery, "");
}
else
{
new
countused
;
cache_get_row_int(0, 0, FurnitureInfo[playerid][fid]);
strcat(FurnitureInfo[playerid][FurnName], name, MAX_PLAYER_NAME);
for(new i = 2; i < 32; i++)
{
cache_get_row_int(0, i, FurnitureInfo[playerid][Slot][i - 2];
}
for(new i = 0; i < 10; i++)
{
if(FurnitureInfo[playerid][Slot][i] != 0)
{
countused++;
}
}
}
return 1;
}