könnt ihr mir bitte helfen, bin hier am verzweifeln das mein haussystem nicht geht.
hier ist es :
new inHaus[MAX_PLAYERS] = -1;
new hatHaus[MAX_PLAYERS] = 0;
#define MAX_HAUS 100
enum haus_info
{
Float:hx,
Float:hy,
Float:hz,
Float:ix,
Float:iy,
Float:iz,
interior,
virtual_world,
hOwner[50],
hPreis,
Owned,
hClosed,
pickid,
}
new HausInfo[MAX_HAUS][haus_info];
enum haus_typ
{
interior,
Float:haus_x,
Float:haus_y,
Float:haus_z
}
new Typen[][haus_typ] = { // Wenn nötig neue Haus Typen bzw. vorgegebene Räume hinzufügen...
{3,235.508994,1189.169897,1080.339966},
{2,225.756989,1240.000000,1082.149902},
{1,223.043991,1289.259888,1082.199951},
{7,225.630997,1022.479980,1084.069946},
{15,295.138977,1474.469971,1080.519897},
{15,328.493988,1480.589966,1084.449951},
{15,385.803986,1471.769897,1080.209961},
{1,244.411987,305.032989,999.148437},
{2,271.884979,306.631988,999.148437},
{3,291.282989,310.031982,999.148437},
{4,302.180999,300.722991,999.148437},
{3,1527.229980,-11.574499,1002.097106},
{3,513.882507,-11.269994,1001.565307},
{2,2454.717041,-1700.871582,1013.515197}
};
//OnGameModeInit()
for(new haus=1;haus<MAX_HAUS;haus++)
{
LoadHaus(haus);
}
//OnGameModeExit()
for(new haus=1;haus<MAX_HAUS;haus++)
{
KillHaus(haus);
SaveHaus(haus);
}
//OnPlayerPickUpPickup(playerid, pickupid)
for(new i=1;i<MAX_HAUS;i++)
{
if(IsPlayerInRangeOfPoint(playerid,5,HausInfo[i][hx],HausInfo[i][hy],HausInfo[i][hz]))
{
if(HausInfo[i][pickid] == pickupid)
{
new s[100];
new st[100];
if(HausInfo[i][Owned] == 0)
{
format(s,100,"Besitzer: %s, Preis: %d$",HausInfo[i][hOwner],HausInfo[i][hPreis]);
SendClientMessage(playerid,0x00FF00,s);
}
if(HausInfo[i][Owned] == 1)
{
format(st,100,"Besitzer: %s",HausInfo[i][hOwner]);
SendClientMessage(playerid,0x00FF00,st);
}
}
}
}
stock LoadHaus(hausid)
{
new line[256],File:hausx = fopen("HAUS_DATEI",io_read);
if(hausx)
{
while(fread(hausx,line))
{
HausInfo[hausid][hx] = dini_Float(Datei2,"hx");
HausInfo[hausid][hy] = dini_Float(Datei2,"hy");
HausInfo[hausid][hz] = dini_Float(Datei2,"hz");
HausInfo[hausid][ix] = dini_Float(Datei2,"ix");
HausInfo[hausid][iy] = dini_Float(Datei2,"iy");
HausInfo[hausid][iz] = dini_Float(Datei2,"iz");
HausInfo[hausid][hPreis] = dini_Int(Datei2,"preis");
format(HausInfo[hausid][hOwner],32,"%s",dini_Get(Datei2,"besitzer"));
HausInfo[hausid][pickid] = CreatePickup(1273 ,23,HausInfo[hausid][hx],HausInfo[hausid][hy],HausInfo[hausid][hz],0);
HausInfo[hausid][interior] = dini_Int(Datei2,"interior");
HausInfo[hausid][virtual_world] = dini_Int(Datei2,"virtual_world");
HausInfo[hausid][Owned] = dini_Int(Datei2,"owned");
HausInfo[hausid][hClosed] = dini_Int(Datei2,"closed");
return print("Das Haus wurde erfolgreich geladen");
}
stock SaveHaus(hausid)
{
#pragma unused hausid
new fm[256],File:hausx = fopen("HAUS_DATEI",io_write);
for(new i = 0;i<MAX_HAUS;i++)
{
if(!HausInfo[i][interior])continue;
format(fm,sizeof fm,"Owner:%s\nX:%f\nY%f\nZ:%f\niX:%f\niY:%f\niZ:%f\nPreis:%d\nPickupid:%d\ninterior:%d\nvworld:%d\nowned:%d\nclosed:%d\n\r",
HausInfo[i][hOwner],HausInfo[i][hx],HausInfo[i][hy],
HausInfo[i][hz],HausInfo[i][ix],HausInfo[i][iy],HausInfo[i][iz],
HausInfo[i][hPreis],HausInfo[i][pickid],HausInfo[i][interior],HausInfo[i][virtual_world],
HausInfo[i][Owned],HausInfo[i][hClosed]);
fwrite(hausx,fm);
LoadHaus(i);
}
fclose(hausx);
return 1;
}
stock KillHaus(hausid)
{
return DestroyPickup(HausInfo[hausid][pickid]);
}
spielername(playerid)
{
new xname[MAX_PLAYER_NAME];
GetPlayerName(playerid,xname,sizeof xname);
return xname;
}
public initSlot()
{
new foundx = -1;
for(new i = 0;i<MAX_HAUS;i++)
{
if(HausInfo[i][hOwner] == '\0'){foundx = i;break;}
}
return foundx;
}
ocmd:chaus(playerid,params[])
{
if(GetPVarInt(playerid,"Adminlevel")>10)
{
new preis,haus,vworld,hausid;
if(sscanf(params,"iii",preis,haus,vworld))return SendClientMessage(playerid,BLAU,"Benutze: /chaus [Preis] [Haus] [Virtual World]");
new Float:ax,Float:ay,Float:az;
GetPlayerPos(playerid,ax,ay,az);
HausInfo[hausid][hx] = ax;
HausInfo[hausid][hy] = ay;
HausInfo[hausid][hz] = az;
HausInfo[hausid][hPreis] = preis;
HausInfo[hausid][interior] = Typen[haus][interior];
HausInfo[hausid][ix] = Typen[haus][haus_x];
HausInfo[hausid][iy] = Typen[haus][haus_y];
HausInfo[hausid][iz] = Typen[haus][haus_z];
HausInfo[hausid][virtual_world] = vworld;
HausInfo[hausid][hClosed] = 1;
format(HausInfo[hausid][hOwner],32,"Keiner");
HausInfo[hausid][pickid] = CreatePickup(1273,1,ax,ay,az,0);
SaveHaus(hausid);
}
return 1;
}
Bitte helft mir