Hey. So, I have a column in my website which is called “Achievements” inside of the “players” table, but they’re bunched together such as this:
1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,1,0,1,
When the value is “1” - it means that the acheivement of the section is unlocked.
For instance:
1,0,0,0,1
The first and fifth item are unlocked and when they’re unlocked, it reads the achievement name from the ID,
So - the first “1” isn’t ID 0, it’s ID 1.
Meaning, it needs to be split from the “,” - but I don’t know how.
Here’s the script version of loading the achievements:
[code]LoadPlayerAchievements(playerid)
{
new achs[MAX_ACHS*2], pos = 0, count = 1;
MySQLFetchString(SQLID[playerid], “Achievements”, achs, “players”);
while(count < MAX_ACHS)
{
new sub[3];
strmid(sub, achs, pos, pos+1);
HasUnlockedAchievement[playerid][count] = strval(sub);
if(HasUnlockedAchievement[playerid][count] == 1)
{
AchievementPoints[playerid] += AchievementData[count][PointValue];
}
pos += 2;
count ++;
}
return 1;
}
SavePlayerAchievements(playerid)
{
new achs[MAX_ACHS*2];
for(new i = 1; i < MAX_ACHS; i++)
{
if(HasUnlockedAchievement[playerid][i] == 1)
{
strcat(achs, "1,");
}else{
strcat(achs, "0,");
}
}
MySQLUpdateString(SQLID[playerid], "Achievements", achs, "players");
return 1;
}[/code]
If anybody can help me that would be amazing. (I want to display the achievement name from the SQL table “Achievements” where I grab the ID and state from the “Achievements” inside of the “players” table.