• 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!

Problem lua traceback

corydurban

New Member
Joined
Jul 21, 2007
Messages
43
Reaction score
1
I wanted it set to where if in prison(with storage 1339) it shows as a prisoner from hell
well it works the problem is if i'm looking at anything else other then another person it dosent work as in it won't allow me to look
this is my script
Lua:
local storage = 1339
 
function onLook(cid, thing, position, lookDistance)
	if (isPlayer(thing.uid) ~= cid and getPlayerStorageValue(thing.uid, storage) > 0) then
		doPlayerSetSpecialDescription(thing.uid,'.\n'..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is a prisoner of hell')
	end
		if (isPlayer(thing.uid) == cid and getPlayerStorageValue(thing.uid, storage) > 0) then
			doPlayerSetSpecialDescription(thing.uid,'.\n is a prisoner of hell')
		end
return true
		end
and i get this error when i try to look at something that is not a person
[3:26:36.343] stack traceback:
[3:26:36.346] data/creaturescripts/scripts/prison.lua:4: in function <data/cre
aturescripts/scripts/prison.lua:3>
I'm new to scripting so >.> excuse me being a noob

i really need to get this working >.>
 
Last edited:
Lua:
 if (isPlayer(thing.uid) ~= cid and getPlayerStorageValue(thing.uid, storage) > 0) then

Ok here is your problem
isPlayer(thing.uid) returns boolean value (true or false) so it is never equal to creature id (so it will let script execute further)

you should remove ~= cid so it looks like
Lua:
 if (isPlayer(thing.uid) and getPlayerStorageValue(thing.uid, storage) > 0) then
 
Back
Top