GetSpielerPasswort(playerid)
{
format(CacheString, sizeof(CacheString), "SELECT Passwort FROM gf_players WHERE SpielerName = '%s';",GetName(playerid));
mysql_query(CacheString);
mysql_store_result();
mysql_retrieve_row();
mysql_fetch_field_row(PlayerInfo[playerid][pKey],"Passwort");
mysql_free_result();
}
SavePlayerSQLInt(playerid,field[],setint)
{
format(CacheString,sizeof(CacheString),"UPDATE gf_players SET %s = '%i' WHERE SpielerName = '%s';",field,setint,GetName(playerid));
mysql_query(CacheString);
return true;
}
SavePlayerSQLFloat(playerid,field[],Float:setfloat)
{
format(CacheString,sizeof(CacheString),"UPDATE gf_players SET %s = '%f' WHERE SpielerName = '%s';",field,setfloat,GetName(playerid));
mysql_query(CacheString);
return true;
}
SavePlayerSQLString(playerid,field[],setstring[])
{
format(CacheString,sizeof(CacheString),"UPDATE gf_players SET %s = '%s' WHERE SpielerName = '%s';",field,setstring,GetName(playerid));
mysql_query(CacheString);
return true;
}
ReadPlayerSQLInt(playerid,field[])
{
format(CacheString,sizeof(CacheString),"SELECT %s FROM gf_players WHERE SpielerName = '%s';",field,GetName(playerid));
mysql_query(CacheString);
mysql_store_result();
new mysqlint=mysql_fetch_int();
mysql_free_result();
return mysqlint;
}
Float:ReadPlayerSQLFloat(playerid,field[])
{
format(CacheString,sizeof(CacheString),"SELECT %s FROM gf_players WHERE SpielerName = '%s';",field,GetName(playerid));
mysql_query(CacheString);
mysql_store_result();
new Float:mysqlfloat;
mysql_fetch_float(mysqlfloat);
mysql_free_result();
return mysqlfloat;
}
ReadPlayerSQLString(playerid,field[],buffer[])
{
format(CacheString,sizeof(CacheString),"SELECT %s FROM gf_players WHERE SpielerName = '%s';",field,GetName(playerid));
mysql_query(CacheString);
mysql_store_result();
mysql_retrieve_row();
mysql_fetch_field_row(buffer,field);
mysql_free_result();
return true;
}
LadeInventar(playerid)
{
new cnr[8];
format(CacheString, 256, "spielerdaten/%s.inv", GetName(playerid));
if(INI_Open(CacheString))
{
for(new id = 0; id < MAX_PRODUCTS; id++)
{
Inventar[playerid][id][ivpSlot] = -1; Inventar[playerid][id][ivpMenge] = -1; Inventar[playerid][id][ivpAblauf] = -1;
Itter_Remove(PInventar[playerid], id);
valstr(cnr, id);
INI_ReadString(CacheString, cnr);
sscanf(CacheString, "p<;>iiiis[128]f",
Inventar[playerid][id][ivpSlot],
Inventar[playerid][id][ivpMenge],
Inventar[playerid][id][ivpAblauf],
Inventar[playerid][id][ivpNumber],
Inventar[playerid][id][ivpString],
Inventar[playerid][id][ivpFloat]);
if(Inventar[playerid][id][ivpSlot] != -1) Itter_Add(PInventar[playerid], id);
}
INI_Close();
}
return true;
}
SpeichereInventar(playerid)
{
new cnr[8];
format(CacheString, 256, "spielerdaten/%s.inv", GetName(playerid));
if(INI_Open(CacheString))
{
foreach(PInventar[playerid], id)
{
valstr(cnr, id);
format(CacheString, 256, "%i;%i;%i;%i;%s;%f",
Inventar[playerid][id][ivpSlot],
Inventar[playerid][id][ivpMenge],
Inventar[playerid][id][ivpAblauf],
Inventar[playerid][id][ivpNumber],
Inventar[playerid][id][ivpString],
Inventar[playerid][id][ivpFloat]);
INI_WriteString(cnr, CacheString);
}
INI_Save();
//INI_Close();
}
return true;
} //edit noch was zugefügt