Advertisement
blackwolfsden

temp

Mar 20th, 2013
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. --[[*************************************************
  2. -- Guild House system Pig
  3. -- by Grumbo/BlackWolf aka slp13at420 of ac-web
  4. -- this will allow guild masters to buy up to 10
  5. -- pigs per guild area. each pigs is worth 1 custom coin
  6. *****************************************************]]--
  7. local PIGID = 49000
  8. local Buypig = ".gbuy pig"
  9. function Buypigs(_, plr, msg)
  10. if(plr:GetGuildName()==true)then
  11. local Pigcountdb = WorldDBQuery("SELECT `pig_count` FROM guild_house.zones WHERE `guild_name` = '"..plr:GetGuildName().."' AND `map_id` = '"..plr:GetMapId().."' AND `area_id` = '"..plr:GetAreaId().."' AND `zone_id` = '"..plr:GetZoneId().."';")
  12. local Locationdb = WorldDBQuery("SELECT `entry` FROM guild_house.zones WHERE `guild_name` = '"..plr:GetGuildName().."' AND `map_id` = '"..plr:GetMapId().."' AND `area_id` = '"..plr:GetAreaId().."' AND `zone_id` = '"..plr:GetZoneId().."';")
  13. if(msg == Buypig)then
  14. if(plr:GetGuildLeader()==plr:GetName())then
  15. if not(Pigcountdb)or not(Locationdb)then
  16. plr:SendBroadcastMessage("You cannot do that in this area.")
  17. elseif(Locationdb)then
  18. Loc = Locationdb:GetColumn(0):GetLong()
  19. Pigs = Pigcountdb:GetColumn(0):GetShort()
  20. if(Pigs==10)then
  21. plr:SendBroadcastMessage("You can only have 10 pigs per area.")
  22. elseif(Pigs<=9)then
  23. plr:SpawnCreature(PIGID, plr:GetX(), plr:GetY(),plr:GetZ(), plr:GetO(), 35, 0, 0, 0, 0, 1, 1)
  24. WorldDBQuery("UPDATE Guild_House.zones SET `pig_count` = `pig_count`+'1' Where `entry` = '"..Loc.."';");
  25. WorldDBQuery("UPDATE Guild_House.guilds SET `pig_count` = `pig_count`+'1' Where `guild` = '"..plr:GetGuildName().."';");
  26. end
  27. return false;
  28. end
  29. end
  30. elseif(plr:IsInGuild()==nil)then
  31. plr:SendBroadcastMessage("test")
  32. end
  33. return false;
  34. end
  35. end
  36.  
  37. RegisterServerHook(16, "Buypigs")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement