• 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] Frag problems

Tjay

Retired Hoster
Joined
Nov 25, 2009
Messages
588
Reaction score
69
Location
Behind you. Look out!
For Some Reason my Frags arent working and ive changed just tried using the basic login.lua with the 1st code below. If i use that one the frags work but if i use the 2nd code below they dont. Can anyone tell whats causing it in?

Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end
	return TRUE
end
Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
local items = {
    [0] = { 8819, 8820, 2468, 2509, 2643, 2190, 7620, 2175, 7731, 5710, 2160, 2173 },
    [1] = { 8819, 8820, 2468, 2509, 2643, 2190, 7620, 2175, 7731, 5710, 2160, 2173 },
    [2] = { 8819, 8820, 2468, 2509, 2643, 2182, 7620, 2175, 7731, 5710, 2160, 2173 },
    [3] = { 2509, 2643, 8923, 8891, 2481, 2389, 7620, 2175, 7731, 5710, 2160, 2173 },
    [4] = { 2643, 2478, 2465, 2481, 2509, 2383, 7620, 2175, 7731, 5710, 2160, 2173 }
}
function onLogin(cid)

local target = cid
if getPlayerStorageValue(cid, 999999) > 0 then
doAddSpecialExhaust(target,getPlayerStorageValue(cid, 999999))
end

if getPlayerStorageValue(cid, 1987) > 0 then
setPlayerStorageValue(cid, 1987, 0)
end
if getPlayerStorageValue(cid, 20015) > 0 then
if getPlayerStorageValue(cid, 20015) < 11 then
setPlayerStorageValue(cid, 20015, 0)
end
end

if getPlayerStorageValue(cid, 50781) == 1 then
setPlayerStorageValue(cid, 50781, 0)
end

local temple = {x=501, y=807, z=7}


if getPlayerStorageValue(cid, 6612) == 1 then
setPlayerStorageValue(cid, 6612, 0)
doPlayerPopupFYI(cid, "You have recently died, but since you are below level 200 you did not lose anything.\n At 201+ you will lose levels/items and PVP will be ON.")
end


if getPlayerStorageValue(cid, 2000) > 0 then
setPlayerStorageValue(cid, 2000, 0)
end

	if getPlayerStorageValue(cid, 12346) <=0 then
		doTeleportThing(cid,temple, FALSE)
		setPlayerStorageValue(cid, 12346, 1)
end

    if getPlayerStorageValue(cid, 30001) == -1 then
        for voc, item in pairs(items) do
            if getPlayerVocation(cid) == voc then
                local container = doPlayerAddItem(cid, 2000, 1)
                for i = 1, table.maxn(item) do
                    doAddContainerItem(container, item[i], 1)
                end
                setPlayerStorageValue(cid, 30001, 1)
            end
        end
    end
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end
	
	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "onPrepareDeath")
	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "advance")
	registerCreatureEvent(cid, "PrepareDeath")
	registerCreatureEvent(cid, "onDeath")
--(hunting graphics)	registerCreatureEvent(cid, "kill")
--Reflect Spells
registerCreatureEvent(cid, "ReflectSpellKnight")
registerCreatureEvent(cid, "ReflectSpellPally")
registerCreatureEvent(cid, "ReflectSpellMage")
--DeathNote
registerCreatureEvent(cid, "Rebirth")
registerCreatureEvent(cid, "DeathNote") 
--Vocation Items
registerCreatureEvent(cid, "KnightShieldBlock")
	registerCreatureEvent(cid, "xmasArena")
		registerCreatureEvent(cid, "satan")
	registerCreatureEvent(cid, "teamchannels")
	registerCreatureEvent(cid, "eventtimers")
    doCreatureSay(cid, "Welcome!", 20)
	registerCreatureEvent(cid, "onPrepareDeath")
	doCreatureSetDropLoot(cid, false)
	return true
end

Thanks,
Tjay
 
maybe one of you creatureevents is bugged, check out the events with the following names:
onPrepareDeath, PrepareDeath, onDeath

you can try removing their lines from login.lua, etc
 
Back
Top