Wenn ich im Haus-Icon stehe und /kauf eingebe, wird der Betrag abgezogen und sofort wieder gutgeschrieben.
Wenn ich im Haus-Icon stehe und /verkauf eingebe, wird der Betrag gutgeschrieben und sofort wieder abgezogen.
Mit /buy und /sell war es auch so. Wo liegt hier der Fehler ?
dcmd_verkauf(playerid,params[])
{
#pragma unused params
new timestamp = GetTickCount();
if(timestamp - inhousepickup[playerid] > 5000)
{
SendClientMessage(playerid, c_r, "Du bist nicht in einem Haus Icon!");
return 1;
}
new str[255],str1[256],pname[24];
GetPlayerName(playerid, pname, 24);
format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
if (strcmp(hInfo[playericonhouse[playerid]][Name],pname,false)) return SendClientMessage(playerid, c_r, "Das ist nicht Dein Haus!");
SendClientMessage(playerid, c_y, "Du hast Dein Haus verkauft!");
format(str, sizeof(str), "%s has sold houseid 0",pname);
print(str);
GivePlayerMoney(playerid, hInfo[playericonhouse[playerid]][Sell]);
dini_Set(str1, "Name", "ForSale");
hInfo[playericonhouse[playerid]][Locked] = dini_IntSet(str1,"Locked",0);
format(hInfo[playericonhouse[playerid]][Name],255,"ForSale");
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if (!dini_Exists(str1)) dini_Create(str1);
dini_IntSet(str1, "Houseid", -255);
DestroyPickup(HousePickup[playericonhouse[playerid]]);
HousePickup[playericonhouse[playerid]] = CreatePickup(1273, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]);
RemovePlayerMapIcon(playerid, housemapicon[playerid]);
return 1;
}
dcmd_kauf(playerid,params[])
{
#pragma unused params
new timestamp = GetTickCount();
if(timestamp - inhousepickup[playerid] > 5000)
{
SendClientMessage(playerid, c_r, "Du bist nicht in einem Haus Icon!");
return 1;
}
new str[255],str1[255],pname[24];
GetPlayerName(playerid, pname, 24);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if(dini_Exists(str1))
{
if (dini_Int(str1, "Houseid")!=-255) return SendClientMessage(playerid, c_r, "Du kannst nur ein Haus kaufen!");
}
format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]);
if (strcmp(hInfo[playericonhouse[playerid]][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "Haus ist nicht zu verkaufen!");
if(GetPlayerMoney(playerid)<hInfo[playericonhouse[playerid]][Cost]) return SendClientMessage(playerid, c_r, "Du hast nicht genug Geld!");
SendClientMessage(playerid, c_y, "You have bought the house!");
format(str, sizeof(str), "%s has bought houseid 0",pname);
print(str);
GivePlayerMoney(playerid, -hInfo[playericonhouse[playerid]][Cost]);
dini_Set(str1, "Name", pname);
hInfo[playericonhouse[playerid]][Name]=pname;
hInfo[playericonhouse[playerid]][Locked] = dini_IntSet(str1,"Locked",0);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if (!dini_Exists(str1)) dini_Create(str1);
new Float:sy, Float:sx, Float:sz;
dini_IntSet(str1, "Houseid", playericonhouse[playerid]);
if(!dini_Isset(str1,"Rentid"))
{
dini_IntSet(str1, "Rentid", -255);
}
GetPlayerPos(playerid, sx,sy,sz);
dini_FloatSet(str1, "SpawnX", sx);
dini_FloatSet(str1, "SpawnY", sy);
dini_FloatSet(str1, "SpawnZ", sz);
dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
DestroyPickup(HousePickup[playericonhouse[playerid]]);
HousePickup[playericonhouse[playerid]] = CreatePickup(1272, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]);
return 1;
}