diff options
| author | Scott <scotth0828@gmail.com> | 2016-05-08 21:02:06 -0400 |
|---|---|---|
| committer | Scott <scotth0828@gmail.com> | 2016-05-08 21:02:06 -0400 |
| commit | f19c2a5a763e71aeadd30d934a4c095dfbb639e1 (patch) | |
| tree | 82bdd8b2da5b23e4fa3bad269caceacdb026512d | |
| parent | f529fc47c87ce254aad2c0506259b9d7521d3512 (diff) | |
| download | gmstranded-f19c2a5a763e71aeadd30d934a4c095dfbb639e1.tar.gz gmstranded-f19c2a5a763e71aeadd30d934a4c095dfbb639e1.tar.bz2 gmstranded-f19c2a5a763e71aeadd30d934a4c095dfbb639e1.zip | |
Added timer to gravestone
| -rw-r--r-- | entities/entities/gms_gravestone.lua | 40 | ||||
| -rw-r--r-- | gamemode/configure_me.lua | 20 |
2 files changed, 54 insertions, 6 deletions
diff --git a/entities/entities/gms_gravestone.lua b/entities/entities/gms_gravestone.lua index 76f46f0..3037e47 100644 --- a/entities/entities/gms_gravestone.lua +++ b/entities/entities/gms_gravestone.lua @@ -12,16 +12,31 @@ ENT.Model = "models/props_c17/gravestone004a.mdl" ENT.deathResources = {} ENT.deathWeapons = {} +local defaultRemoveTime = 120 // 2 minutes + + function ENT:OnInitialize() + self:SetNetworkedInt("removeTime", defaultRemoveTime) + + if (CLIENT) then + for k,v in pairs(GMS.graveTime) do + + if (LocalPlayer():IsUserGroup("Test")) then + self:SetNetworkedInt("removeTime", v['time']) + end + + end - self:SetMoveType( MOVETYPE_NONE ) + end + self:SetMoveType( MOVETYPE_NONE ) end function ENT:SetupDataTables() self:NetworkVar( "String", 0, "plName" ) + self:NetworkVar( "Int", 1, "removeTime" ) end @@ -46,8 +61,7 @@ if ( CLIENT ) then outline = true, } ) - - + function ENT:Draw() self:DrawModel() @@ -63,9 +77,16 @@ if ( CLIENT ) then local plName = self:GetplName() cam.Start3D2D(position + offset, angles, 0.1); + + rmTime = self:GetNetworkedInt("removeTime") + minutes = math.floor(rmTime/60) + seconds = rmTime - (minutes*60) + if (seconds < 10) then seconds = "0"..seconds end - draw.SimpleText(plName, "GraveFont", 80.5, 46, Color(255, 255, 255, 255), 1, 1); - + draw.SimpleText(plName, "GraveFont", 80.5, 40, Color(255, 255, 255, 255), 1, 1); + draw.SimpleText(minutes..":"..seconds, "GraveFont", 80.5, 105, Color(255, 255, 255, 255), 1, 1); + + cam.End3D2D(); end @@ -83,9 +104,16 @@ end if ( SERVER ) then function ENT:Think() - if (table.Count(self.deathWeapons) == 0 and table.Count(self.deathResources) == 0) then + if ((table.Count(self.deathWeapons) == 0 and table.Count(self.deathResources) == 0) || self:GetNetworkedInt("removeTime") == 0) then self:Remove() end + + self:SetNetworkedInt("removeTime", self:GetNetworkedInt("removeTime")-1) + + + self:NextThink( CurTime() + 1 ) + return true -- Note: You need to return true to override the default next think timew + end end diff --git a/gamemode/configure_me.lua b/gamemode/configure_me.lua index c813a26..7deb922 100644 --- a/gamemode/configure_me.lua +++ b/gamemode/configure_me.lua @@ -17,6 +17,26 @@ if (GMS == nil) then GMS = {} end //max:32 GMS.NETINT_BITCOUNT = 16 +// default set to 2 minutes +// time in seconds + +GMS.graveTime = { + + { + + rank = "user", + time = "120", + + }, + { + + rank = "owner", + time = "240", + + }, + +} + //NPC's that drop loot balls GMS.LootableNPCs = { "npc_antlion", |
