diff options
Diffstat (limited to 'gamemode')
| -rw-r--r-- | gamemode/itemsystem/common_plantable.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gamemode/itemsystem/common_plantable.lua b/gamemode/itemsystem/common_plantable.lua index 44b491b..4db5618 100644 --- a/gamemode/itemsystem/common_plantable.lua +++ b/gamemode/itemsystem/common_plantable.lua @@ -18,9 +18,15 @@ local function plant(player, resourcename) assert(tbl.GrowTime != nil,tbl.Name .. " .GrowTime is nil!") assert(isfunction(tbl.OnGrow),tbl.Name .. " .OnGrow is not a table") + if(player:GetNWInt("plants") > GetConVar("gms_PlantLimit")) then + player:SendMessage( "You man only have " .. GetConVar("gms_PlantLimit") .. " plants at a time.", 3, Color( 10, 200, 10, 255 ) ) + return + end + local tr = player:GetEyeTrace() if (player:GetPos():Distance(tr.HitPos) > 180 ) then player:SendMessage( "Too far away to plant", 3, Color( 10, 200, 10, 255 ) ) + return end local pent = ents.Create("gms_generic_plantable") @@ -29,6 +35,7 @@ local function plant(player, resourcename) pent.OnGrow = tbl.OnGrow pent:SetOwner(player) pent:Spawn() + player.NumPlants += 1 player:DecResource( resourcename, 1 ) end end |
