if (strcmp(cmd, "/stats", true) == 0) { new query[500]; GetPlayerName(playerid,pName,sizeof(pName)); format(query,sizeof(query),"SELECT * FROM `"TABLENAME"` WHERE Username = '%s' LIMIT 1",pName); mysql_query(query); mysql_store_result(); new money[32], skin[32], bank[32], paycheck[32]; new faction[32], rank[32], job[32], number[32], deaths[32]; new level[32], exp[32], donator[32], hourson[32]; mysql_fetch_field_row(money, "Money"); mysql_fetch_field_row(skin, "Skin"); mysql_fetch_field_row(bank, "Bank"); mysql_fetch_field_row(paycheck, "Paycheck"); mysql_fetch_field_row(faction, "Member"); mysql_fetch_field_row(rank, "Rank"); mysql_fetch_field_row(job, "Job"); mysql_fetch_field_row(number, "Number"); mysql_fetch_field_row(deaths, "Deaths"); mysql_fetch_field_row(level, "Level"); mysql_fetch_field_row(exp, "Experience"); mysql_fetch_field_row(donator, "Donate"); mysql_fetch_field_row(hourson, "HoursOn"); new tdonate[32]; if(strval(donator)==0){tdonate = "None";} else if(strval(donator)==1){tdonate = "Bronze";} else if(strval(donator)==2){tdonate = "Silver";} else if(strval(donator)==3){tdonate = "Gold";} new tjob[32]; if(strval(job)==0){tjob = "None";} new trank[32]; if(strval(rank)==0){trank = "None";} new tfaction[32]; if(strval(faction)==0){tfaction = "None";} format(string,sizeof(string),"| Character | Skin: [%d] - Faction: [%s] - Rank: [%s] - Job: [%s] - PhoneNo: [%d] - Deaths: [%d/10] |",strval(skin),tfaction,trank,tjob,strval(number),strval(deaths)); SendClientMessage(playerid,COLOR_WHITE,string); format(string,sizeof(string),"| Money | Cash: [%d] - Bank: [%d] - PayCheck: [%d] |",strval(money),strval(bank),strval(paycheck)); SendClientMessage(playerid,COLOR_WHITE,string); format(string,sizeof(string),"| Level | PlayerLevel: [%d] - Experience: [%d] - DonatorLevel: [%s] - HoursOn: [%d] |",strval(level),strval(exp),tdonate,strval(hourson)); SendClientMessage(playerid,COLOR_WHITE,string); return 1; }
| Character | Skin: [0] - Faction: [] - Rank: [None] - Job: [None] - PhoneNo: [0] - Deaths: [0/10] | | Money | Cash: [0] - Bank: [0] - PayCheck: [0] | | Level | PlayerLevel: [0] - Experience: [0] - DonatorLevel: [None] - HoursOn: [0] |
Originally Posted by _Xerxes_
Are the values in the database 0?
|
Originally Posted by SAWC™
I think this one is gonna help you: http://forum.sa-mp.com/index.php?top...2943#msg802943
|
Originally Posted by Sma_X
I think, you shouldn't use arrays for integer values, and things will become much simple then.
Like money[32], bank[32], etc <- those should be integers or else there's a waste of memory + the need of using strval And also, fetching all fields one by one is a more resource consuming job than fetching all result at once and then split it by a delimiter. |
mysql_fetch_field_row();