oben kommt die pwn
hir nochmal anders .....
if(!strcmp(cmdtext, "/hauskaufen", true))
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
if(!HouseInfo[i][hOwned])
{
if(GetPlayerMoney(playerid) < HouseInfo[i][hPrice])
{
SendClientMessage(playerid, Grey, "Du hast nicht genug Geld!");
return 1;
}
if(PlayerInfo[playerid][pHouseKey] != MAX_HOUSES+1)
{
SendClientMessage(playerid, Grey, "Du besitzt bereits ein Haus!");
return 1;
}
GetPlayerName(playerid,sendername,sizeof(sendername));
format(HouseInfo[i][hOwner], 24, sendername);
HouseInfo[i][hOwned] = 1;
UpdateHouseLabel(i);
PlayerInfo[playerid][pHouseKey] = i;
GivePlayerMoney(playerid, -HouseInfo[i][hPrice]);
SendClientMessage(playerid, Grey, "Glückwunsch zum Kauf der Immobilie!");
SaveHouses();
return 1;
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/hauskasse", true))
{
for(new i = 0; i<MAX_HOUSES; i++)
{
format(str, sizeof str, "/Houses/%d.ini", i);
if(fexist(str))
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, HouseInfo[i][hIntx], HouseInfo[i][hInty], HouseInfo[i][hIntz]) && GetPlayerVirtualWorld(playerid) == i)
{
if(!strcmp(pn(playerid), HouseInfo[i][hOwner], false))
{
ShowPlayerDialog(playerid, HauskasseDiag, 2, "Hauskasse", "Inhalt\nRausholen\nReintun", "Auswählen", "Beenden");
SetPVarInt(playerid, "Hauskassehid", i);
}
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/asellhouse", true))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
HouseInfo[i][hOwned] = 0;
new id = ReturnUser(HouseInfo[i][hOwner]);
if(IsPlayerConnected(id))
{
PlayerInfo[id][pHouseKey] = MAX_HOUSES+1;
format(str, sizeof str, "Admin %s hat dein Haus verkauft!", pn(playerid));
SendClientMessage(id, Grey, str);
}
else
{
format(str, sizeof str, "/Accounts/%s.acc", HouseInfo[i][hOwner]);
if(INI_Open(str))
{
INI_WriteInt("HouseKey", MAX_HOUSES+1);
INI_Save();
INI_Close();
}
}
format(HouseInfo[i][hOwner], MAX_PLAYER_NAME, "-");
DestroyDynamicPickup(HouseInfo[i][hPick]);
HouseInfo[i][hPick] = CreateDynamicPickup(1273, 1, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
SendClientMessage(playerid, Grey, "Haus verkauft und HouseKey des Besitzers zurückgesetzt!");
UpdateHouseLabel(i);
SaveHouses();
return 1;
}
}
}
else SendClientMessage(playerid, Grey, "Du bist kein Admin oder nicht im Adminmode!");
return 1;
}
if(!strcmp(cmdtext, "/mietstatus", true))
{
new i = PlayerInfo[playerid][pHouseKey]; if(i == MAX_HOUSES+1) return SendClientMessage(playerid, Grey, "Du besitzt kein Haus!");
if(!HouseInfo[i][hRentable])
{
HouseInfo[i][hRentable] = 1;
UpdateHouseLabel(i);
SendClientMessage(playerid, Grey, "Andere Spieler können sich nun dein Haus mieten!");
return 1;
}
if(HouseInfo[i][hRentable])
{
HouseInfo[i][hRentable] = 0;
UpdateHouseLabel(i);
SendClientMessage(playerid, Grey, "Andere Spieler können sich dein Haus nun nicht mehr mieten!");
return 1;
}
return 1;
}
if(!strcmp(cmd, "/miete", true))
{
new i = PlayerInfo[playerid][pHouseKey]; if(i == MAX_HOUSES+1) return SendClientMessage(playerid, Grey, "Du besitzt kein Haus!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Grey, "Verwendung: /Miete [1-10000]");
new miete = strval(tmp);
if(miete < 1 miete > 10000) return SendClientMessage(playerid, Grey, "Gib einen Betrag zwischen 1 und 10000 an!");
HouseInfo[i][hRent] = miete;
format(str, sizeof str, "Deine neue Miete beträgt %d€", miete);
SendClientMessage(playerid, Grey, str);
UpdateHouseLabel(i);
return 1;
}
if(!strcmp(cmd, "/rausschmeissen", true))
{
new i = PlayerInfo[playerid][pHouseKey]; if(i == MAX_HOUSES+1) return SendClientMessage(playerid, Grey, "Du besitzt kein Haus!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Grey, "Verwendung: /Rausschmeissen [PlayerID/Name] ( Wenn der Spieler nicht online ist, gib den genauen Namen an! )");
new pid = ReturnUser(tmp);
if(pid == INVALID_PLAYER_ID && !IsPlayerConnected(pid))
{
new path[50], rentkey;
format(path, sizeof path, "/Accounts/%s.acc", tmp);
if(!fexist(path)) return SendClientMessage(playerid, Grey, "Dieser Spieler ist nicht online und der Account existiert nicht!");
if(INI_Open(path))
{
rentkey = INI_ReadInt("RentHouseKey");
if(rentkey != i) return SendClientMessage(playerid, Grey, "Der Spieler mietet sich dein Haus nicht!");
INI_WriteInt("RentHouseKey", MAX_HOUSES+1);
INI_Save();
INI_Close();
}
return 1;
}
else if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pRentHouseKey] != i) return SendClientMessage(playerid, Grey, "Der Spieler mietet sich dein Haus nicht!");
PlayerInfo[pid][pRentHouseKey] = MAX_HOUSES+1;
format(string, sizeof string, "Du hast %s aus dem Haus geschmissen!", pn(pid));
SendClientMessage(playerid, Grey, str);
format(string, sizeof string, "Du wurdest von %s aus dem Haus geschmissen!", pn(playerid));SendClientMessage(pid, Grey, str);
return 1;
}
return 1;
}
if(!strcmp(cmdtext, "/allerausschmeissen", true))
{
new i = PlayerInfo[playerid][pHouseKey]; if(i == MAX_HOUSES+1) return SendClientMessage(playerid, Grey, "Du besitzt kein Haus!");
for(new p = 0; p<GetMaxPlayers(); p++)
{
if(IsPlayerConnected(p))
{
if(PlayerInfo[p][pRentHouseKey] == i)
{
PlayerInfo[p][pRentHouseKey] = MAX_HOUSES+1;
SendClientMessage(p, Grey, "Dein Vermieter hat dich aus der Wohnung geschmissen!");
}
}
}
SendClientMessage(playerid, Grey, "Alle Bewohner wurden aus der Wohnung geschmissen!");
return 1;
}
if(!strcmp(cmdtext, "/hauskaufen", true))
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
if(!HouseInfo[i][hOwned])
{
if(GetPlayerMoney(playerid) < HouseInfo[i][hPrice])
{
SendClientMessage(playerid, Grey, "Du hast nicht genug Geld!");
return 1;
}
if(PlayerInfo[playerid][pHouseKey] != MAX_HOUSES+1)
{
SendClientMessage(playerid, Grey, "Du besitzt bereits ein Haus!");
return 1;
}
format(HouseInfo[i][hOwner], 24, sendername);
HouseInfo[i][hOwned] = 1;
UpdateHouseLabel(i);
PlayerInfo[playerid][pHouseKey] = i;
GivePlayerMoney(playerid, -HouseInfo[i][hPrice]);
SendClientMessage(playerid, Grey, "Glückwunsch zum Kauf der Immobilie!");
SaveHouses();
return 1;
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/interiors", true))
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
for(new i = 0; i<sizeof(Interiors); i++)
{
format(str, sizeof str, "Interior Typ %d: %s, IntID: %d", i+1, Interiors[i][description]);
SendClientMessage(playerid, Grey, str);
}
return 1;
}
return 1;
}
if(!strcmp(cmd, "/createhouse", true))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Grey, "/CreateHouse [Preis] [Interior Typ ( /interiors )]");
new housepreis = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Grey, "/CreateHouse [Preis] [Interior Typ ( /interiors )]");
new inttype = strval(tmp);
if(inttype < 1 inttype > sizeof(Interiors)) return SendClientMessage(playerid, Grey, "Ungültige Interior Typ ID! /interiors");
inttype -= 1;
new i = GetHouseID(); if(i == -1) return SendClientMessage(playerid, Grey, "Es kann kein weiters Haus mehr erstellt werden! ( MAX_HOUSES erhöhen )");
format(str, sizeof str, "/Houses/%d.ini", i);
dini_Create(str);
HouseInfo[i][hEntrx] = GetX(playerid);
HouseInfo[i][hEntry] = GetY(playerid);
HouseInfo[i][hEntrz] = GetZ(playerid);
HouseInfo[i][hInt] = Interiors[inttype][interiorid];
HouseInfo[i][hIntx] = Interiors[inttype][intpx];
HouseInfo[i][hInty] = Interiors[inttype][intpy];
HouseInfo[i][hIntz] = Interiors[inttype][intpz];
HouseInfo[i][hIntid] = inttype;
HouseInfo[i][hPrice] = housepreis;
HouseInfo[i][hRentable] = 0;
HouseInfo[i][hRent] = 50;
HouseInfo[i][hOwned] = 0;
format(HouseInfo[i][hOwner], MAX_PLAYER_NAME, "-");
format(HouseInfo[i][hDescr], 50, "%s", Interiors[inttype][description]);
format(str, sizeof str, "%s\nZum Verkauf\nPreis: %d€", HouseInfo[i][hDescr], HouseInfo[i][hPrice]);
HouseInfo[i][hLabel] = CreateDynamic3DTextLabel(str, COLOR_HOUSELABEL, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz], 20);
HouseInfo[i][hPick] = CreateDynamicPickup(1273, 1, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
SendClientMessage(playerid, Grey, "Haus erstellt!");
SaveHouse(i);
return 1;
}
return 1;
}
if(!strcmp(cmdtext, "/destroyhouse", true))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
DestroyDynamicPickup(HouseInfo[i][hPick]);
DestroyDynamic3DTextLabel(HouseInfo[i][hLabel]);
format(string, sizeof string, "/Houses/%d.ini", i);
fremove(string);
HouseInfo[i][hEntrx] = 0;
HouseInfo[i][hEntry] = 0;
HouseInfo[i][hEntrz] = 0;
HouseInfo[i][hIntx] = 0;
HouseInfo[i][hInty] = 0;
HouseInfo[i][hIntz] = 0;
HouseInfo[i][hOwned] = 0;
format(HouseInfo[i][hOwner], MAX_PLAYER_NAME, "-");
HouseInfo[i][hPrice] = 0;
HouseInfo[i][hIntid] = 0;
HouseInfo[i][hInt] = 0;
HouseInfo[i][hRentable] = 0;
HouseInfo[i][hRent] = 0;
HouseInfo[i][hLocked] = 0;
format(HouseInfo[i][hDescr], 50, "-");
SendClientMessage(playerid, Grey, "Haus gelöscht!");
}
}
}
return 1;
}
if(!strcmp(cmd, "/houseid", true))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
format(string, sizeof string, "HouseID: %d", i);
SendClientMessage(playerid, Grey, string);
return 1;
}
}
}
return 1;
}
if(!strcmp(cmd, "/sethouseprice", true))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Grey, "Verwendung: /SetHousePrice [Preis]");
new price = strval(tmp);
if( price < 0) return SendClientMessage(playerid, Grey, "Ungültiger Preis!");
HouseInfo[i][hPrice] = price;
UpdateHouseLabel(i);
return 1;
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/hausaufzu", true))
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
if(PlayerInfo[playerid][pHouseKey] == i)
{
if(HouseInfo[i][hLocked])
{
HouseInfo[i][hLocked] = 0;
SendClientMessage(playerid, Grey, "Haus aufgeschlossen!");
return 1;
}
else if(!HouseInfo[i][hLocked])
{
HouseInfo[i][hLocked] = 1;
SendClientMessage(playerid, Grey, "Haus abgeschlossen!");
return 1;
}
}
else
{
SendClientMessage(playerid, Grey, "Dieses Haus gehört dir nicht!");
return 1;
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/ahausaufzu", true))
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
if(HouseInfo[i][hLocked])
{
HouseInfo[i][hLocked] = 0;
SendClientMessage(playerid, Grey, "Haus aufgeschlossen!");
return 1;
}
else if(!HouseInfo[i][hLocked])
{
HouseInfo[i][hLocked] = 1;
SendClientMessage(playerid, Grey, "Haus abgeschlossen!");
return 1;
}
return 1;
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/haushilfe", true))
{
if(PlayerInfo[playerid][pAdmin] > 0)
{
SendClientMessage(playerid, Grey, "/CreateHouse [Preis] [Interior Typ], /interiors, /asellhouse, /gotohouse [HouseID], /enterhouse [HouseID], /SetHousePrice [Preis], /HouseID /hauskasse");
SendClientMessage(playerid, Grey, "/HausVerkaufen,sethouseprice, /HausKaufen, /Miete, /Mieten, /WohnungKündigen, /HausAufZu, /Mietstatus, /Rausschmeissen [PlayerID/Name], /AlleRausschmeissen");
SendClientMessage(playerid, Grey, "/HausVerkaufen, /HausKaufen, /Miete, /Mieten, /WohnungKündigen, /HausAufZu, /Mietstatus, /Rausschmeissen [PlayerID/Name], /AlleRausschmeissen");
}
else if(PlayerInfo[playerid][pAdmin] == 0)
{
SendClientMessage(playerid, Grey, "/HausVerkaufen, /HausKaufen, /Miete, /Mieten, /WohnungKündigen, /HausAufZu, /Mietstatus, /Rausschmeissen [PlayerID/Name], /AlleRausschmeissen");
}
return 1;
}
if(!strcmp(cmd, "/enterhouse", true))
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Grey, "Verwendung: /EnterHouse [HouseID]");
new i = strval(tmp);
if(i < 0 i > MAX_HOUSES) return SendClientMessage(playerid, Grey, "Ungültige Haus ID!");
SetPlayerPos(playerid, HouseInfo[i][hIntx], HouseInfo[i][hInty], HouseInfo[i][hIntz]);
SetPlayerInterior(playerid, HouseInfo[i][hInt]);
SetPlayerVirtualWorld(playerid, i);
}
return 1;
}
if(!strcmp(cmd, "/sethausint", true))
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Grey, "Verwendung: /SethausInt [ID] ( /interiors )");
new intid = strval(tmp);
if(intid < 1 intid > 11) return SendClientMessage(playerid, Grey, "Ungültige Interior ID. /interiors");
HouseInfo[i][hIntid] = intid;
DestroyDynamicPickup(HouseInfo[i][hPick]);
DestroyDynamic3DTextLabel(HouseInfo[i][hLabel]);
SaveHouse(i);
LoadHouse(i);
SendClientMessage(playerid, Grey, "Interior ID geändert!");
return 1;
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/wohnungkündigen", true))
{
if(PlayerInfo[playerid][pRentHouseKey] == MAX_HOUSES+1) return SendClientMessage(playerid, Grey, "Du mietest keine Wohnung!");
PlayerInfo[playerid][pRentHouseKey] = MAX_HOUSES+1;
SendClientMessage(playerid, Grey, "Mietvertrag gekündigt!");
return 1;
}
if(!strcmp(cmdtext, "/mieten", true))
{
for(new i = 0; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]))
{
if(!HouseInfo[i][hOwned]) return SendClientMessage(playerid, Grey, "Dieses Haus gehört niemandem!");
if(HouseInfo[i][hRentable] == 0) return SendClientMessage(playerid, Grey, "Der Besitzer vermietet das Haus nicht!");
if(PlayerInfo[playerid][pHouseKey] != MAX_HOUSES+1) return SendClientMessage(playerid, Grey, "Du kannst dir kein Haus mieten, wenn du bereits eines besitzt!");
if(PlayerInfo[playerid][pRentHouseKey] != MAX_HOUSES+1) return SendClientMessage(playerid, Grey, "Du mietest dir bereits ein Haus!");
PlayerInfo[playerid][pRentHouseKey] = i;
format(str, sizeof str, "Du mietest dieses Haus jetzt! An jedem Payday werden dir ab sofort die Mietkosten in Höhe von %d€ abgezogen!", HouseInfo[i][hRent]);
SendClientMessage(playerid, Grey, str);
SendClientMessage(playerid, Grey, "Tippe /wohungkündigen um vom Mietvertrag zurückzutreten!");
}
}
return 1;
}
if(!strcmp(cmdtext, "/hausverkaufen", true))
{
new i = PlayerInfo[playerid][pHouseKey]; if(i == MAX_HOUSES+1) return SendClientMessage(playerid, Grey, "Du besitzt kein Haus!");
GivePlayerMoney(playerid, HouseInfo[i][hPrice]/4);
HouseInfo[i][hOwned] = 0;
format(HouseInfo[i][hOwner], MAX_PLAYER_NAME, "-");
DestroyDynamicPickup(HouseInfo[i][hPick]);
HouseInfo[i][hPick] = CreateDynamicPickup(1273, 1, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
SendClientMessage(playerid, Grey, "Du hast dein Haus verkauft und erhälst 1/4 des Kaufpreises zurück!");
UpdateHouseLabel(i);
PlayerInfo[playerid][pHouseKey] = MAX_HOUSES+1;
SaveHouses();
return 1;
}