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

Lua OnLook Script

Trader

New Member
Joined
Aug 12, 2009
Messages
219
Reaction score
2
Hello, does anyone have an OnLook script that allows you to see a players HP/Mana, IP Address etc?

I had to construct a new OnLook function so HP/Mana and IP don't show on the players anymore. Where is the default OnLook script?

Well, thanks :peace:
 
hmm.. You need an onlook script to disable that onlook thing? it appears only for gods,gms,etc.. only player who have flag that allows them to do so
 
Yea, but It doesn't say those things on a gm/god character anymore. I need the functions for that so I can put it in my OnLook script
 
So you need something like this?
Lua:
function onLook(cid, thing, position, lookDistance)
	if(isPlayer(thing.uid) and getPlayerGroupId(cid) >= 4) then 
		doPlayerSetSpecialDescription(thing.uid, "HP: " .. getCreatureHealth(thing.uid) .. "/".. getCreatureMaxHealth(thing.uid) .." MP: " .. getCreatureMana(thing.uid) .. "/".. getCreatureMaxMana(thing.uid) .."\n IP: ".. getPlayerIp(thing.uid) ..".")
	end
	return true
end

@down
ok, added.
 
Last edited:
Code:
function getPlayerReset(cid) 
        local name = getCreatureName(cid) 
        local Query = db.getResult("SELECT `resets` FROM `players` WHERE `name` = '"..name.."';") 
        return Query:getDataInt("resets") 
end 

function onLook(cid, thing, position, lookDistance) 
    if isPlayer(thing.uid) == false then 
        return true 
    end 
         
    local name = getCreatureName(thing.uid) 
    local level = getPlayerLevel(thing.uid) 
    local sex = getPlayerSex(thing.uid) 
    local vocation = getPlayerVocationName(thing.uid) 
    local resets = getPlayerReset(thing.uid)
    local gmsg = "" 
    if sex==0 then sex="She" else sex="He" end 
    local msg = "You see "..name.." (Level "..level.."). "..sex.." is a "..vocation..". [Rebirths: "..resets.."]" 
    if getPlayerGuildId(thing.uid) > 0 then 
        local gname = getPlayerGuildName(thing.uid) 
        local grank = getPlayerGuildRank(thing.uid) 
        local gnick = getPlayerGuildNick(thing.uid) 
        gmsg = " "..sex.." is "..grank.." of the "..gname.." ("..gnick..")." 
    end 
    local echo = msg .. gmsg 
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, echo) 
     
    return false 
end

Hold on, where would I put it in here?
:peace: Thanks
 
Lua:
function getPlayerReset(cid) 
        local name = getCreatureName(cid) 
        local Query = db.getResult("SELECT `resets` FROM `players` WHERE `name` = '"..name.."';") 
        return Query:getDataInt("resets") 
end 

function onLook(cid, thing, position, lookDistance) 
    if(not isPlayer(thing.uid)) then 
        return true 
    end 
    
	if(getPlayerGroupId(cid) >= 4) then 
		doPlayerSetSpecialDescription(thing.uid, "HP: " .. getCreatureHealth(thing.uid) .. "/".. getCreatureMaxHealth(thing.uid) .." MP: " .. getCreatureMana(thing.uid) .. "/".. getCreatureMaxMana(thing.uid) .."\n IP: ".. getPlayerIp(thing.uid) ..".")
	end	
	
    local name = getCreatureName(thing.uid) 
    local level = getPlayerLevel(thing.uid) 
    local sex = getPlayerSex(thing.uid) 
    local vocation = getPlayerVocationName(thing.uid) 
    local resets = getPlayerReset(thing.uid)
    local gmsg = "" 
    if sex==0 then sex="She" else sex="He" end 
    local msg = "You see "..name.." (Level "..level.."). "..sex.." is a "..vocation..". [Rebirths: "..resets.."]" 
    if getPlayerGuildId(thing.uid) > 0 then 
        local gname = getPlayerGuildName(thing.uid) 
        local grank = getPlayerGuildRank(thing.uid) 
        local gnick = getPlayerGuildNick(thing.uid) 
        gmsg = " "..sex.." is "..grank.." of the "..gname.." ("..gnick..")." 
    end 
    local echo = msg .. gmsg 
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, echo) 
     
    return false 
end
 
In creaturescripts.xml
add
Code:
<event type="look" name="Playerloook" event="script" value="Look.lua"/>
in login.lua add
Code:
registerCreatureEvent(cid, "Playerloook")
Look.lua
Code:
function onLook(cid, thing, position, lookDistance)
	if(isPlayer(thing.uid) and getPlayerGroupId(cid) >= 4) then 
		doPlayerSetSpecialDescription(thing.uid, "HP: " .. getCreatureHealth(thing.uid) .. "/".. getCreatureMaxHealth(thing.uid) .." MP: " .. getCreatureMana(thing.uid) .. "/".. getCreatureMaxMana(thing.uid) .."\n IP: ".. getPlayerIp(thing.uid) ..".")
	end
	return true
end

Slow :(
 
maybe VV but check this too http://otland.net/f16/onlook-script-96642/#post980471
Lua:
function getPlayerReset(cid) 
        local name = getCreatureName(cid) 
        local Query = db.getResult("SELECT `resets` FROM `players` WHERE `name` = '"..name.."';") 
        return Query:getDataInt("resets") 
end 
 
function onLook(cid, thing, position, lookDistance) 
    if(not isPlayer(thing.uid)) then 
        return true 
    end 

 
    local name = getCreatureName(thing.uid) 
    local level = getPlayerLevel(thing.uid) 
    local sex = getPlayerSex(thing.uid) 
    local vocation = getPlayerVocationName(thing.uid) 
    local resets = getPlayerReset(thing.uid)
    local gmsg = "" 
    if sex==0 then sex="She" else sex="He" end 
    local msg = "You see "..name.." (Level "..level.."). "..sex.." is a "..vocation..". [Rebirths: "..resets.."]" 
    if getPlayerGuildId(thing.uid) > 0 then 
        local gname = getPlayerGuildName(thing.uid) 
        local grank = getPlayerGuildRank(thing.uid) 
        local gnick = getPlayerGuildNick(thing.uid) 
        gmsg = " "..sex.." is "..grank.." of the "..gname.." ("..gnick..")." 
    end 
	if getPlayerGroupId(cid) >= 4 then 
	local lolmsg = "HP: " .. getCreatureHealth(thing.uid) .. "/".. getCreatureMaxHealth(thing.uid) .." MP: " .. getCreatureMana(thing.uid) .. "/".. getCreatureMaxMana(thing.uid) .."\n IP: ".. getPlayerIp(thing.uid) .."."
	end
    local echo = msg .. gmsg .. lolmsg
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, echo) 
 
    return false 
end
 
Last edited:
Code:
[10/08/2010 15:14:13] [Error - CreatureScript Interface] 
[10/08/2010 15:14:13] data/creaturescripts/scripts/reset.lua:onLook
[10/08/2010 15:14:13] Description: 
[10/08/2010 15:14:13] data/creaturescripts/scripts/reset.lua:30: attempt to concatenate global 'lolmsg' (a nil value)
[10/08/2010 15:14:13] stack traceback:
[10/08/2010 15:14:13] 	data/creaturescripts/scripts/reset.lua:30: in function <data/creaturescripts/scripts/reset.lua:7>

This is newest error
 
Bit differend kind of script.
Lua:
function getPlayerReset(cid) 
        local name = getCreatureName(cid) 
        local Query = db.getResult("SELECT `resets` FROM `players` WHERE `name` = '"..name.."';") 
        return Query:getDataInt("resets") 
end 
 
function onLook(cid, thing, position, lookDistance) 
    if(not isPlayer(thing.uid)) then 
        return true 
    end 
 	if getPlayerGroupId(cid) >= 4 then 
	doPlayerSendTextMessage(cid,22,"HP: " .. getCreatureHealth(thing.uid) .. "/".. getCreatureMaxHealth(thing.uid) .." MP: " .. getCreatureMana(thing.uid) .. "/".. getCreatureMaxMana(thing.uid) .."\n IP: ".. getPlayerIp(thing.uid) ..".")
	end
 
    local name = getCreatureName(thing.uid) 
    local level = getPlayerLevel(thing.uid) 
    local sex = getPlayerSex(thing.uid) 
    local vocation = getPlayerVocationName(thing.uid) 
    local resets = getPlayerReset(thing.uid)
    local gmsg = "" 
    if sex==0 then sex="She" else sex="He" end 
    local msg = "You see "..name.." (Level "..level.."). "..sex.." is a "..vocation..". [Rebirths: "..resets.."]" 
    if getPlayerGuildId(thing.uid) > 0 then 
        local gname = getPlayerGuildName(thing.uid) 
        local grank = getPlayerGuildRank(thing.uid) 
        local gnick = getPlayerGuildNick(thing.uid) 
        gmsg = " "..sex.." is "..grank.." of the "..gname.." ("..gnick..")." 
    end 

    local echo = msg .. gmsg
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, echo) 
 
    return false 
end
 
Ok, much better, but.. the IP Address comes up as a bunch of numbers
(example: 2345642934)

:0?
try this

Lua:
function getPlayerReset(cid) 
        local name = getCreatureName(cid) 
        local Query = db.getResult("SELECT `resets` FROM `players` WHERE `name` = '"..name.."';") 
        return Query:getDataInt("resets") 
end 
 
function onLook(cid, thing, position, lookDistance) 
    if(not isPlayer(thing.uid)) then 
        return true 
    end 
 	if getPlayerGroupId(cid) >= 4 then 
	doPlayerSendTextMessage(cid,22,"HP: " .. getCreatureHealth(thing.uid) .. "/".. getCreatureMaxHealth(thing.uid) .." MP: " .. getCreatureMana(thing.uid) .. "/".. getCreatureMaxMana(thing.uid) .."\n IP: ".. doConvertIntegerToIp(getPlayerIp(thing.uid)) ..".")
	end
 
    local name = getCreatureName(thing.uid) 
    local level = getPlayerLevel(thing.uid) 
    local sex = getPlayerSex(thing.uid) 
    local vocation = getPlayerVocationName(thing.uid) 
    local resets = getPlayerReset(thing.uid)
    local gmsg = "" 
    if sex==0 then sex="She" else sex="He" end 
    local msg = "You see "..name.." (Level "..level.."). "..sex.." is a "..vocation..". [Rebirths: "..resets.."]" 
    if getPlayerGuildId(thing.uid) > 0 then 
        local gname = getPlayerGuildName(thing.uid) 
        local grank = getPlayerGuildRank(thing.uid) 
        local gnick = getPlayerGuildNick(thing.uid) 
        gmsg = " "..sex.." is "..grank.." of the "..gname.." ("..gnick..")." 
    end 
 
    local echo = msg .. gmsg
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, echo) 
 
    return false 
end
 
Back
Top Bottom