So,
ich weis, ich hasse mysql inzwischen auch:D, aber, wenn wir bei einem 100 Mann Server
/saveaccounts eingeben, um alle Accountdaten zu speichern gibt es einen rießenlaqq, hier mein Aufbau:
stock SaveAllAccounts(playerid)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
if(mysqluser[playerid] == 1)
{
mysql_SetInt("accounts", "Level", PlayerInfo[playerid][pLevel], "Name", PlayerInfo[playerid][pIngameName]);
mysql_SetFloat("accounts", "pSHealth", PlayerInfo[playerid][pSHealth], "Name", PlayerInfo[playerid][pIngameName]);
mysql_SetString("accounts", "MarriedTo", PlayerInfo[playerid][pMarriedTo], "Name", PlayerInfo[playerid][pIngameName]);
}
}
}
return 1;
}
funktionen:
stock mysql_SetInt(Table[], Field[], To, Where[], Where2[])
{
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE %s SET %s = '%d' WHERE %s = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
stock mysql_SetString(Table[], Field[], To[], Where[], Where2[])
{
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(To, To);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE %s SET %s = '%s' WHERE %s = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
stock mysql_SetFloat(Table[], Field[], Float:To, Where[], Where2[])
{
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Where2, Where2);
format(query, 128, "UPDATE %s SET %s = '%.1f' WHERE %s = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
Wäre sehr nett, wenn ihr mir weiterhelfen könntet.
MfG. Cody09