Credits

I know that this is possible, but I couldn’t find any information on how to do it anywhere. How would I go about changing the credit prices of traitor store items?

Anyone able to help?

I just read this on http://ttt.badking.net/custom-weapon-guide. But it sound like its the person who wrote it that dont want it and not that its not possible. Well I have never seen a weapon cost more then 1 credit but maybe you have?? anyway this is whats written:

I dont know if that help what so ever and you allowed to correct me because im actually intrested in this aswell :D…

I hope you will find what you seek :3

Ps. if you find out anything usefull then dont hesitate to share your result :slight_smile:

EDIT:

We are somehow connected, brother.

I just wrote that?? :stuck_out_tongue:

Edit: Yeah :wink:

Thanks for trying to help, I appreciate it. If anyone knows anything about this, please tell me.

Go to line 342 in weaponry.lua in the terrortown gamemode files. That’s where ordering equipment is handled so try poking around in there if you’re familiar with lua at all. I think I could do it, just from taking a quick look, but I have no interest in it.

Lua Code

This Is A Way Two Edit A Weapon In Lua So That
It Takes Two Credits TO Buy And Use A Weapon…

Its Sorta Common Sense But It Does Work Perfectly
I Made This When I Used To Have A Server

Why on earth did you capitalize every single word in that sentence…

Your welcome, because this was so easy to do but you guys were just looking in the wrong places :wink:

terrotown/gamemode/weaponry.lua

Find a function called OrderEquipment

straight after


   local swep_table = (not is_item) and weapons.GetStored(id) or nil

, add


	if (swep_table) then
		if (ply:GetCredits() < (swep_table.Cost or 1)) then
			return ply:PrintMessage( HUD_PRINTTALK, "You require ".. swep_table.Cost - ply:GetCredits() .." more credit(s) to buy this!")
		end
	else
		if (ply:GetCredits() < 1) then 
			return
		end
   end


also find the line


if received then

, after that line there’s a line which is


 ply:SubtractCredits(1)

replace the ply:SubtractCredits(1) with


	if (swep_table) then
      ply:SubtractCredits((swep_table.Cost or 1))
	else
	  ply:SubtractCredits(1)
	end

for every swep you want to cost more than 1 credit, add


SWEP.Cost = <number>

to it. Tested. Should work. If you have any problems, post here.

This might work, however do to circumstances I think my way is way easier and is to the point.

“might”
also, your’s must disable limited stock. Mine doesnt. It can cause a big difference in some weapons, such as the knife. Imagine if a server had a 1 hit knife, and it wasnt limited stock. rip the whole server

Never thought of it that way, I wasn’t trying to disprove your code.
I was just pointing out that most people need a code like mine for
overpowered weapons such as the defibrillator and cloak and maybe
mines. I felt that’s what most people were trying to use it for