stock LoadHouseVisual(playerid, houseid)
{
DestroyDynamicPickup(HousePickup[playerid]);
if(House[houseid][hOwned] == 0)
{
HousePickup[playerid] = CreateDynamicPickup(1273, 1, House[houseid][ExtPosX], House[houseid][ExtPosY], House[houseid][ExtPosZ], 0, 0);
}
else if(House[houseid][hOwned] == 1)
{
HousePickup[playerid] = CreatePickup(19522, 1, House[houseid][ExtPosX], House[houseid][ExtPosY], House[houseid][ExtPosZ], 0);
}
return 1;
}
CMD:buyhouse(playerid, params[])
{
if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be logged in to use this command.");
new string[128], Float:x, Float:y, Float:z, owner[MAX_PLAYER_NAME];
owner = GetName(playerid);
if(Player[playerid][HouseID] == -1)
{
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i<MAX_HOUSES; i++)
{
if(fexist(HousePath(i)))
{
if(IsPlayerInRangeOfPoint(playerid, 1, House[i][ExtPosX], House[i][ExtPosY], House[i][ExtPosZ]))
{
if(House[i][hOwned] == 0)
{
if(Player[playerid][Money] >= House[i][hPrice])
{
DestroyDynamicPickup(HousePickup[playerid]);
Player[playerid][HouseID] = House[i][hID];
House[i][hOwned] = 1;
House[i][hOwner] = owner;
//House[i][hPickup] = 19522;
Player[playerid][Money] -= House[i][hPrice];
SaveHouses(i);
LoadHouseVisual(playerid, i);
format(string, sizeof(string), "You have bought property named: %s [ID: %i] for $%i.", House[i][hName], House[i][hID], House[i][hPrice]);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_GREEN, "Please take a screenshot now if a bug is to cause you to loose your house.");
SendClientMessage(playerid, COLOR_GREEN, "We cannot refund you the house or caps if the screenshot isn't provided, so keep that in mind.");
}
else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough caps to buy the house.");
}
else return SendClientMessage(playerid, COLOR_GREY, "This house is already owned.");
}
}
}
}
else return SendClientMessage(playerid, COLOR_GREY, "You already own a house.");
return 1;
}
CMD:sellhouse(playerid, params[])
{
if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be logged in to use this command.");
new string[128], Float:x, Float:y, Float:z;
for(new i = 0; i<MAX_HOUSES; i++)
{
if(fexist(HousePath(i)))
{
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 1, House[i][ExtPosX], House[i][ExtPosY], House[i][ExtPosZ]))
{
if(Player[playerid][HouseID] == House[i][hID])
{
if(House[i][hOwned] == 1)
{
DestroyDynamicPickup(HousePickup[playerid]);
Player[playerid][HouseID] = -1;
House[i][hOwned] = 0;
House[i][hLocked] = 1;
House[i][hOwner] = 0;
//House[i][hPickup] = 1273;
Player[playerid][Money] += (House[i][hPrice]/2);
SaveHouses(i);
LoadHouseVisual(playerid, i);
format(string, sizeof(string), "You have sold property named: %s [ID: %i] for $%i.", House[i][hName], House[i][hID], (House[i][hPrice]/2));
SendClientMessage(playerid, COLOR_GREEN, string);
}
else return SendClientMessage(playerid, COLOR_GREY, "This house is already owned.");
}
else return SendClientMessage(playerid, COLOR_GREY, "You do not own this house.");
}
}
}
return 1;
}
stock LoadHouseVisual(playerid, houseid)
{
DestroyDynamicPickup(HousePickup[playerid]);
if(House[houseid][hOwned] == 0)
{
HousePickup[playerid] = CreateDynamicPickup(1273, 1, House[houseid][ExtPosX], House[houseid][ExtPosY], House[houseid][ExtPosZ], 0, 0);
}
else if(House[houseid][hOwned] == 1)
{
HousePickup[playerid] = CreateDynamicPickup(19522, 1, House[houseid][ExtPosX], House[houseid][ExtPosY], House[houseid][ExtPosZ], 0);
}
return 1;
}
You are using CreateDynamicPickup and CreatePickup interchangeably. Try using just one:
pawn Код:
|