summaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/items
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-22 15:53:31 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-22 15:53:31 -0400
commit699df0d5df4e7d00a0d2b838b8c851c9b5027cea (patch)
treed3442f025b8a0ffd0afcf3d73189982dfc2d4c0c /gamemode/itemsystem/items
parent675a4327c1653512655963288e9a0c9acb40bf77 (diff)
downloadgmstranded-699df0d5df4e7d00a0d2b838b8c851c9b5027cea.tar.gz
gmstranded-699df0d5df4e7d00a0d2b838b8c851c9b5027cea.tar.bz2
gmstranded-699df0d5df4e7d00a0d2b838b8c851c9b5027cea.zip
Made mediceine work like it used to, and added sound
Diffstat (limited to 'gamemode/itemsystem/items')
-rw-r--r--gamemode/itemsystem/items/medicine.lua28
1 files changed, 18 insertions, 10 deletions
diff --git a/gamemode/itemsystem/items/medicine.lua b/gamemode/itemsystem/items/medicine.lua
index 405188d..d741b04 100644
--- a/gamemode/itemsystem/items/medicine.lua
+++ b/gamemode/itemsystem/items/medicine.lua
@@ -6,27 +6,35 @@ ITEM.Description = "Heals you!"
ITEM.Icon = "items/medicine.png"
ITEM.UniqueData = false
-if(SERVER) then
+if (SERVER) then
util.AddNetworkString( "gms_usemedicine" )
end
local client_use = function()
- net.Start("gms_usemedicine")
+ net.Start("gms_usemedicine")
net.SendToServer()
end
local finisheduseing = function(player)
- player:DecResource( "Medicine", 1 )
- player:SendMessage( "You're feeling a bit better now.", 3, Color( 10, 200, 10, 255 ) )
- player:Heal( 10 )
+ player:DecResource( "Medicine", 1 )
+ player:SendMessage( "You're feeling a bit better now.", 3, Color( 10, 200, 10, 255 ) )
+ player:Heal( 10 )
end
local use_medicine = function(ln, player)
- if ( player:GetResource( "Medicine" ) < 1 ) then
- player:SendMessage( "You need Medicine.", 3, Color( 200, 0, 0, 255 ) )
- return
- end
- startProcessGeneric(player,"Patching yourself up",1.5,finisheduseing)
+ if ( player:GetResource( "Medicine" ) < 1 ) then
+ player:SendMessage( "You need Medicine.", 3, Color( 200, 0, 0, 255 ) )
+ return
+ end
+ local maxhealth = 100
+ if player:HasUnlock("Adept_Survivalist") then maxhealth = maxhealth + 50 end
+ if player:HasUnlock("Master_Survivalist") then maxhealth = maxhealth + 50 end
+ if player:Health() >= maxhealth then
+ player:SendMessage( "You feel fine!", 3, Color( 200, 0, 0, 255 ) )
+ return
+ end
+ player:EmitSound( Sound("items/smallmedkit1.wav" ) )
+ startProcessGeneric(player,"Patching yourself up",1.5,finisheduseing)
end
net.Receive( "gms_usemedicine", use_medicine)