--[[
by Heavy / Dark Soul (6681)
» Changelog
-- 1.4.1--
Building didn't work when fastbuild was disabled
-- 1.4 --
Almost whole code. It's much shorter now (Thanks to Blazzingxx)
-- 1.3 --
Disabling/Enabling money didn't work because of the last update (1.2)
Metaclasses (or how they are called)
return 0 instead of spawnobject for mines
shorter variables (unlimitedbuild->unlimited; fastbuild->fast..)
-- 1.2 --
Make Lasermines working
Using true+false instead of 0+1
Clean ups and stuff
-- 1.1 --
disabling/enabling money
mines didn't work
building sometimes didn't work (if this still doesn't work ,try disabling other buildingluascripts)
you weren't able to see whose building it is/was
code cleaned up a bit]]
addhook("build","ub.fastbuild")
ub={}
ub.cfg = {}
-- configuration
ub.cfg.fast=true
ub.cfg.unlimited=true
ub.cfg.money=true
-- END configuration
ub.building = {}
ub.building.names = {"Barricade","Barbed Wire","Wall I","Wall II","Wall III","Gate Field","Turret","Dispenser","Supply",[13] = "Teleporter Entrance",[14] = "Teleporter Exit"}
ub.building.money = {300,500,1000,2000,3000,1500,5000,5000,5000,[13] = 3000,[14] = 3000}
function ub.spawnobject(id,type,x,y)
parse("spawnobject "..type.." "..x.." "..y.." 0 0 "..player(id,"team").." "..id)
end
function ub.submoney(id,mmoney)
if(ub.cfg.money==true) then
parse("setmoney "..id.." "..player(id,"money")-mmoney)
end
end
function ub.fastbuild(id,type,x,y)
if (ub.cfg.fast==true) then
if(ub.building.names[type] and player(id,"money")>=ub.building.money[type]) then
ub.spawnobject(id,type,x,y)
ub.submoney(id,ub.building.money[type])
elseif (type== 20 or type==21) then
return 0
end
return 1
else
return 0
end
end
if (ub.cfg.unlimited==true) then
local k,v
for k, v in ipairs(ub.building.names) do
parse(string.format([[mp_building_limit "%s" "%s"]],v,100000))
end
end