Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Purify ( strng )
- if (string.find(tostring(strng), [[%"]])) then
- strng = " "
- end
- if (string.find(tostring(strng), [[\n]])) then
- strng = " "
- end
- return strng
- end
- function Upgrade(ply, args)
- args = Purify(args)
- if( args != "" ) then return ""; end
- local trace = { }
- trace.start = ply:EyePos();
- trace.endpos = trace.start + ply:GetAimVector() * 150;
- trace.filter = ply;
- local tr = util.TraceLine( trace );
- if (!IsValid(tr.Entity)) then
- return "";
- end
- local targent = tr.Entity
- if (targent:GetClass()!="auto_turret" && targent:GetClass()!="money_printer_admin" && targent:GetClass()!="money_printer_superquantum" && targent:GetClass()!="dispenser" && targent:GetClass()!="supplytable" && targent:GetClass()!="drugfactory" && targent:GetClass()!="drug_lab" && targent:GetClass()!="still_average" && targent:GetClass()!="money_printer_tin" && targent:GetClass()!="money_printer_bronze" && targent:GetClass()!="money_printer_iron" && targent:GetClass()!="money_printer_copper" && targent:GetClass()!="money_printer_silver" && targent:GetClass()!="money_printer_gold" && targent:GetClass()!="money_printer_sapphire" && targent:GetClass()!="money_printer_emerald" && targent:GetClass()!="money_printer_pearl" && targent:GetClass()!="money_printer_ruby" && targent:GetClass()!="money_printer_platinum" && targent:GetClass()!="money_printer_diamond" && targent:GetClass()!="money_printer_depleteduranium" && targent:GetClass()!="money_printer_nuclear" && targent:GetClass()!="money_printer_nova" && targent:GetClass()!="money_printer_supernova" && targent:GetClass()!="radartower" && targent:GetClass()!="gunfactory" && targent:GetClass()!="weedplant" && targent:GetClass()!="meth_lab" && targent:GetClass()!="meth_lab_stable" && targent:GetClass()!="microwave") && targent:GetClass()!="money_printer_nextgeneration" && targent:GetClass()!="money_printer_quantum" && targent:GetClass()!="money_printer_tridium" && targent:GetClass()!="money_printer_antimatter"then
- Notify(ply,4,3,"This cannot be upgraded.")
- ply:ConCommand( "play buttons/button10.wav" )
- return "" ;
- end
- if not (targent.Owner) then
- Notify( ply, 4, 3, "You do not own this Structure!" );
- ply:ConCommand( "play buttons/button10.wav" )
- return "" ;
- end
- local lvl = targent:GetNWInt("upgrade") + 1
- if (lvl>2 and targent:GetClass()!="supplytable" and targent:GetClass()!="drug_lab" and targent:GetClass()!="drugfactory" and targent:GetClass()!="money_printer_tin" and targent:GetClass()!="money_printer_copper" and targent:GetClass()!="money_printer_bronze" and targent:GetClass()!="money_printer_iron" and targent:GetClass()!="money_printer_silver" and targent:GetClass()!="money_printer_gold" and targent:GetClass()!="money_printer_sapphire" and targent:GetClass()!="money_printer_emerald" and targent:GetClass()!="money_printer_pearl" and targent:GetClass()!="money_printer_ruby" and targent:GetClass()!="money_printer_platinum" and targent:GetClass()!="money_printer_diamond" and targent:GetClass()!="money_printer_depleteduranium" and targent:GetClass()!="money_printer_nuclear" and targent:GetClass()!="money_printer_nova" and targent:GetClass()!="auto_turret" and targent:GetClass()!="gunfactory" and targent:GetClass()!="dispenser" and targent:GetClass()!="weedplant" and targent:GetClass()!="microwave" and targent:GetClass()!="money_printer_supernova" and targent:GetClass()!="meth_lab_stable" and targent:GetClass()!="meth_lab" and targent:GetClass()!="money_printer_superquantum" and targent:GetClass()!="money_printer_nextgeneration" and targent:GetClass()!="money_printer_quantum" and targent:GetClass()!="money_printer_tridium" and targent:GetClass()!="money_printer_antimatter") then Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>2 and targent:GetClass()=="weedplant" ) then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>3 and targent:GetClass()=="drugfactory" ) then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>3 and targent:GetClass()=="supplytable" ) then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>4 and targent:GetClass()=="gunfactory" ) then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_tin") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_copper") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_bronze") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_iron") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_silver") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_gold") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_sapphire") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_emerald") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_pearl") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_ruby") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_platinum") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_diamond") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_depleteduranium") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_nuclear") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_nova") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_supernova") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_quantum") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_superquantum") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_nextgeneration") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_tridium") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_antimatter") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>10 and targent:GetClass()=="money_printer_admin") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>5 and targent:GetClass()=="auto_turret") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>5 and targent:GetClass()=="meth_lab_stable") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>5 and targent:GetClass()=="meth_lab") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>7 and targent:GetClass()=="dispenser") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>7 and targent:GetClass()=="drug_lab") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- if (lvl>8 and targent:GetClass()=="microwave") then
- Notify(ply, 4, 3, "This is already fully upgraded.")
- return "" ;
- end
- local price = 0
- if targent:GetClass()== "auto_turret" then price = CfgVars["turretcost"]
- elseif targent:GetClass()== "health_dispenser" then price = CfgVars["healthdispensercost"]
- elseif targent:GetClass()== "dispenser" then price = CfgVars["dispensercost"]
- elseif targent:GetClass()== "microwave" then price = CfgVars["microwavecost"]
- elseif targent:GetClass()== "drugfactory" then price = CfgVars["drugfactorycost"]
- elseif targent:GetClass()== "drug_lab" then price = CfgVars["druglabcost"]
- elseif targent:GetClass()== "still_average" then price = CfgVars["stillcost"]
- elseif targent:GetClass()== "money_printer_tin" then price = CfgVars["tinprintercost"]
- elseif targent:GetClass()== "money_printer_copper" then price = CfgVars["copperprintercost"]
- elseif targent:GetClass()== "money_printer_bronze" then price = CfgVars["bronzeprintercost"]
- elseif targent:GetClass()== "money_printer_iron" then price = CfgVars["bronzeprintercost"]
- elseif targent:GetClass()== "money_printer_silver" then price = CfgVars["silverprintercost"]
- elseif targent:GetClass()== "money_printer_gold" then price = CfgVars["goldprintercost"]
- elseif targent:GetClass()== "money_printer_sapphire" then price = CfgVars["sapphireprintercost"]
- elseif targent:GetClass()== "money_printer_emerald" then price = CfgVars["emeraldprintercost"]
- elseif targent:GetClass()== "money_printer_pearl" then price = CfgVars["pearlprintercost"]
- elseif targent:GetClass()== "money_printer_ruby" then price = CfgVars["rubyprintercost"]
- elseif targent:GetClass()== "money_printer_platinum" then price = CfgVars["platinumprintercost"]
- elseif targent:GetClass()== "money_printer_depleteduranium" then price = CfgVars["duprintercost"]
- elseif targent:GetClass()== "money_printer_nuclear" then price = CfgVars["nukeprintercost"]
- elseif targent:GetClass()== "money_printer_nova" then price = CfgVars["novaprintercost"]
- elseif targent:GetClass()== "money_printer_supernova" then price = CfgVars["supernovaprintercost"]
- elseif targent:GetClass()== "money_printer_diamond" then price = CfgVars["diamondprintercost"]
- elseif targent:GetClass()== "money_printer_quantum" then price = CfgVars["quantumprintercost"]
- elseif targent:GetClass()== "money_printer_superquantum" then price = CfgVars["superquantumprintercost"]
- elseif targent:GetClass()== "money_printer_nextgeneration" then price = CfgVars["nextgenerationprintercost"]
- elseif targent:GetClass()== "money_printer_tridium" then price = CfgVars["tridiumprintercost"]
- elseif targent:GetClass()== "money_printer_antimatter" then price = CfgVars["antimatterprintercost"]
- elseif targent:GetClass()== "money_printer_admin" then price = CfgVars["adminprintercost"]
- elseif targent:GetClass()== "meth_lab" then price = CfgVars["methlabcost"]
- elseif targent:GetClass()== "meth_lab_stable" then price = CfgVars["metlabstable"]
- elseif targent:GetClass()== "radartower" then price = CfgVars["radartowercost"]
- elseif targent:GetClass()== "weedplant" then price = CfgVars["weedplantcost"]
- elseif targent:GetClass()== "gunfactory" then price = CfgVars["gunfactorycost"]
- elseif targent:GetClass()== "supplytable" then price = CfgVars["supplytablecost"]
- end
- price = price*CfgVars["upgradecost"]
- if (lvl==10) then price = price*960 end
- if (lvl==9) then price = price*480 end
- if (lvl==8) then price = price*240 end
- if (lvl==7) then price = price*120 end
- if (lvl==6) then price = price*60 end
- if (lvl==5) then price = price*30 end
- if (lvl==4) then price = price*12 end
- if (lvl==3) then price = price*6 end
- if (lvl==2) then price = price*3 end
- if ply:GetUserGroup() == "silver_donor" then
- price = price * 0.9
- elseif ply:GetUserGroup() == "gold_donor" then
- price = price * 0.8
- elseif ply:GetUserGroup() == "diamond_donor" then
- price = price * 0.7
- elseif ply:GetUserGroup() == "superadmin" then
- price = price * 0.6
- end
- if GetMoney( ply ) <=(price) then
- Notify(ply, 4, 3, "Cannot afford this. Cost is $" .. price)
- ply:ConCommand( "play buttons/button10.wav" )
- return "" ;
- end
- AddMoney( ply, price*-1)
- Notify( ply, 0, 3, "Applying level " .. lvl .. " upgrade.")
- targent:SetNWInt("upgrade", lvl)
- ply:ConCommand( "play buttons/button4.wav" )
- return "";
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement