25.03.2009, 00:29
So i have this enum for an array here:
Im making an sql gamemode and so i have a command saying
But what i wanna know is how do i get the name of the actual array i guess ud call it in the enum. Like how do i extract score from the enum pInfo and write it out? when i say that i mean actually write out score, not the variable stored in it. Please help.
pawn Код:
enum pInfo
{
username,
password,
email,
datejoined,
id,
loggedin,
score,
money,
bankstate,
adminlevel,
regular,
armyaccess,
madexaccess,
robrank,
ownedvehicle
};
pawn Код:
public SavePlayerVariables(playerid)
{
Players[playerid][money] = GetPlayerMoney(playerid);
Players[playerid][score] = GetPlayerScore(playerid);
new update[256],field[256],point,req[256],name[28];
GetPlayerName(playerid,name,28);
point = 18;
format(update,sizeof(update),"UPDATE `users` SET score='%d', money='%d' WHERE username='%s' LIMIT 1",Players[playerid][score],Players[playerid][money],name);
for(new i = 0; pInfo:i < pInfo; i++)
{
format(field,sizeof(field),"%s='%d', ",pInfo:i,Players[playerid][pInfo:i]);
strins(update,field,point);
point += sizeof(field);
}
format(req,sizeof(req),"WHERE username='%s' LIMIT 1",name);
strins(update,req,point);*/
samp_mysql_query(update);
printf("MySQL Query Executed: %s",update);
return 1;
}