diff options
Diffstat (limited to 'ftp_gmstranded/gamemode')
| -rw-r--r-- | ftp_gmstranded/gamemode/cl_panels.lua | 32 | ||||
| -rw-r--r-- | ftp_gmstranded/gamemode/init.lua | 173 |
2 files changed, 104 insertions, 101 deletions
diff --git a/ftp_gmstranded/gamemode/cl_panels.lua b/ftp_gmstranded/gamemode/cl_panels.lua index da01d3c..4a1f85d 100644 --- a/ftp_gmstranded/gamemode/cl_panels.lua +++ b/ftp_gmstranded/gamemode/cl_panels.lua @@ -1,5 +1,5 @@ -surface.CreateFont( "DefaultBold", { +surface.CreateFont( "DefaultBold", { font = "Tahoma", size = 16, weight = 1000, @@ -7,7 +7,7 @@ surface.CreateFont( "DefaultBold", { additive = false } ) -surface.CreateFont( "GMSUnlockDescription", { +surface.CreateFont( "GMSUnlockDescription", { font = "Tahoma", size = 14, weight = 500, @@ -209,7 +209,7 @@ function PANEL:Paint() surface.DrawLine( self:GetWide() - 1, 0, self:GetWide() - 1, self:GetTall() ) -- Nice line instead of messy outlined rect surface.DrawLine( 0, self:GetTall() - 1, self:GetWide(), self:GetTall() - 1 ) surface.DrawLine( 0, 0, 0, self:GetTall() ) - if ( self.Extended ) then + if ( self.Extended ) then surface.DrawLine( 0, 33, self:GetWide(), 33 ) end @@ -236,8 +236,8 @@ function PANEL:RefreshSkills() if ( !self.Extended ) then lbl:SetVisible( false ) end end - if ( self.Extended ) then - self:SetSize( ScrW() / 6, 40 + ( table.Count( self.SkillLabels ) * 21 ) ) + if ( self.Extended ) then + self:SetSize( ScrW() / 6, 40 + ( table.Count( self.SkillLabels ) * 21 ) ) end end @@ -351,9 +351,9 @@ function PANEL:RefreshResources() if ( !self.Extended ) then lbl:SetVisible( false ) end end end - + self.Line = self.Line + 21 - + local lblT = vgui.Create( "gms_ResourcePanelTotal", self ) lblT:SetPos( 0, self.Line ) lblT:SetSize( self:GetWide(), 16 ) @@ -362,10 +362,10 @@ function PANEL:RefreshResources() table.insert( self.ResourceLabels, lblT ) if ( !self.Extended ) then lblT:SetVisible( false ) end - if ( self.Extended ) then - self:SetSize( ScrW() / 6, 40 + ( ( table.Count( self.ResourceLabels ) + 1 ) * 21 ) ) + if ( self.Extended ) then + self:SetSize( ScrW() / 6, 40 + ( ( table.Count( self.ResourceLabels ) + 1 ) * 21 ) ) end - + if ( GAMEMODE.CommandsHud ) then GAMEMODE.CommandsHud:SetPos( ScrW() / 6 + 2, self:GetTall() ) end end @@ -602,8 +602,8 @@ function PANEL:RefreshCommands() local line7b = self:CreateButton( halfsize, self.Line, threesize, 16, "gms_tribes", "Join", Color( 200, 0, 200, 176 ) ) local line7c = self:CreateButton( halfsize + threesize, self.Line, threesize, 16, "gms_leave", "Leave", Color( 200, 0, 200, 176 ) ) - if ( self.Extended ) then - self:SetSize( ScrW() / 6, 40 + ( self.Lines * 21 ) ) + if ( self.Extended ) then + self:SetSize( ScrW() / 6, 40 + ( self.Lines * 21 ) ) end end @@ -840,6 +840,8 @@ function PANEL:Init() local combi = p.CombiGroupName or "" local active = p.ActiveCombi or "" p:Close() + print("Doing") + print("gms_MakeCombination " .. combi .. " " .. active .. "\n") LocalPlayer():ConCommand( "gms_MakeCombination " .. combi .. " " .. active .. "\n" ) end @@ -872,7 +874,7 @@ function PANEL:SetActive( combi, tbl ) if ( tbl.Req or tbl.SkillReq ) then desc = desc .. "\n\nYou need:" end - + if ( tbl.Req and table.Count( tbl.Req ) > 0 ) then for res, num in pairs( tbl.Req ) do if ( tbl.AllSmelt ) then @@ -898,7 +900,7 @@ end function PANEL:ClearActive() self.ActiveCombi = nil - self.ActiveTable = nil + self.ActiveTable = nil self.Info.NameLabel:SetText( "Select a recipe" ) self.Info.DescLabel:SetText( "" ) end @@ -1155,4 +1157,4 @@ function PANEL:SetRes( str, num, isAll ) self.IsAll = isAll end -vgui.Register( "gms_StoreButton", PANEL, "DButton" )
\ No newline at end of file +vgui.Register( "gms_StoreButton", PANEL, "DButton" ) diff --git a/ftp_gmstranded/gamemode/init.lua b/ftp_gmstranded/gamemode/init.lua index 5426d99..4051ca6 100644 --- a/ftp_gmstranded/gamemode/init.lua +++ b/ftp_gmstranded/gamemode/init.lua @@ -59,12 +59,12 @@ Vector( 2804.810303, 12146.677734, -9125.259766 ), GM.TreeSpawns = {} -GM.TreeSpawns[ "gms_coastal_outlands" ] = { +GM.TreeSpawns[ "gms_coastal_outlands" ] = { // The third coordinate is the height coordinate -// Always subtract 70 to the height coord if it is positive so that the tree will be touching the floor +// Always subtract 70 to the height coord if it is positive so that the tree will be touching the floor -Vector( 1462.160522, -3664.370361, -10941.564453 ), +Vector( 1462.160522, -3664.370361, -10941.564453 ), Vector( 3718.633545, -1710.644409, -11269.974609 ), Vector( 3159.402588, 145.593597, -11045.797852 ), Vector( 2519.847168, -547.534180, -11161.646484 ), @@ -112,16 +112,16 @@ net.Receive('givePlayerWeapon', function(len, ply) local wepSlot = net.ReadInt(32) local weptbl = ply:GetEyeTrace().Entity.deathWeapons table.remove(weptbl, wepSlot) - + ply:Give(wepToGive) - - - + + + end) --Give player resource from grave net.Receive('givePlayerResource', function(len, ply) - + local ResToGive = net.ReadString() local Amount = net.ReadInt(32) local resSlot = net.ReadInt(32) @@ -129,19 +129,19 @@ net.Receive('givePlayerResource', function(len, ply) local tbl1 = string.Split(restbl[resSlot], " ") local tbl2 = string.Split(tbl1[2], "x") local amt = tbl2[2] - + ply:IncResource( ResToGive, Amount ) - + if (amt - Amount <= 0) then - + table.remove(restbl, resSlot) else amt = amt - Amount restbl[resSlot] = tbl1[1] .. " x" .. amt - + end - - + + end) -- Custom anlion barrow auto placement @@ -154,12 +154,12 @@ hook.Add( "InitPostEntity", "gms_custom_antspawns", function() ent.GMSAutoSpawned = true ent:SetNetworkedString( "Owner", "World" ) end - + end ) -- Custom tree auto placement hook.Add( "InitPostEntity", "gms_custom_treespawns", function() - + if ( !GAMEMODE.TreeSpawns[ game.GetMap() ] ) then return end for id, pos in pairs( GAMEMODE.TreeSpawns[ game.GetMap() ] ) do local ent = ents.Create( "gms_tree" ) @@ -343,7 +343,7 @@ end function PlayerMeta:SetResource( resource, int ) resource = string.Capitalize( resource ) if ( !self.Resources[resource] ) then self.Resources[resource] = 0 end - + self.Resources[resource] = int @@ -391,7 +391,7 @@ function PlayerMeta:DecResource( resource, int ) self.Power = math.min( self.Power, maxPow ) self:UpdateNeeds() end - + umsg.Start( "gms_SetResource", self ) umsg.String( resource ) umsg.Short( self:GetResource( resource ) ) @@ -692,7 +692,7 @@ function PlayerMeta:Sleep() if ( !tr.HitWorld and !tr.HitNonWorld ) then self.NeedShelter = true end - + self:EmitSound( "stranded/start_sleeping.wav" ) end @@ -1082,7 +1082,7 @@ concommand.Add( "gms_admin_populatearea", function( ply, cmd, args ) local info = {} info.Amount = Amount - if ( Amount > 200 ) then + if ( Amount > 200 ) then ply:SendMessage( "Auto-capped at 200 props.", 3, Color( 200, 0, 0, 255 ) ) info.Amount = 200 end @@ -1226,7 +1226,7 @@ function GM.ADropResource( ply, cmd, args ) if ( tonumber( args[2] ) <= 0 ) then ply:SendMessage( "No zeros/negatives!", 3, Color( 200, 0, 0, 255 ) ) return end local int = tonumber( args[2] ) - local Type = args[1] + local Type = args[1] ply:DropResource( Type, int ) ply:SendMessage( "Dropped " .. string.Replace( Type, "_", " " ) .. " ( " .. int .. "x )", 3, Color( 10, 200, 10, 255 ) ) @@ -1288,9 +1288,9 @@ concommand.Add( "gms_steal", function( ply, cmd, args ) end ) function GM.PlantMelon( ply, cmd, args ) - if ( ply:GetNWInt( "plants" ) >= GetConVarNumber( "gms_PlantLimit" ) ) then + if ( ply:GetNWInt( "plants" ) >= GetConVarNumber( "gms_PlantLimit" ) ) then ply:SendMessage( "You have hit the plant limit.", 3, Color( 200, 0, 0, 255 ) ) - return + return end local tr = ply:TraceFromEyes( 150 ) @@ -1433,7 +1433,7 @@ function GM.PlantTree( ply, cmd, args ) if ( !ply:HasUnlock( "Sprout_Planting" ) ) then ply:SendMessage( "You need more planting skill.", 3, Color( 200, 0, 0, 255 ) ) return end local tr = ply:TraceFromEyes( 150 ) - if ( tr.HitWorld ) then + if ( tr.HitWorld ) then if ( ( tr.MatType == MAT_DIRT or tr.MatType == MAT_GRASS or tr.MatType == MAT_SAND ) and !GMS.IsInWater( tr.HitPos ) ) then if ( ply:GetResource( "Sprouts" ) >= 1 ) then ply:DoProcess( "PlantTree", 5, { Pos = tr.HitPos } ) @@ -1544,7 +1544,7 @@ function GM.TakeResource( ply, cmd, args ) if ( totake >= num ) then totake = num end if ( room < totake ) then totake = room end ent.Resources[ res ] = num - totake - ent:SetResPackInfo( res, ent.Resources[ res ] ) + ent:SetResPackInfo( res, ent.Resources[ res ] ) if ( ent.Resources[ res ] <= 0 ) then ent.Resources[ res ] = nil end ply:IncResource( res, totake ) @@ -1559,7 +1559,7 @@ function GM.TakeResource( ply, cmd, args ) for res, num in pairs( ent.Resources ) do if ( res == args[ 1 ] ) then ent.Resources[ res ] = num - 1 - ent:SetResPackInfo( res, ent.Resources[ res ] ) + ent:SetResPackInfo( res, ent.Resources[ res ] ) if ( ent.Resources[ res ] <= 0 ) then ent.Resources[ res ] = nil end local food = ents.Create( "gms_food" ) @@ -1569,7 +1569,7 @@ function GM.TakeResource( ply, cmd, args ) food.Name = res food:Spawn() food:SetFoodInfo( res ) - + timer.Simple( 300, function( food ) if ( IsValid( food ) ) then food:Fadeout( 2 ) end end, food ) end end @@ -1586,6 +1586,7 @@ concommand.Add( "gms_combinations", function( ply ) end ) concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) + print("Concommand called with group:" .. args[1] .. " and combi " .. args[2]) if ( !args[1] or !args[2] ) then ply:SendMessage( "Please specify a valid combination.", 3, Color( 255, 255, 255, 255 ) ) return end local group = args[1] @@ -1673,7 +1674,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.3 if ( tbl.SwepClass != nil ) then @@ -1696,14 +1697,14 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.3 local smelt = false for r,n in pairs( data.Res ) do if ( r == "Iron" or r == "Copper" ) then smelt = true end end - + if ( tbl.SwepClass != nil ) then data.Class = tbl.SwepClass ply:DoProcess( "MakeWeapon", time, data ) @@ -1718,7 +1719,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) data.Name = tbl.Name data.Class = tbl.SwepClass data.Cost = table.Copy( tbl.Req ) - + local time = 10 if ( ply:GetActiveWeapon():GetClass() == "gms_wrench" ) then time = 7 end time = math.max( time - math.floor( math.max( ply:GetSkill( "Weapon_Crafting" ) - 8, 0 ) / 4 ), 4 ) @@ -1766,8 +1767,8 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end - + end + local time = timecount * 0.5 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.25, 2 ) ) @@ -1786,7 +1787,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.6 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.3, 2 ) ) @@ -1805,7 +1806,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.7 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.35, 2 ) ) @@ -1824,7 +1825,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.7 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.35, 2 ) ) @@ -1843,7 +1844,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.7 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.35, 2 ) ) @@ -1862,7 +1863,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.7 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.35, 2 ) ) @@ -1881,7 +1882,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.1 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.35, 2 ) ) @@ -1900,12 +1901,12 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.5 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.35, 2 ) ) - - + + ply:DoProcess( "Smelt", time, data ) elseif ( group == "gms_mithrilfactory") then local data = {} @@ -1921,15 +1922,15 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.2 time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * 0.20, 2 ) ) - - - - - - + + + + + + ply:DoProcess( "Smelt", time, data ) elseif ( group == "gms_grindingstone" ) then local data = {} @@ -1940,7 +1941,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) for r, n in pairs( sourcetable.Results ) do if ( r == "Flour" ) then sourcetable.Results[r] = math.floor( n * 0.6 ) end end - + data.Res = sourcetable.Results data.Cost = table.Copy( sourcetable.Req ) else @@ -1950,7 +1951,7 @@ concommand.Add( "gms_MakeCombination", function( ply, cmd, args ) local timecount = 1 for k, v in pairs( data.Cost ) do timecount = timecount + v - end + end local time = timecount * 0.75 ply:DoProcess( "Crush", time, data ) @@ -2056,7 +2057,7 @@ function GM:PlayerInitialSpawn( ply ) for k, v in pairs( tbl["experience"] ) do ply:SetXP( k, v ) end end - /*if ( tbl["unlocks"] ) then + /*if ( tbl["unlocks"] ) then for k, v in pairs( tbl["unlocks"] ) do ply.FeatureUnlocks[ k ] = v end end*/ @@ -2101,7 +2102,7 @@ function GM:PlayerInitialSpawn( ply ) umsg.Short( id ) umsg.String( t.name ) umsg.Vector( Vector( t.color.r, t.color.g, t.color.b ) ) - if ( t.password == false ) then + if ( t.password == false ) then umsg.Bool( false ) else umsg.Bool( true ) @@ -2177,7 +2178,7 @@ function GM:PlayerSelectSpawn( pl ) local count = table.Count( self.SpawnPoints ) if ( count == 0 ) then MsgN( "[PlayerSelectSpawn] Error! No spawn points!" ) - return nil + return nil end local ChosenSpawnPoint = nil @@ -2297,17 +2298,17 @@ hook.Add( "PlayerDeath", "Death", function( ply ) // Creates the gravestone local grave = ents.Create("gms_gravestone") - + grave:SetPos( Vector( ply:GetPos().x, ply:GetPos().y, ply:GetPos().z+18 ) ) - + grave:Spawn() grave:SetplName(ply:Nick()) - + grave:SetNetworkedString( "Owner", "Everyone" ) wepstbl = {} restbl = {} - + for _, v in pairs( ply:GetWeapons() ) do if ( !table.HasValue( GMS.NonDropWeapons, v:GetClass() ) && GetConVarNumber( "gms_AllTools" ) != 1 ) then //ply:DropWeapon( v ) @@ -2315,25 +2316,25 @@ hook.Add( "PlayerDeath", "Death", function( ply ) SPropProtection.PlayerMakePropOwner( ply, v ) end end - + for _, v in pairs(ply.Resources) do - + num1 = v * 0.1 num2 = v - math.Round(num1) - + if (num2 > 0) then - + table.insert(restbl, _.." x"..num2) ply:DecResource(_,v) - + end - - - + + + end - + ply.Resources = {} - + grave.deathWeapons = wepstbl grave.deathResources = restbl @@ -2568,7 +2569,7 @@ end function GM:PlayerSpawnVehicle( ply, model, vname, vtable ) return false end - + /*------------------------ Needs ------------------------*/ timer.Create( "GMS.SubtractNeeds", 3, 0, function() @@ -2619,7 +2620,7 @@ timer.Create( "GMS.SubtractNeeds", 3, 0, function() end else if ( ply.Oxygen < 1000 ) then ply.Oxygen = math.min( ply.Oxygen + 100, 1000 ) end - end + end // Flashlight if ( ply:FlashlightIsOn() ) then @@ -2651,7 +2652,7 @@ timer.Create( "GMS.SubtractNeeds", 3, 0, function() for k, v in pairs( player.GetAll() ) do v:SendMessage( ply:Nick() .. " didn't survive.", 3, Color( 170, 0, 0, 255 ) ) end end end - + if ( ply.Oxygen <= 0 ) then if ( ply:Health() >= 9 ) then ply:SetHealth( ply:Health() - 8 ) @@ -2682,7 +2683,7 @@ function GM:OnNPCKilled( npc, killer, weapon ) local loot = ents.Create( "gms_loot" ) SPropProtection.PlayerMakePropOwner( killer, loot ) - loot.Resources = { Meat = math.random( 1, 5 ) } + loot.Resources = { Meat = math.random( 1, 5 ) } loot:SetPos( npc:GetPos() + Vector( 0, 0, 64 ) ) loot:Spawn() timer.Simple( 180, function() if ( loot:IsValid() ) then loot:Fadeout( 2 ) end end ) @@ -2752,7 +2753,7 @@ hook.Add( "KeyPress", "GMS_UseKeyHook", function( ply, key ) elseif ( GMS.IsInWater( tr.HitPos ) && !tr.HitNonWorld ) then if (ply:GetActiveWeapon():GetClass() == "gms_bucket") then ply:DoProcess( "BottleWater", 20 ) - else + else ply:DoProcess( "BottleWater", 3 ) end end @@ -2878,7 +2879,7 @@ function GM:PreLoadMap( name ) if ( !file.Exists( "gmstranded/gamesaves/" .. name .. ".txt", "DATA" ) ) then return end game.CleanUpMap() - + for k, ply in pairs( player.GetAll() ) do ply:MakeLoadingBar( "Savegame \"" .. name .. "\"" ) end self.NextLoaded = CurTime() + 0.6 @@ -2895,7 +2896,7 @@ function GM:LoadMap( name ) ply:StopLoadingBar() end return end - + Time = DayTime self:LoadMapEntity( savegame, num, 1 ) @@ -2906,13 +2907,13 @@ function GM:LoadMapEntity( savegame, max, k ) local entry = savegame["entries"][k] local ent = ents.Create( entry["class"] ) - + if ( !entry["model"] ) then print( "WARNING! " .. entry["class"] .. " doesn't have a model!" ) else ent:SetModel( entry["model"] ) end - + ent:SetColor( entry["color"] ) ent:SetPos( entry["pos"] ) @@ -2994,7 +2995,7 @@ hook.Add( "Think", "GM_WaterExtinguish", function() if ( v:WaterLevel() > 0 and v:IsOnFire() ) then v:Extinguish() timer.Remove( "gms_removecampfire_" .. v:EntIndex() ) - end + end end end ) @@ -3009,7 +3010,7 @@ local AlertSoundsSleep = { "stranded/need_sleepiness1.wav", "stranded/need_sleep /* Alert Messages */ timer.Create( "AlertTimer", 6, 0, function() //if ( GetConVarNumber( "gms_alerts" ) != 1 ) then return end - for k, ply in pairs( player.GetAll() ) do + for k, ply in pairs( player.GetAll() ) do if ( !ply:Alive() ) then continue end if ( ply.Hunger < 125 ) then ply:EmitSound( Sound( AlertSoundsHunger[ math.random( 1, #AlertSoundsHunger ) ] ), 100, math.random( 95, 105 ) ) end if ( ply.Thirst < 125 ) then ply:EmitSound( Sound( AlertSoundsThirst[ math.random( 1, #AlertSoundsThirst ) ] ), 100, math.random( 95, 105 ) ) end @@ -3051,7 +3052,7 @@ function CreateTribe( ply, name, red, green, blue, password ) ply:UpdatePlayerColor() SPropProtection.TribePP( ply ) ply:SendMessage( "Successfully created " .. name .. ".", 5, Color( 255, 255, 255, 255 ) ) - + end function GM.CreateTribeCmd( ply, cmd, args, argv ) @@ -3070,7 +3071,7 @@ function GM.JoinTribeCmd( ply, cmd, args ) if ( string.lower( v.name ) != string.lower( args[1] ) ) then continue end if ( v.password && v.password != args[ 2 ] ) then ply:SendMessage( "Incorrcet tribal password", 3, Color( 255, 50, 50, 255 ) ) return end - + ply:SetTeam( id ) ply:UpdatePlayerColor() SPropProtection.TribePP( ply ) @@ -3166,7 +3167,7 @@ function gms_addbuildsiteresource( ent_resourcedrop, ent_buildsite ) ent_buildsite.Costs[ent_resourcedrop.Type] = nil elseif ( ent_resourcedrop.Amount <= ent_buildsite.Costs[ent_resourcedrop.Type] ) then ent_buildsite.Costs[ent_resourcedrop.Type] = ent_buildsite.Costs[ent_resourcedrop.Type] - ent_resourcedrop.Amount - ent_resourcedrop:Remove() + ent_resourcedrop:Remove() end for k, v in pairs( ent_buildsite.Costs ) do if ( ent_buildsite.Costs[ent_resourcedrop.Type] ) then @@ -3174,7 +3175,7 @@ function gms_addbuildsiteresource( ent_resourcedrop, ent_buildsite ) ent_buildsite.Costs[ent_resourcedrop.Type] = nil end end - end + end if ( table.Count( ent_buildsite.Costs ) > 0 ) then local str = "You need: " @@ -3188,7 +3189,7 @@ function gms_addbuildsiteresource( ent_resourcedrop, ent_buildsite ) ply:SendMessage( "Finished!", 3, Color( 10, 200, 10, 255 ) ) ent_buildsite:Finish() end - + local str = ":" for k, v in pairs( ent_buildsite.Costs ) do str = str .. " " .. string.Replace( k, "_", " " ) .. " ( " .. v .. "x )" @@ -3207,7 +3208,7 @@ function gms_addbuildsiteresourcePack( ent_resourcepack, ent_buildsite ) if ( ent_resourcedrop_owner != nil and ent_buildsite_owner != nil and ply != nil and ent_resourcepack:IsPlayerHolding() ) then if ( SPropProtection.PlayerCanTouch( ply, ent_buildsite ) ) then for res, num in pairs( ent_resourcepack.Resources ) do - if ( ent_buildsite.Costs[res] and num > ent_buildsite.Costs[res] ) then + if ( ent_buildsite.Costs[res] and num > ent_buildsite.Costs[res] ) then ent_resourcepack.Resources[res] = num - ent_buildsite.Costs[res] ent_resourcepack:SetResPackInfo( res, ent_resourcepack.Resources[res] ) ent_buildsite.Costs[res] = nil @@ -3237,7 +3238,7 @@ function gms_addbuildsiteresourcePack( ent_resourcepack, ent_buildsite ) ply:SendMessage( "Finished!", 3, Color( 10, 200, 10, 255 ) ) ent_buildsite:Finish() end - + local str = ":" for k, v in pairs( ent_buildsite.Costs ) do str = str .. " " .. string.Replace( k, "_", " " ) .. " ( " .. v .. "x )" |
