Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[*************************************************
- -- Guild House system Pig
- -- by Grumbo/BlackWolf aka slp13at420 of ac-web
- -- this will allow guild masters to buy up to 10
- -- pigs per guild area. each pigs is worth 1 custom coin
- *****************************************************]]--
- local PIGID = 49000
- local Buypig = ".gbuy pig"
- function Buypigs(_, plr, msg)
- if(plr:GetGuildName()==true)then
- 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().."';")
- 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().."';")
- if(msg == Buypig)then
- if(plr:GetGuildLeader()==plr:GetName())then
- if not(Pigcountdb)or not(Locationdb)then
- plr:SendBroadcastMessage("You cannot do that in this area.")
- elseif(Locationdb)then
- Loc = Locationdb:GetColumn(0):GetLong()
- Pigs = Pigcountdb:GetColumn(0):GetShort()
- if(Pigs==10)then
- plr:SendBroadcastMessage("You can only have 10 pigs per area.")
- elseif(Pigs<=9)then
- plr:SpawnCreature(PIGID, plr:GetX(), plr:GetY(),plr:GetZ(), plr:GetO(), 35, 0, 0, 0, 0, 1, 1)
- WorldDBQuery("UPDATE Guild_House.zones SET `pig_count` = `pig_count`+'1' Where `entry` = '"..Loc.."';");
- WorldDBQuery("UPDATE Guild_House.guilds SET `pig_count` = `pig_count`+'1' Where `guild` = '"..plr:GetGuildName().."';");
- end
- return false;
- end
- end
- elseif(plr:IsInGuild()==nil)then
- plr:SendBroadcastMessage("test")
- end
- return false;
- end
- end
- RegisterServerHook(16, "Buypigs")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement