Hay,
Ich habe ein Problem, undzwar wird mein Skin nicht gespeichert.
meine Datenbank hat bereits die Spalte "Skin" in der Tabelle "accounts"
meine Speicherung im Script:
stock SavePlayer(playerid)
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
if(GetPVarInt(playerid,"Eingeloggt") == 1)
{
mysql_SetInt("accounts", "Level", SpielerInfo[playerid][pLevel], "Name", SpielerInfo[playerid][pName]);
mysql_SetInt("accounts", "Geld", SpielerInfo[playerid][pGeld], "Name", SpielerInfo[playerid][pName]);
mysql_SetInt("accounts", "Kills", SpielerInfo[playerid][pKills], "Name", SpielerInfo[playerid][pName]);
mysql_SetInt("accounts", "Tode", SpielerInfo[playerid][pTode], "Name", SpielerInfo[playerid][pName]);
mysql_SetInt("accounts", "Skin", SpielerInfo[playerid][pSkin], "Name", SpielerInfo[playerid][pName]);
mysql_SetFloat("accounts", "Health", SpielerInfo[playerid][pHealth], "Name", SpielerInfo[playerid][pName]);
}
}
return 1;
}
Alles anzeigen
Das Laden im Script:
stock LoadPlayer(playerid)
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
GetPlayerName(playerid, SpielerInfo[playerid][pName], MAX_PLAYER_NAME);
SpielerInfo[playerid][pLevel] = mysql_GetInt("accounts", "Level", "Name", SpielerInfo[playerid][pName]);
SpielerInfo[playerid][pGeld] = mysql_GetInt("accounts", "Geld", "Name", SpielerInfo[playerid][pName]);
SpielerInfo[playerid][pKills] = mysql_GetInt("accounts", "Kills", "Name", SpielerInfo[playerid][pName]);
SpielerInfo[playerid][pTode] = mysql_GetInt("accounts", "Tode", "Name", SpielerInfo[playerid][pName]);
SpielerInfo[playerid][pSkin] = mysql_GetInt("accounts", "Skin", "Name", SpielerInfo[playerid][pName]);
}
return 1;
}
Alles anzeigen
Jetzt hab ich jedoch das Problem, das wenn ich mich ingame registriere, garnichts mehr in der Datenbank gespeichert wird, d.h. auch nicht die Account daten (Name/Passwort)
Sobald ich bei beiden stocks die Sache mit dem Skin rausnehme, funktionierts wieder.
Was hab ich falsch gemacht?
Weitere Stocks:
stock mysql_GetString(Table[], Field[], Where[], Is[])
{
new query[128], Get[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(Get);
mysql_free_result();
return Get;
}
stock mysql_GetInt(Table[], Field[], Where[], Is[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
new sqlint = mysql_fetch_int();
mysql_free_result();
return sqlint;
}
stock mysql_GetFloat(Table[], Field[], Where[], Is[])
{
new query[128], Float:sqlfloat;
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_float(sqlfloat);
mysql_free_result();
return sqlfloat;
}
stock mysql_SetInt(Table[], Field[], To, Where[], Where2[])
{
new query[128];
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[])
{
new query[128];
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);
mysql_real_escape_string(Where3, Where3);
format(query, 128, "UPDATE `%s` SET `%s` = '%s' WHERE `%s` = '%s'", Table, Field, To, Where, Where2, Where3);
mysql_query(query);
return true;
}
stock mysql_SetFloat(Table[], Field[], Float:To, Where[], Where2[])
{
new query[128];
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` = '%f' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
mysql_query(query);
return true;
}
Alles anzeigen