09.05.2010, 09:23
I want to make this option in everytime 24/7 shop.i don't want it in business shop. i want to this in simple 24/7 shop please can u guys edit this?
pawn Код:
if(strcmp(cmd, "/buy", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(Businesses); i++)
{
if (PlayerToPoint(25.0,playerid,Businesses[i][ExitX], Businesses[i][ExitY], Businesses[i][ExitZ]))
{
if(GetPlayerVirtualWorld(playerid) == i)
{
if(Businesses[i][BizType] == 3) //24-7
{
if(Businesses[i][Products] != 0)
{
new x_info[128];
x_info = strtok(cmdtext, idx);
new wstring[128];
if(!strlen(x_info)) {
format(wstring, sizeof(wstring), "<|> %s <|>", Businesses[i][BusinessName]);
SendClientMessage(playerid, COLOR_RED, wstring);
SendClientMessage(playerid, COLOR_WHITE, "(Type /buy [item] Example: /buy baseballbat)");
SendClientMessage(playerid, COLOR_WHITE, "* Baseball Bat - Price: $20");
SendClientMessage(playerid, COLOR_WHITE, "* Dice - Price: $1");
SendClientMessage(playerid, COLOR_WHITE, "* Shovel - Price: $5");
SendClientMessage(playerid, COLOR_WHITE, "* Parachute - Price: $150");
SendClientMessage(playerid, COLOR_WHITE, "* Phone Book - Price: $10 (/phonebook)");
SendClientMessage(playerid, COLOR_WHITE, "* Flowers - Price: $25");
SendClientMessage(playerid, COLOR_WHITE, "* Cards - Price: $500");
SendClientMessage(playerid, COLOR_RED, "<|> Business <|>");
return 1;
}
if(strcmp(x_info, "baseballbat", true) == 0)
{
if(GetPlayerCash(playerid) >= 20)
{
SafeGivePlayerWeapon(playerid,5,1);
GivePlayerCash(playerid,-20);
SendClientMessage(playerid, COLOR_WHITE, "(SUCCESS) You bought a baseball bat");
Businesses[i][Products]--;
Businesses[i][Till]+=20;
SaveBusinesses();
PlayerActionMessage(playerid,15.0,"gives the business some money and gets an item back in return");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You do not have enough money");
}
}
else if(strcmp(x_info, "cards", true) == 0)
{
if(GetPlayerCash(playerid) >= 500)
{
PlayerInfo[playerid][pCards] = 1;
GivePlayerCash(playerid,-500);
SendClientMessage(playerid, COLOR_WHITE, "(SUCCESS) You bought a deck of cards. (( /cards for info. ))");
Businesses[i][Products]--;
Businesses[i][Till]+=500;
SaveBusinesses();
PlayerActionMessage(playerid,15.0,"gives the business some money and gets an item back in return");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You do not have enough money");
}
}
else if(strcmp(x_info, "shovel", true) == 0)
{
if(GetPlayerCash(playerid) >= 5)
{
SafeGivePlayerWeapon(playerid,6,1);
GivePlayerCash(playerid,-5);
SendClientMessage(playerid, COLOR_WHITE, "(SUCCESS) You bought a shovel");
Businesses[i][Products]--;
Businesses[i][Till]+=5;
SaveBusinesses();
PlayerActionMessage(playerid,15.0,"gives the business some money and gets an item back in return");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You do not have enough money");
}
}
else if(strcmp(x_info, "parachute", true) == 0)
{
if(GetPlayerCash(playerid) >= 150)
{
SafeGivePlayerWeapon(playerid,46,0);
GivePlayerCash(playerid,-150);
SendClientMessage(playerid, COLOR_WHITE, "(SUCCESS) You bought a parachute");
Businesses[i][Products]--;
Businesses[i][Till]+=150;
SaveBusinesses();
PlayerActionMessage(playerid,15.0,"gives the business some money and gets an item back in return");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You do not have enough money");
}
}
else if(strcmp(x_info, "phonebook", true) == 0)
{
if(GetPlayerCash(playerid) >= 10)
{
GivePlayerCash(playerid,-10);
SendClientMessage(playerid, COLOR_WHITE, "(SUCCESS) You bought a phone book (/phonebook)");
Businesses[i][Products]--;
Businesses[i][Till]+=10;
PlayerInfo[playerid][pPhoneBook] = 1;
SaveBusinesses();
PlayerActionMessage(playerid,15.0,"gives the business some money and gets an item back in return");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You do not have enough money");
}
}
else if(strcmp(x_info, "dice", true) == 0)
{
if(GetPlayerCash(playerid) >= 1)
{
GivePlayerCash(playerid,-1);
SendClientMessage(playerid, COLOR_WHITE, "(SUCCESS) You have bought a dice (/dice)");
Businesses[i][Products]--;
Businesses[i][Till]+=1;
Dice[playerid] = 1;
SaveBusinesses();
PlayerActionMessage(playerid,15.0,"gives the business some money and gets an item back in return");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You do not have enough money");
}
}
else if(strcmp(x_info, "flowers", true) == 0)
{
if(GetPlayerCash(playerid) >= 25)
{
SafeGivePlayerWeapon(playerid,14,1);
GivePlayerCash(playerid,-25);
SendClientMessage(playerid, COLOR_WHITE, "(SUCCESS) You bought flowers");
Businesses[i][Products]--;
Businesses[i][Till]+=25;
SaveBusinesses();
PlayerActionMessage(playerid,15.0,"gives the business some money and gets an item back in return");
return 1;
}
}
}
}
}
}
}
}
return 1;
}