I'm trying to get this Slot Machine script working. And when i try to spawn the NPC, it says Invalid ID, but i can look it up and it shows up.
Code:
x = math.random(1, 11)
function Gambler_OnGossipTalk(unit, event, player)
unit:GossipCreateMenu(50, player, 0)
unit:GossipMenuAddItem(1, "Insert Coin", x, 0)
unit:GossipSendMenu(player)
end
function Gambler_OnGossipSelect
if(intid == 1) then
player:RemoveItem(500000, 1)
pUnit:SendChatMessage(11, 0, "You lose!")
player:GossipComplete()
end
if(intid == 2) then
player:RemoveItem (500000, 1)
pUnit:SendChatMessage(11, 0, "You lose!")
player:GossipComplete()
end
if(intid == 3) then
player:RemoveItem (500000, 1)
pUnit:SendChatMessage(11, 0, "You lose!")
player:GossipComplete()
end
if(intid == 4) then
player:RemoveItem (500000, 1)
pUnit:SendChatMessage(11, 0, "You lose!")
player:GossipComplete()
end
if(intid == 5) then
player:RemoveItem (500000, 1)
pUnit:SendChatMessage(11, 0, "You lose!")
player:GossipComplete()
end
if(intid == 6) then
player:RemoveItem (500000, 1)
pUnit:SendChatMessage(11, 0, "You lose!")
player:GossipComplete()
end
if(intid == 7) then
player:RemoveItem (500000, 1)
pUnit:SendChatMessage(11, 0, "You lose!")
player:GossipComplete()
end
if(intid == 8) then
player:RemoveItem (500000, 1)
pUnit:SendChatMessage(11, 0, "You lose!")
player:GossipComplete()
end
if(intid == 9) then
player:RemoveItem (500000, 1)
player:Additem (500001, 1)
pUnit:SendChatMessage(11, 0, "You get a ticket!")
player:GossipComplete()
end
if(intid == 10) then
player:RemoveItem (500000, 1)
player:Additem (1337, 1)
pUnit:SendChatMessage(11, 0, "You win a weapon!")
player:GossipComplete()
end
if(intid == 11) then
player:RemoveItem (500000, 1)
player:Additem (1053, 1)
pUnit:SendChatMessage(11, 0, "You win a cool ass bag!")
player:GossipComplete()
end
RegisterUnitGossipEvent(50005, 1, "Gambler_OnGossipTalk")
RegisterUnitGossipEvent(50005, 2, "Gambler_OnGossipSelect")
MYSQL
Code:
INSERT INTO `creature_names` VALUES ('50005', 'Slots Machine', 'Lol beans', '', '0', '0', '0', '3', '0', null, '21019', '0', '0', '0', '1', '1', '0', null);
INSERT INTO `creature_proto` VALUES ('50005', '70', '70', '35', '100000', '100000', '100', '1', '1', '1500', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '36000', '6807', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '2.5', '8', '14', '0', '0', '0', '0', '0', '0', '0');
I have no idea what's working.