Code:
quest Coins begin
state start begin
when 9003.chat."Coins kaufen" begin
local Items = {1, 11299, 11499, 11699, 11899} -- Yang oder Kingrüstungen
local Count = {1500000000, 1, 1, 1, 1}
local Coins = {100, 20, 20, 20, 20}
say_title(mob_name(9003)..":")
say("Bei mir kannst du Coins kaufen.")
say("Möglichkeiten:")
say_reward(" - "..Items[1].." ("..Count[1].."x): "..Coins[1].." Coins")
say_reward(" - "..Items[2].." ("..Count[2].."x): "..Coins[2].." Coins")
say_reward(" - "..Items[3].." ("..Count[3].."x): "..Coins[3].." Coins")
say_reward(" - "..Items[4].." ("..Count[4].."x): "..Coins[4].." Coins")
say_reward(" - "..Items[5].." ("..Count[5].."x): "..Coins[5].." Coins")
say("")
say_reward("Wähle eine Variante aus!")
local s = select("Variante 1", "Variante 2", "Variante 3", "Variante 4", "Variante 5", "Abbrechen")
if s == 6 then
return
end
AItem = Items[s]
ACount = Count[s]
ACoins = Coins[s]
if pc.count_item(AItem) < ACount then
say_title(mob_name(9003)..":")
say("Fehler: Fehlendes Material.")
say("Benötigt: "..AItem.." ("..ACount.."x) -> "..ACoins.." Coins")
say("")
return
end
pc.remove_item(AItem, ACount)
local acc_id = mysql_query("SELECT `account_id` FROM player.player WHERE `name`='"..pc.get_name().."';")
mysql_query("UPDATE account.account SET `coins`=`coins`+"..ACoins.." WHERE `id`='"..acc_id.."';")
local new_coins = mysql_query("SELECT `coins` FROM account.account WHERE `id`='"..acc_id.."';")
say_title(mob_name(9003)..":")
say("Die Coins wurden aufgeladen!")
say("Du hast jetzt "..new_coins.." Coins.")
say("")
end
end
end