Remove the microwave from the cook when changing jobs
3 replies, posted
I used this code on my old server, but when I changed team all microwave even disappeared those of other cooks.
I would like that when the cook changes job it removes only the microwave (of the one who changes job) and not all microwave on the server.
If anyone could help me to complete this code, I would be very grateful
local cook = TEAM_COOK --job cook
local entity = "microwave" --class of the microwave entity
local function DeleteMicrowave()
for _, e in pairs(ents.GetAll()) do
if e:GetClass() == entity then
e:Remove()
end
end
end
hook.Add("OnPlayerChangedTeam", "microwaveremove", function(p, o)
if o == cook then
DeleteMicrowave()
end
end)
This code works, but as I told you, it removes all microwaves and I would like it removes only that of the cook who changes jobs.
I listed all the changes you need to make here! (i just dont want the code to be less readable)
This is in darkrpmodification settings.lua
https://files.facepunch.com/forum/upload/134299/33814043-ad99-49fe-831f-b09a3d806298/image.png
I forgot, I open my server in a month, I could check at this time, I would say on the forum to confirm if your methods work, thank you again for your help friends (e) s
Sorry, you need to Log In to post a reply to this thread.