addCommandHandler("trabajar", function(player, cmd)
if not player:isInVehicle() then
for i, marker in ipairs(MarkersCarpintero) do
if player:isWithinMarker(marker) then
local mjob = marker:getData("MarkerJob")
if mjob == "Carpintero" then
local currentJob = player:getData("Roleplay:trabajo")
if currentJob == "Carpintero" then
removeElementData(player, "objeto")
removeElementData(player, "silla")
player:outputChat("¡Ya estás trabajando aquí!", 150, 50, 50, true)
else
if currentJob == "" then
removeElementData(player, "objeto")
removeElementData(player, "silla")
player:setData("Roleplay:trabajo", "Carpintero")
marker:setData("MarkerJob", "Carpintero") -- Actualizamos el valor del trabajo en el marcador
player:outputChat("¡Bienvenido al trabajo de #ffff00Carpintero#ffffff!", 255, 255, 255, true)
player:outputChat("#ffFFffRecoge una pila de madera y ve a la mesa para elaborar el item", 255, 255, 255, true)
else
player:outputChat("Ya tienes trabajo como " .. currentJob .. ".", 255, 255, 255, true)
end
end
end
end
end
end
end)
Well people I am creating a work system for my server, everything is fine now, but I can't find the error, here I explain how it works or what I want the script to do
- If you don't have a job, I'll give you the job
- If you already have the job, tell you in an outputchat
- If you already work elsewhere, let me tell you and where I work
I would really appreciate if you explain to me :3