<..> enum Item { <...> priezastis[ 128 ], // variable. <...> } new playerDB[ MAX_PLAYERS ][ Item ];
forward LoadPlayer(playerid); public LoadPlayer(playerid) { new fetch[ 256 ], tmpa; format(query, 256, "SELECT * FROM `"TABLENAME"` WHERE id = '%i'", pInfo[playerid][pId]); mysql_query(query); mysql_store_result(); mysql_retrieve_row(); <...> mysql_fetch_field_row(fetch,"Priezastis"); // Reason sscanf(fetch, "s", tmpa); sscanf(fetch, "s[128]", playerDB[playerid][priezastis]); // variable. <...> mysql_free_result(); }
mysql_fetch_field_row(fetch,"Priezastis"); // Reason format(playerDB[playerid][priezastis], 128, "%s", fetch);
mysql_fetch_field_row(playerDB[playerid][priezastis],"Priezastis");
forward LoadPlayer(playerid); public LoadPlayer(playerid) { new fetch[ 256 ], tmpa; format(query, 256, "SELECT * FROM `"TABLENAME"` WHERE id = '%i'", pInfo[playerid][pId]); mysql_query(query); mysql_store_result(); mysql_retrieve_row(); mysql_fetch_field_row(fetch,"Lygis"); new tmplygis; sscanf(fetch, "i", tmplygis); SetPlayerScore(playerid, tmplygis); mysql_fetch_field_row(fetch,"Wanted"); new tmpwanted; sscanf(fetch, "i", tmpwanted); SetPlayerWantedLevel(playerid, tmpwanted); mysql_fetch_field_row(fetch,"Pinigai"); ResetPlayerMoney(playerid); new tmpmoney; sscanf(fetch, "i", tmpmoney); GivePlayerMoney(playerid, tmpmoney); mysql_fetch_field_row(fetch,"World"); new tmpworld; sscanf(fetch, "i", tmpworld); SetPlayerVirtualWorld(playerid, tmpworld); mysql_fetch_field_row(fetch,"Skin"); new tmpskin; sscanf(fetch, "i", tmpskin); SetPlayerSkin(playerid, tmpskin); mysql_fetch_field_row(fetch,"Admin"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", pInfo[playerid][admin]); mysql_fetch_field_row(fetch,"Bankas"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][bankas]); mysql_fetch_field_row(fetch,"Uniforma"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][uniforma]); mysql_fetch_field_row(fetch,"Uzdarbis"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][uzdarbis]); mysql_fetch_field_row(fetch,"VIPL"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][vipl]); mysql_fetch_field_row(fetch,"Kalejimas"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][klaikas]); mysql_fetch_field_row(fetch,"Exp"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", pInfo[playerid][exp]); mysql_fetch_field_row(fetch,"VIP"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][vip]); mysql_fetch_field_row(fetch,"Telefonas"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][tel]); mysql_fetch_field_row(fetch,"THealth"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][telhealth]); mysql_fetch_field_row(fetch,"Saskaita"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][saskaita]); mysql_fetch_field_row(fetch,"Tinklas"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][tinklas]); mysql_fetch_field_row(fetch,"Papildymas"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][papildymas]); mysql_fetch_field_row(playerDB[playerid][priezastis],"Priezastis"); mysql_fetch_field_row(playerDB[playerid][dpriezastis],"dPriezastis"); mysql_fetch_field_row(fetch,"Spec"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][spec]); mysql_fetch_field_row(fetch,"Ispejimai"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][ispejimai]); mysql_fetch_field_row(fetch,"dIspejimai"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][dispejimai]); mysql_fetch_field_row(fetch,"Direktorius"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][direktorius]); mysql_fetch_field_row(fetch,"Prangas"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][rangas]); mysql_fetch_field_row(fetch,"Uzraktai"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", MaxVehicles[playerid]); mysql_fetch_field_row(fetch,"Ziebtuvelis"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][ziebtuvelis]); mysql_fetch_field_row(fetch,"Cigaretes"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][cigaretes]); mysql_fetch_field_row(fetch,"Namai"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", MaxHouses[playerid]); mysql_fetch_field_row(fetch,"Surakintas"); sscanf(fetch, "i", tmpa); sscanf(fetch, "i", playerDB[playerid][surakintas]); mysql_fetch_field_row(fetch,"Teises"); new tmpteises; sscanf(fetch, "i", tmpteises); sscanf(fetch, "i", playerDB[playerid][teises]); mysql_fetch_field_row(fetch,"MTeises"); new tmpmteises; sscanf(fetch, "i", tmpmteises); sscanf(fetch, "i", playerDB[playerid][mteises]); mysql_fetch_field_row(fetch,"GPS"); new tmpgps; sscanf(fetch, "i", tmpgps); if (tmpgps) playerDB[playerid][gps] = true; mysql_fetch_field_row(fetch,"Bankok"); new tmpbankok; sscanf(fetch, "i", tmpbankok); if (tmpbankok) playerDB[playerid][bankok] = true; mysql_fetch_field_row(fetch,"Uniformed"); new tmpuniformed; sscanf(fetch, "i", tmpuniformed); if (tmpuniformed) playerDB[playerid][uniformed] = true; mysql_fetch_field_row(fetch,"Pakrovejas"); new tmppakrovejas; sscanf(fetch, "i", tmppakrovejas); if (tmppakrovejas) playerDB[playerid][pakrovejas] = true; mysql_fetch_field_row(fetch,"Apakrovejas"); new tmpapakrovejas; sscanf(fetch, "i", tmpapakrovejas); if (tmpapakrovejas) playerDB[playerid][apakrovejas] = true; mysql_fetch_field_row(fetch,"MTeorija"); new tmpmteorija; sscanf(fetch, "i", tmpmteorija); if (tmpmteorija) playerDB[playerid][mteorija] = true; mysql_fetch_field_row(fetch,"MMTeorija"); new tmpmmteorija; sscanf(fetch, "i", tmpmmteorija); if (tmpmmteorija) playerDB[playerid][mmteorija] = true; mysql_free_result(); }
Thanks for you answer. But how can I do it? I didin't know how : / it's really hard to me, it would be easier if I had example. By the way can this script or saving in my case improve ram usage ? because my gamemode uses alot of ram memory and I think its MySQL job. Anyway if u can give me example. Thank you!
|
new tmplygis;
mysql_fetch_field_row(fetch,"Lygis"); tmplygis = strval(fetch);
SetPlayerScore(playerid, tmplygis);