TTT Extra Credit for some Rank and buy Credit in Pointshop


is there a code for getting an extra Credit as for example superadmin or donator and is there a code, so you can buy a credit in the pointshop?

Thank you!


Dump this in lua/autorun/server:
– Modify these as you want, the groupname on the left and the amount of credits they should be given on the right, follow the format
local addCredits = {
[“superadmin”] = 3
[“admin”] = 2
[“VIP”] = 1

hook.Add( “TTTBeginRound”, “AddCredits”, function()

for k, v in pairs( player.GetAll() ) do
	if ( v:GetTraitor() or v:GetDetective() ) and addCredits[v:GetNWString( "usergroup" )] then
		v:AddCredits( addCredits[v:GetNWString( "usergroup" )] )



end )[/lua]
The pointshop item should go in addons/pointshop/lua/items/powerups:
[lua]ITEM.Name = ‘Role Credit’
ITEM.Price = 1000
ITEM.Material = ‘VGUI/ttt/sprite_traitor.vmt’
ITEM.SingleUse = true

function ITEM:OnEquip(ply, modifications)
ply:AddCredits( 1 )

function ITEM:OnHolster(ply)
Name the files whatever you want.

thank you for your help, but both scripts dont work for me.
The first script dont add credits and the second also dont add credits.
I have no errors or so.

The scripts are fine, you’re doing something wrong.
Do you have the usergroups set?

What are you trying to achieve? When do you want points added ( When a player is killed, points to attacker? Multiplier based on rank??? Points over time increased for ranks? )? How do you want them added ( console command, item for admins, what )?

I want them added immediately, when they are detective/traitor.

Ok are you talking about a pointshop where you buy hats and trails, or are you talking about the credits for weapons / equipment?

You could use the convars to set how many credits traitor / detective starts with:



Alternatively, you could modify this function:
[lua]function plymeta:SetDefaultCredits()
if self:GetTraitor() then
local c = GetConVarNumber(“ttt_credits_starting”)
if CountTraitors() == 1 then
c = c + GetConVarNumber(“ttt_credits_alonebonus”)
elseif self:GetDetective() then

inside player_ext.lua

and give more / less based on group, admin, whatever.

I mean the script for the pointshop, where you can buy a credit and a script, where people with a special rank starts with more credits.

Credits are used in TTT for traitor / detective to buy things like the knife, health station, radar, etc.

pointshop is where you can buy hats, trails and other visual stuff like that. pointshop uses points to buy things, not TTT credits. I have never heard of buying a script on pointshop… You can create a script to exchange points for TTT credits which is the second Lua snippet Internet1001 showed you. You can code something to give certain players points when the round starts; Internet1001 showed you that in the first snippet. He created working examples for you, you’d only have to copy/paste them.

Can you show us some code you’ve worked on and where you’re having problems? Or can you be more specific in what you’re asking please?


Adapt it to a pointshopitem.