Код:
if(dialogid == STORE && response) //
{
// We'll use the switch/cases now because we're going to process a few results, not just one. Remember, the first item in the list has id 0.
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) <= 1499) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Chainsaw ($2000)");
return 1;
}
GivePlayerMoney(playerid,-1500);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Chainsaw. You were charged $1500");
GivePlayerWeapon(playerid,9,1);
}
case 1:
{
if(GetPlayerMoney(playerid) <= 4) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy flowers ($5)");
return 1;
}
GivePlayerMoney(playerid,-5);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought flowers. You were charged $5");
GivePlayerWeapon(playerid,14,1);
}
case 2:
{
if(GetPlayerMoney(playerid) <= 99) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Baseball Bat ($100)");
return 1;
}
GivePlayerMoney(playerid,-100);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Baseball Bat. You were charged $100");
GivePlayerWeapon(playerid,5,1);
}
case 3:
{
if(GetPlayerMoney(playerid) <= 19) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy Beer ($20)");
return 1;
}
GivePlayerMoney(playerid,-20);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought Beer. You were charged $20");
new Float:beerhealth;
GetPlayerHealth(playerid,beerhealth);
if(beerhealth <=95) {
SetPlayerHealth(playerid,beerhealth+5);
}
case 4:
{
if(GetPlayerMoney(playerid) <= 999) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Wallet ($1000)");
return 1;
}
if(HasWallet[playerid] >= 1) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You already have a Wallet");
return 1;
}
GivePlayerMoney(playerid,-1000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Wallet. You were charged $1000");
SendClientMessage(playerid, 0x00C7FFAA, "You can be robbed upto 3 times and not loose any cash");
HasWallet[playerid] =3;
}
case 5:
{
if(GetPlayerMoney(playerid) <= 499) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a ");
return 1;
}
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Parachute. You were charged $500");
GivePlayerWeapon(playerid,46,1);
}
case 6:
{
if(GetPlayerMoney(playerid) <= 3999) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy some rope ($4000)");
return 1;
}
if(gotRope[playerid] == 1) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, 0x00C7FFAA, "You already have some rope.");
}
GivePlayerMoney(playerid,-4000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought some rope. You were charged $4000");
gotRope[playerid] =1;
}
case 7:
{
if(GetPlayerMoney(playerid) <= 999) {
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a pair of rusty sissors. ($1000)");
return 1;
}
GivePlayerMoney(playerid,-1000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought rusty sissors.. You were charged $1000");
gotSissors[playerid] =1;
}
}
}
return 1;
}