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

[Onlook]

Tjay

Retired Hoster
Joined
Nov 25, 2009
Messages
588
Reaction score
69
Location
Behind you. Look out!
I just Put a Rebirth system into my server and i have everything working right. Besides one thing and thats the onlook.lua i have its not working, but im not getting any errors. this is what i have at the moment.

Code:
local minlvl = 80000
local newlvl = 8

function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) then
local rebirth = math.floor(((getCreatureMaxHealth(thing.uid)-(getVocationInfo(getPlayerVocation(thing.uid)).hea lthGain*getPlayerLevel(thing.uid)+150))/((minlvl-1-newlvl)*getVocationInfo(getPlayerVocation(thing.ui d)).healthGain)))
if getPlayerSex(thing.uid) == 0 and rebirth > 0 then
doPlayerSendTextMessage(cid, 25,"You see " .. getCreatureName(thing.uid) .. "(Level " .. getPlayerLevel(thing.uid) .. "). She is a " .. getVocationInfo(getPlayerVocation(thing.uid)).name .. ". She was "..rebirth.." times reborn.")
elseif getPlayerSex(thing.uid) == 1 and rebirth > 0 then
doPlayerSendTextMessage(cid, 25,"You see " .. getCreatureName(thing.uid) .. "(Level " .. getPlayerLevel(thing.uid) .. "). He is a " .. getVocationInfo(getPlayerVocation(thing.uid)).name .. ". He was "..rebirth.." times reborn.")
else
doPlayerSendTextMessage(cid, 25,"You see " .. getCreatureName(thing.uid) .. "(Level " .. getPlayerLevel(thing.uid) .. "). It is a " .. getVocationInfo(getPlayerVocation(thing.uid)).name .. ".")
end
end
return false
end

and this in Creaturescripts.lua
Code:
<event type="look" name="test" event="script" value="onlook.lua"/>

Anyone know what i need to do for this to work. it should be like

You see player name(level). He is vocation. he was rebirth X times.

Thanks,
Tjay
 
Lua:
local minlvl = 80000
local newlvl = 8

function onLook(cid, thing, position, lookDistance)
	if(not isPlayer(thing.uid)) then
		return true
	end
	
	local rebirth = math.floor(((getCreatureMaxHealth(thing.uid) - (getVocationInfo(getPlayerVocation(thing.uid)).healthGain * getPlayerLevel(thing.uid) + 150)) / ((minlvl - 1 - newlvl) * getVocationInfo(getPlayerVocation(thing.uid)).healthGain)))
	if(rebirth > 0) then	
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see " .. getCreatureName(thing.uid) .. "(Level " .. getPlayerLevel(thing.uid) .. "). " .. (getPlayerSex(thing.uid) == 0 and "She" or "He") .. " is a " .. getVocationInfo(getPlayerVocation(thing.uid)).name .. ". " .. (getPlayerSex(thing.uid) == 0 and "She" or "He") .. " was " .. rebirth .. " times reborn.")
	end
	
	return false
end
 
Back
Top