• 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 LUA problem onLook

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
I have this lua code, and it only works when you see other players... I need to make it works when you see your character too...

PHP:
function onLook(cid, thing, position, lookDistance)
				if(isPlayer(thing.uid)) then
					local rank = {rank = "Private", frags = 0}
					for k, v in pairs(titles) do
						if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
							if(k - 1 > rank.frags) then
								rank.rank, rank.frags = v, k - 1
							end
						end
					end
					doPlayerSetSpecialDescription(thing.uid, "\n[Reborns: " .. getReborns(thing.uid) .."]\n Military Rank: " .. rank.rank)
					
				end
				return true
			end

I figured to add this:

PHP:
for k, v in pairs(titles) do
						if(math.max(0, getPlayerStorageValue(cid, fragsStorage)) > k - 1) then
							if(k - 1 > rank.frags) then
								rank.rank, rank.frags = v, k - 1
							end
						end
					end
					doPlayerSetSpecialDescription(cid, "\n[Reborns: " .. getReborns(cid) .."]\n Military Rank: " .. rank.rank)

After:

PHP:
doPlayerSetSpecialDescription(thing.uid, "\n[Reborns: " .. getReborns(thing.uid) .."]\n Military Rank: " .. rank.rank)

But it doesn't work... Any idea?
 
[cpp]std::string Player::getDescription(int32_t lookDistance, const Player* looker) const
{
std::stringstream s;
if(lookDistance == -1)
{
s << "yourself.";
if(hasFlag(PlayerFlag_ShowGroupNameInsteadOfVocation))
s << " You are " << group->getName();
else if(vocation_id != 0)
s << " You are " << vocation->getDescription();
else
s << " You have no vocation";
}
else
{
s << nameDescription;
if(!hasCustomFlag(PlayerCustomFlag_HideLevel))
s << " (Level " << level << ")";

s << ". " << (sex % 2 ? "He" : "She");
if(hasFlag(PlayerFlag_ShowGroupNameInsteadOfVocation))
s << " is " << group->getName();
else if(vocation_id != 0)
s << " is " << vocation->getDescription();
else
s << " has no vocation";
}

s << getSpecialDescription();[/cpp]
move s << getSpecialDescription(); below }
 
Back
Top