Buyhouse/licenses/food/weapons in 1 command /buy -
sjvt - 08.03.2010
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?
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;
}
Re: Buyhouse/licenses/food/weapons in 1 command /buy -
aircombat - 08.03.2010
example :
Код:
if(strcmp(cmd,"/message",true)==0) {
new x_message[256];
x_message = strtok(cmdtext, idx);
if(!strlen(x_message)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /message (hello,hi,bye)");
return 1;
}
if(strcmp(x_message,"hello",true) == 0)
{
SendClientMessageToAll(COLOR_WHITE, "Hello");
}
if(strcmp(x_message,"hi",true) == 0)
{
SendClientMessageToAll(COLOR_WHITE, "hi");
}
if(strcmp(x_message,"bye",true) == 0)
{
SendClientMessageToAll(COLOR_WHITE, "bye");
}
return 1;
}
that will make if player typed /message hi , it will send all : hi , /message bye , etc...
________
WEED
Re: Buyhouse/licenses/food/weapons in 1 command /buy -
sjvt - 09.03.2010
uhm, that want i not
look i have this
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;
}
i do by a house /buy (it buy the house this work)
but at the ammunation,supermarket,license shop don't work :S
Re: Buyhouse/licenses/food/weapons in 1 command /buy -
sjvt - 09.03.2010
??