Huhuu,
nach langer Zeit habe ich meinen alten Script wieder herangeschafft.
MySQL-Datenbank usw, alles ist verbunden.
Leider, werden mal wieder keine Häuser / Biz erstellt.
Hier der Code:
stock CreateHouse(Float:X,Float:Y,Float:Z,Level,Price,Rooms,Interior)
{
mysql_query("SELECT * FROM `haeuser`");
mysql_store_result();
new rows = mysql_num_rows();
mysql_free_result();
if(rows > MAX_HAEUSER) return 0;
new query[2000];
format(query,sizeof(query),"INSERT INTO `haeuser` (`ID`, `PosX`, `PosY`,\
`PosZ`, `Level`, `Preis`, `Besitzer`, `Bought`, `Rooms`,`InteriorID`,`Interior`,`IntX`,`IntY`,`IntZ`,`Rentable`,\
`RentPrice`, `Renter1`, `Renter2`, `Renter3`, `Renter4`, `Renter5`");
format(query,sizeof(query),"%s,`Renter6`, `Kasse`, `VirtualWorld`)VALUES('%d', '%f', '%f', '%f', '%d', '%d', 'Niemand','0', '%d',\
'%d', '%d', '%f', '%f', '%f', '1', '100', 'Niemand', 'Niemand', 'Niemand', 'Niemand', 'Niemand', 'Niemand', '0', '0')"\
,query,rows,X,Y,Z,Level,Price,Rooms,Interior,IntID[Interior][0],InteriorList[Interior][0], InteriorList[Interior][1], InteriorList[Interior][2]);
mysql_query(query);
LoadHouse(rows);
return 1;
}
stock LoadHouse(HouseID)
{
new str[128];
format(str,sizeof(str),"%d",HouseID);
HausInfo[HouseID][hPosX] = GetMySQLfloat("haeuser", "PosX", "ID", str);
HausInfo[HouseID][hPosY] = GetMySQLfloat("haeuser", "PosY", "ID", str);
HausInfo[HouseID][hPosZ] = GetMySQLfloat("haeuser", "PosZ", "ID", str);
HausInfo[HouseID][hLevel] = GetMySQLint("haeuser", "Level", "ID", str);
HausInfo[HouseID][hPreis] = GetMySQLint("haeuser", "Preis", "ID", str);
format(HausInfo[HouseID][hBesitzer],24,"%s",GetMySQLstring("haeuser", "Besitzer", "ID", str));
HausInfo[HouseID][hBought] = GetMySQLint("haeuser", "Bought", "ID", str);
HausInfo[HouseID][hRooms] = GetMySQLint("haeuser", "Rooms", "ID", str);
HausInfo[HouseID][hInteriorID] = GetMySQLint("haeuser", "InteriorID", "ID", str);
HausInfo[HouseID][hInterior] = GetMySQLint("haeuser", "Interior", "ID", str);
HausInfo[HouseID][hIntX] = GetMySQLfloat("haeuser", "IntX", "ID", str);
HausInfo[HouseID][hIntY] = GetMySQLfloat("haeuser", "IntY", "ID", str);
HausInfo[HouseID][hIntZ] = GetMySQLfloat("haeuser", "IntZ", "ID", str);
HausInfo[HouseID][hLocked] = GetMySQLint("haeuser", "Locked", "ID", str);
HausInfo[HouseID][hRentable] = GetMySQLint("haeuser", "Rentable", "ID", str);
HausInfo[HouseID][hRentPrice] = GetMySQLint("haeuser", "RentPrice", "ID", str);
format(HausInfo[HouseID][hRenter1],24,"%s",GetMySQLstring("haeuser", "Renter1", "ID", str));
format(HausInfo[HouseID][hRenter2],24,"%s",GetMySQLstring("haeuser", "Renter2", "ID", str));
format(HausInfo[HouseID][hRenter3],24,"%s",GetMySQLstring("haeuser", "Renter3", "ID", str));
format(HausInfo[HouseID][hRenter4],24,"%s",GetMySQLstring("haeuser", "Renter4", "ID", str));
format(HausInfo[HouseID][hRenter5],24,"%s",GetMySQLstring("haeuser", "Renter5", "ID", str));
format(HausInfo[HouseID][hRenter6],24,"%s",GetMySQLstring("haeuser", "Renter6", "ID", str));
HausInfo[HouseID][hKasse] = GetMySQLint("haeuser", "Kasse", "ID", str);
HausInfo[HouseID][hVW] = HouseID+1;
HausInfo[HouseID][hPickup] = CreatePickup(1239,1,HausInfo[HouseID][hPosX],HausInfo[HouseID][hPosY],HausInfo[HouseID][hPosZ]);
HausInfo[HouseID][hOutPickup] = CreatePickup(1318,1,HausInfo[HouseID][hIntX],HausInfo[HouseID][hIntY],HausInfo[HouseID][hIntZ],HausInfo[HouseID][hVW]);
if(HausInfo[HouseID][hBought] == 0)
{
format(str,sizeof(str),"Dieses Haus ist zu verkaufen!\nPreis: %d€\nLevel: %d\nHaus kaufen: /buyhouse",HausInfo[HouseID][hPreis],HausInfo[HouseID][hLevel]);
}
else
{
if(HausInfo[HouseID][hRentable] == 1)
{
format(str,sizeof(str),"Besitzer: %s\nMietpreis: %d€\nZimmer mieten - /rentroom",HausInfo[HouseID][hBesitzer],HausInfo[HouseID][hRentPrice]);
}
else if(HausInfo[HouseID][hRentable] == 0)
{
format(str,sizeof(str),"Besitzer: %s",HausInfo[HouseID][hBesitzer]);
}
}
HausInfo[HouseID][hLabel]=Create3DTextLabel(str,COLOR_RED,HausInfo[HouseID][hPosX],HausInfo[HouseID][hPosY],HausInfo[HouseID][hPosZ],7,0);
HausInfo[HouseID][hOutLabel]=Create3DTextLabel("Austreten:\nEnter drücken",COLOR_RED,HausInfo[HouseID][hIntX],HausInfo[HouseID][hIntY],HausInfo[HouseID][hIntZ],5,HausInfo[HouseID][hVW]);
return 1;
}
In die DB wird nix eingetragen.....
Was da wieder los? -.-
lg
/e LoadHouse reingehaun