• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ aol reminder not working

Marko999x

999x HIGHExP
Premium User
Joined
Dec 14, 2017
Messages
3,547
Solutions
95
Reaction score
2,698
Location
Germany
yo
Made quick this script but for some reasons its not working
im not the best in lua thats why im asking

LUA:
function onLogin(player)
    if not player:getSlotItem(CONST_SLOT_NECKLACE).itemid == 2173 then
    player:sendCancelMessage("You dont have a amulet of loss!")
    else
    player:sendCancelMessage("You have amulet of loss!")
    end
    return true
    end

tfs 1.3
thanks
 
Solution
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/aolreminder.lua:onLogin
data/creaturescripts/scripts/aolreminder.lua:2: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/creaturescripts/scripts/aolreminder.lua:2: in function <data/creaturescripts/scripts/aolreminder.lua:1>
LUA:
function onLogin(player)
	local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
	if amulet and amulet.itemid == ITEM_AMULETOFLOSS then
		player:sendCancelMessage("You have amulet of loss!")
	else
		player:sendCancelMessage("You dont have a amulet of loss!")
	end

	return true
end
Try this
LUA:
function onLogin(player)
Aol = player:getSlotItem(CONST_SLOT_NECKLACE)
    if not Aol or Aol:getId() ~= 2173 then
    player:sendCancelMessage("You dont have a amulet of loss!")
    else
    player:sendCancelMessage("You have amulet of loss!")
    end
    return true
    end
 
Last edited:
Try this
LUA:
function onLogin(player)
Aol = player:getSlotItem(CONST_SLOT_NECKLACE).itemid
    if not Aol == 2173 then
    player:sendCancelMessage("You dont have a amulet of loss!")
    else
    player:sendCancelMessage("You have amulet of loss!")
    end
    return true
    end

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/aolreminder.lua:onLogin
data/creaturescripts/scripts/aolreminder.lua:2: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/creaturescripts/scripts/aolreminder.lua:2: in function <data/creaturescripts/scripts/aolreminder.lua:1>
 
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/aolreminder.lua:onLogin
data/creaturescripts/scripts/aolreminder.lua:2: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/creaturescripts/scripts/aolreminder.lua:2: in function <data/creaturescripts/scripts/aolreminder.lua:1>
LUA:
function onLogin(player)
	local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
	if amulet and amulet.itemid == ITEM_AMULETOFLOSS then
		player:sendCancelMessage("You have amulet of loss!")
	else
		player:sendCancelMessage("You dont have a amulet of loss!")
	end

	return true
end
 
Solution
Both scripts not working
no errors in console

LUA:
function onLogin(player)
     local necklace = player:getSlotItem(CONST_SLOT_NECKLACE)   
     if necklace == nil or not Item(necklace:getUniqueId()) == 2173  then     
          player:sendCancelMessage("You dont have a amulet of loss!")
     else
      player:sendCancelMessage("You have amulet of loss!")
    end   

return true

end
 
that script doesn't even make any sense, the 2nd condition will literally always be false because you're trying to compare a userdata with a number (and you're not even using the not operator correctly ??)
@Alpha 's script should work just fine unless you dont have ITEM_AMULETOFLOSS for some reason in which case u just replace it with 2173
 
Back
Top