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

Solved Simple onLook script

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
When GM looks something it gets:

Position: [X: 33023] [Y: 31529] [Z: 11].

Is it possible to set like this?

{x=33023, y=31529, z=11}

This way scripting gets much easier :]

--

I've tried this, but didn't work (nothing happens)

LUA:
function onLook(cid, thing, position, lookDistance)
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
	doPlayerSetSpecialDescription(thing.uid, ("\n{x='.. position.x..', y='.. position.y..',z='.. position.z..'}"))
	end
return true
end
(it would be nice if values come in "" already, but when I put this it gives error)


Also, I'll use this same topic to ask for a little script fix, I've made this:

LUA:
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and thing.uid ~= cid then
	if isBotter(thing.uid) == TRUE then
	doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is botter")
	else
	doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is hardcore")
	return TRUE
	end
	elseif isPlayer(thing.uid) and thing.uid == cid then
	if isBotter(thing.uid) == TRUE then
	doPlayerSetSpecialDescription(thing.uid, "\nYou are botter")
	else
	doPlayerSetSpecialDescription(thing.uid, "\nYou are hardcore")
	end
end
return true
end

But when player looks at self (cid), it does not shows the messages it supposes to... When look to another player, it works...
 
Last edited:
try that xD
REP ++ please

LUA:
function onLook(cid, thing, position, lookDistance)
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
	doPlayerSetSpecialDescription(thing.uid, '\n{x='.. position.x..', y='.. position.y..',z='.. position.z..'}')
	end
return true
end

LUA:
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid)  then

	if thing.uid == cid then
	if isBotter(thing.uid) then
	doPlayerSetSpecialDescription(thing.uid, "\nYou are botter")
	else
	doPlayerSetSpecialDescription(thing.uid, "\nYou are hardcore")
	end
else

	if isBotter(thing.uid) then
	doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is botter")
	else
	doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is hardcore")
	return true
		end
	end
end
return true
end
 
Last edited:
LUA:
function onLook(cid, thing, position, lookDistance)
	if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
		doPlayerSetSpecialDescription(thing.uid, ("\n{x=".. position.x..", y=".. position.y..",z=".. position.z.."}"))
	end
return true
end

LUA:
function onLook(cid, thing, position, lookDistance)
	if isPlayer(thing.uid) and thing.uid ~= cid then
		if isBotter(thing.uid) == TRUE then
			doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is botter")
		else
			doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is hardcore")
		return TRUE
		end
	elseif isPlayer(thing.uid) and thing.uid == cid then
		if isBotter(cid) == TRUE then
			doPlayerSetSpecialDescription(cid, "\nYou are botter")
		else
			doPlayerSetSpecialDescription(cid, "\nYou are hardcore")
		end
	end
return true
end
 
Still didn't work, none of them... There must be something to declare or something we're forgetting...

conde2, tried yours too... I'm replacing the code, reloading creaturescripts and relogging the characters to test, it should work...

adding rep to both for the good will, thanks, still didn't work though...

-- edit --

Did it:

LUA:
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and thing.uid ~= cid then
            	if isBotter(thing.uid) then
	doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is botter")
	else
	doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is hardcore")
	end
			return true
		elseif thing.uid == cid then     
			local string = 'You see yourself.'
			if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
				string = string..' You are '.. getPlayerGroupName(cid) ..'.'
			elseif getPlayerVocation(cid) ~= 0 then
				string = string..' You are '.. getPlayerVocationName(cid) ..'.'
			else
				string = string..' You have no vocation.'
			end
				if isBotter(thing.uid) then
				string = string.. '\nYou are botter.'
		else
				string = string.. '\nYou are hardcore.' end
 
			if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
				string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
			end
 
			if getPlayerGuildId(cid) > 0 then 
				string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
				string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
			end 
 
			if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
				string = string..'\nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
				string = string..'\nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
			end
 
			if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
				string = string..'\n{x="'.. position.x..'",y="'.. position.y..'",z="'.. position.z..'"}'
			end
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)  
			return false
		end
		if isPlayer(thing.uid) == FALSE then
					if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
				doPlayerSendTextMessage(cid,22, '{x='.. position.x..', y='.. position.y..',z='.. position.z..'}')
				end
				end
		return true
    end

And it got even better than I expected lol

2qsugxt.jpg


Thanks everyone
 
Last edited:
What's so hard about source editing? It's a much more appropriate solution in this case because you would have to throw away all description messages and make them in Lua to achieve the same effect.
 
Back
Top