diff options
Diffstat (limited to 'gamemode/itemsystem/common_plantable.lua')
| -rw-r--r-- | gamemode/itemsystem/common_plantable.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gamemode/itemsystem/common_plantable.lua b/gamemode/itemsystem/common_plantable.lua index 668ca74..067f464 100644 --- a/gamemode/itemsystem/common_plantable.lua +++ b/gamemode/itemsystem/common_plantable.lua @@ -9,6 +9,13 @@ if(SERVER) then end local function plant(player, resourcename) if(CLIENT) then + + if LocalPlayer():GetPos():Distance( LocalPlayer():GetEyeTrace().HitPos ) > 180 then + + chat.AddText( Color( 200, 0, 0 ), "Too far away!" ) + return false + + end net.Start("gms_plantseed") net.WriteString(resourcename) net.SendToServer() @@ -25,6 +32,7 @@ local function plant(player, resourcename) pent.OnGrow = tbl.OnGrow pent:SetOwner(player) pent:Spawn() + player:DecResource( resourcename, 1 ) end end net.Receive( "gms_plantseed", function(len,pl) |
