From 0a747c42fdcc74d51edb2c5c6dc1a73a3e1db9ec Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Wed, 20 Apr 2022 12:54:33 -0300 Subject: [PATCH] update Lua examples --- docs/manual/lua-examples.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/manual/lua-examples.md b/docs/manual/lua-examples.md index 87e191c7c..dd363c024 100644 --- a/docs/manual/lua-examples.md +++ b/docs/manual/lua-examples.md @@ -14,7 +14,7 @@ end) ``` Hook.Add("itemApplyTreatment", "testItemApplyTreatment", function (item, user, character, targetlimb) - if item.name == "Bandage" then + if item.Prefab.Identifier == "antibleeding1" then local pos = character.WorldPosition Game.Explode(pos, 1, 500, 5000, 5000, 5000) @@ -29,7 +29,7 @@ end) ``` -- for example: create an item in xml named RandomComponent and add the wiring inputs/outputs trigger_random and random_out Hook.Add("signalReceived", "signalReceivedTest", function (signal, connection) - if connection.Item.name == "RandomComponent" and connection.Name == "trigger_random" then + if connection.Item.Prefab.Identifier == "RandomComponent" and connection.Name == "trigger_random" then connection.Item.SendSignal(tostring(Random.Range(0, 100)), "random_out") end end) @@ -72,13 +72,13 @@ Hook.Add("chatMessage","controlhuskcommand",function(msg, client) local suitablechars = {} for i = 1, #chars, 1 do local charat = chars[i] - if not charat.IsDead and string.match(string.lower(charat.SpeciesName), "husk") and not charat.IsRemotelyControlled then + if not charat.IsDead and string.match(string.lower(charat.SpeciesName.Value), "husk") and not charat.IsRemotelyControlled then table.insert(suitablechars, charat) end end if #suitablechars >= 1 then - Player.SetClientCharacter(client, suitablechars[Random.Range(1, #suitablechars)]) + client.SetClientCharacter(suitablechars[Random.Range(1, #suitablechars)]) end return true -- hide message