08.03.2010, 19:37
Hello, i make buyweapon,buylicenses,buyfood,buyhouses in 1 command (/buy)
when i do by a house /buy i buy a house, but by weapon shop,license shop, etc not?
when i do by a house /buy i buy a house, but by weapon shop,license shop, etc not?
pawn Код:
if(strcmp(cmd, "/buy", true) == 0)
{
for(new i = 0; i <sizeof(HouseInfo); i++)
{
if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
{
if(PlayerInfo[playerid][pLevel] < HouseInfo[i][hLevel])
{
format(string, sizeof(string), "You must be level %d to buy this house.", HouseInfo[i][hLevel]);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
if(PlayerInfo[playerid][pHouseKey] != 255)
{
SendClientMessage(playerid, COLOR_RED, "You are already owning a house, Sell that first.");
return 1;
}
if(HouseInfo[i][hOwned] == 1)
{
SendClientMessage(playerid, COLOR_RED, "This house you are trying to buy is already owned.");
return 1;
}
if(GetPlayerMoney(playerid) < HouseInfo[i][hValue])
{
format(string, sizeof(string), "You need $%d,- dollars in cash to buy this house.", HouseInfo[i][hValue]);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
else
{
SetPlayerPos(playerid, HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]);
SetPlayerInterior(playerid, HouseInfo[i][hInt]);
SetPlayerVirtualWorld(playerid, HouseInfo[i][hWorld]);
GivePlayerMoney(playerid, -HouseInfo[i][hValue]);
HouseInfo[i][hOwned] = 1;
strmid(HouseInfo[i][hOwner], playername, 0, strlen(playername), 25);
PlayerInfo[playerid][pHouseKey] = i;
OnHouseUpdate();
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
if(HouseInfo[i][hOwned] == 0)
{
//DestroyMapIcon(HOUSE_ICON[i]);
//HOUSE_ICON[i] = CreateMapIcon(31, 0, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]);
DestroyPickup(HOUSE_PICKUP[i]);
HOUSE_PICKUP[i] = CreatePickup(1273, 2, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]);
}
else
{
//DestroyMapIcon(HOUSE_ICON[i]);
//HOUSE_ICON[i] = CreateMapIcon(32, 0, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]);
DestroyPickup(HOUSE_PICKUP[i]);
HOUSE_PICKUP[i] = CreatePickup(1272, 2, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]);
}
format(string, sizeof(string), "You have successfully bought this house for $%d,-", HouseInfo[i][hValue]);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
if(PlayerToPoint(4, playerid, -1937.1833,302.8028,445.7198))
{
TogglePlayerControllable(playerid, 0);
ShowMenuForPlayer(LicenseMenu, playerid);
}
if(PlayerToPoint(4, playerid, 312.1129,-165.3791,999.6010))
{
TogglePlayerControllable(playerid, 0);
ShowMenuForPlayer(WeaponMenu, playerid);
}
if(PlayerToPoint(4, playerid, -27.9545,-89.8021,1003.5469))
{
TogglePlayerControllable(playerid, 0);
ShowMenuForPlayer(FoodMenu, playerid);
}
}
}
return 1;
}