Created
August 22, 2018 23:55
-
-
Save Beyley/056ce8593d7b6460e7b045e56f522aa7 to your computer and use it in GitHub Desktop.
My GMOD gamemode Knife Fight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include( "shared.lua" ) | |
function killcounter() | |
draw.WordBox( 8, ScrW() - 920, ScrH() - 98, "KillCount: "..LocalPlayer():GetNWInt("killcounter"),"ScoreboardText",Color(200,0,0,0),Color(255,255,255,255)) | |
end | |
hook.Add("HUDPaint","KillCounter",killcounter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddCSLuaFile( "cl_init.lua" ) | |
AddCSLuaFile( "shared.lua" ) | |
include( "shared.lua" ) | |
function KillCounter( victim, weapon, killer ) --Sets up a new function called KillCounter | |
if killer:GetNWInt("killcounter") == 100000 then --If the killcounter variable equals 100000 then do something | |
PrintMessage(HUD_PRINTTALK, "Player" .. killer:GetName() .. "Has Won") --When the killcounter equals 50 it will print this "Player <playername> has won | |
timer.Simple(3, function() --Sets up a timer for three seconds | |
game.ConsoleCommand("changelevel " ..table.Random(maps).. "\n") --When the timer finishes it excecutes this console command | |
end) | |
end | |
killer:SetNWInt("killcounter", killer:GetNWInt("killcounter") + 1) --Adds 1 everytime an NPC is killed. | |
end | |
hook.Add("PlayerDeath","KillCounter", KillCounter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment