Biz Name aus der MYSQL DatenBank Auslessen:
enum BizInfomation
{
Bizname[128],
BizOwner[128],
BizCoOwner[128],
BizPreis,
Float:PosX,
Float:PosY,
Float:PosZ,
Float:PosA,
BizOwned,
}
new BizInfo[MAX_BIZ][BizInfomation];
OnGameModInit
for(new i = 0;i<MAX_BIZ;i++)
{
if(BizInfo[i][BizOwned] == 0)
{
new bizkaufen[350];
AddStaticPickup(1273, 1, BizInfo[i][PosX], BizInfo[i][PosY], BizInfo[i][PosZ]);
format(bizkaufen,sizeof(bizkaufen),"Name: %s\nBesitzer: Die Staat\nPreis:%d",BizInfo[i][Bizname],BizInfo[i][BizPreis]);
Create3DTextLabel(bizkaufen,ROT,BizInfo[i][PosX],BizInfo[i][PosY],BizInfo[i][PosZ],40.0,0);
}
if(BizInfo[i][BizOwned] == 1)
{
new bizgekauft[350];
AddStaticPickup(1239, 1, BizInfo[i][PosX], BizInfo[i][PosY], BizInfo[i][PosZ]);
format(bizgekauft,sizeof(bizgekauft),"Name: %s\nBesitzer: %s\nMitbesitzer: %s",BizInfo[i][Bizname],BizInfo[i][BizOwner],BizInfo[i][BizCoOwner]);
Create3DTextLabel(bizgekauft,ROT,BizInfo[i][PosX],BizInfo[i][PosY],BizInfo[i][PosZ],40.0,0);
}
}
stock LoadBizData()
{
for(new i=0;i<MAX_BIZ;i++)
{
new query[128],data[128],bedienung[40];
format(bedienung,sizeof(bedienung),"id='%i'",i);
format(query,sizeof(query),"SELECT * FROM bizdata WHERE %s", bedienung);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
mysql_fetch_field("BizName",data); BizInfo[i][Bizname] = strval(data); format(data,sizeof(data),"%s",BizInfo[i][Bizname]);
mysql_fetch_field("BizOwner",data); BizInfo[i][BizOwner] = strval(data); format(data,sizeof(data),"%s",BizInfo[i][BizOwner]);
mysql_fetch_field("BizCoOwner",data); BizInfo[i][BizCoOwner] = strval(data); format(data,sizeof(data),"%s",BizInfo[i][BizCoOwner]);
mysql_fetch_field("BizPreis",data); BizInfo[i][BizPreis] =strval(data); strdel(data,0,100);
mysql_fetch_field("BizX",data); BizInfo[i][PosX] =strval(data); strdel(data,0,100);
mysql_fetch_field("BizY",data); BizInfo[i][PosY] =strval(data); strdel(data,0,100);
mysql_fetch_field("BizZ",data); BizInfo[i][PosZ] =strval(data); strdel(data,0,100);
mysql_fetch_field("BizOwned",data); BizInfo[i][BizOwned] =strval(data); strdel(data,0,100);
}
mysql_free_result();
}
return 1;
}
Was ist falsch ???
MFG
Ingo
//edit: hab ich da was vergessen oder nicht blick da nicht so durch -.- ?