PivityGmodStore

Functions

There are functions to give and take medals.

Giving medal

CH_Medals.GiveMedal( ply, target_sid64, medal )

Taking medal

CH_Medals.TakeMedal( ply, target_sid64, medal )

Explanation

ply = the player giving the medal (put as nil if console)
target_sid64 = who do you want to give this medal to)
medal = the medal key for example medal_bitcoin from default config

Use-case example

In this code example I will show how to give a medal to a player after they have played continuously on the server for 24 hours without leaving.

local function CH_Medals_24hourMedal( ply )
-- Create a timer for 24 hours
timer.Simple( 86400, function()
-- Check they are still here when the timer runs out
if not IsValid( ply ) then
return
end
-- They are still on the server after 24 hours, so give the medal
-- Change medal_24hourmedalname to your own medal name!
CH_Medals.GiveMedal( nil, ply:SteamID64(), "medal_24hourmedalname" )
end )
end
hook.Add( "PlayerInitialSpawn", "CH_Medals_24hourMedal", CH_Medals_24hourMedal )

Can't find what you're looking for?

Contact support