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

cat should have 7 lives

agomez

Member
Joined
Jan 28, 2009
Messages
211
Reaction score
5
i got this script
PHP:
function onKill(cid, target)
local monsters = {
	["Cat"] = {
		text = {"The cat lost her 7 lives! :D", "This sucker have lost his lives! :D"},
		emotes = {"MjaaaUUU1!!", "LoL sucker"},
		effect = 49,
		lives = 7
		},
	["Trainer"] = {
		text = {}, -- No message after death needed, the Trainer can't die.
		emotes = {"You can't kill me!!!??", "I'm a training monk!"},
		effect = 0, -- 0 for no effects.
		lives = 0 -- 0 for imortality
		}
}
 
	local select = monsters[getCreatureName(target)]
 
	if select ~= nil then
		local id = getGlobalStorageValue(target)
		if id >= select.lives and select.lives ~= 0 then
			if select.text[1] ~= nil then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, select.text[math.random[1, #select.text]])
			end
		else
			setGlobalStorageValue(target,((lives ~= nil and (id == -1 and 1) or id+1) or -1))
			doCreatureAddHealth(target, getCreatureMaxHealth(target), 1)
			doSendMagicEffect(getCreaturePosition(target), select.effect)
			if select.emotes[1] ~= nil then
				doPlayerSendTextMessage(target, select.emotes[math.random[1, #select.emotes]], TALKTYPE_ORANGE_1)
			end
			return false
		end
	end
	return true
end

but isnt work :<
 
[19/12/2010 17:22:51] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/cat.lua)
[19/12/2010 17:22:51] data/creaturescripts/scripts/cat.lua:23: ']' expected near ','

that :P
 
PHP:
function onKill(cid, target)
local monsters = {
    ["Cat"] = {
        text = {"The cat lost her 7 lives! :D", "This sucker have lost his lives! :D"},
        emotes = {"MjaaaUUU1!!", "LoL sucker"},
        effect = 49,
        lives = 7
        },
    ["Trainer"] = {
        text = {}, -- No message after death needed, the Trainer cant die.
        emotes = {"You cant kill me!!!??", "Im a training monk!"},
        effect = 0, -- 0 for no effects.
        lives = 0 -- 0 for imortality
        }
}
 
    local select = monsters[getCreatureName(target)]
 
    if select ~= nil then
        local id = getGlobalStorageValue(target)
        if id >= select.lives and select.lives ~= 0 then
            if select.text[1] ~= nil then
				doPlayerSendTextMessage(cid, select.text[math.random[1, #select.text]], MESSAGE_INFO_DESCR)
            end
        else
            setGlobalStorageValue(target,((lives ~= nil and (id == -1 and 1) or id+1) or -1))
            doCreatureAddHealth(target, getCreatureMaxHealth(target), 1)
            doSendMagicEffect(getCreaturePosition(target), select.effect)
            if select.emotes[1] ~= nil then
                doPlayerSendTextMessage(target, select.emotes[math.random[1, #select.emotes]], TALKTYPE_ORANGE_1)
            end
            return false
        end
    end
    return true
end
 
the same error:

[19/12/2010 17:54:34] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/cat.lua:23: ']' expected near ','
[19/12/2010 17:54:34] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/cat.lua)
[19/12/2010 17:54:34] data/creaturescripts/scripts/cat.lua:23: ']' expected near ','

=(
 
LUA:
function onKill(cid, target)
local monsters = {
    ["Cat"] = {
        text = {"The cat lost her 7 lives! :D", "This sucker have lost his lives! :D"},
        emotes = {"MjaaaUUU1!!", "LoL sucker"},
        effect = 49,
        lives = 7
        },
    ["Trainer"] = {
        text = {}, -- No message after death needed, the Trainer cant die.
        emotes = {"You cant kill me!!!??", "Im a training monk!"},
        effect = 0, -- 0 for no effects.
        lives = 0 -- 0 for imortality
        }
}
 
    local select = monsters[getCreatureName(target)]
 
    if select ~= nil then
        local id = getGlobalStorageValue(target)
        if id >= select.lives and select.lives ~= 0 then
            if select.text[1] ~= nil then
                doPlayerSendTextMessage(cid, select.text[math.random(1, #select.text)], MESSAGE_INFO_DESCR)
            end
        else
            setGlobalStorageValue(target,((lives ~= nil and (id == -1 and 1) or id+1) or -1))
            doCreatureAddHealth(target, getCreatureMaxHealth(target), 1)
            doSendMagicEffect(getCreaturePosition(target), select.effect)
            if select.emotes[1] ~= nil then
                doPlayerSendTextMessage(target, select.emotes[math.random(1, #select.emotes)], TALKTYPE_ORANGE_1)
            end
            return false
        end
    end
    return true
end

Main error is fixed, I didnt look if it had any bugs though.
 
Code:
local monsters = {
    ["cat"] = {
        text = {"The cat lost her 7 lives! :D", "This sucker have lost his lives! :D"},
        emotes = {"MjaaaUUU1!!", "LoL sucker"},
        effect = 49,
        lives = 7
        },
    ["trainer"] = {
        text = {}, -- No message after death needed, the Trainer cant die.
        emotes = {"You cant kill me!!!??", "Im a training monk!"},
        effect = 0, -- 0 for no effects.
        lives = 0 -- 0 for imortality
        }
}

function onKill(cid, target) 
    local select = monsters[getCreatureName(target):lower()]
    if isMonster(target) and select then
        local id = getGlobalStorageValue(target)
        if id >= select.lives and select.lives ~= 0 then
            if select.text[1] ~= nil then
                doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,select.text[math.random(1, #select.text)])
            end
        else
            setGlobalStorageValue(target,((lives ~= nil and (id == -1 and 1) or id+1) or -1))
            doCreatureAddHealth(target, getCreatureMaxHealth(target), 1)
            doSendMagicEffect(getCreaturePosition(target), select.effect)
            if select.emotes[1] ~= nil then
                doCreatureSay(cid,select.emotes[math.random(1, #select.emotes)],TALKTYPE_ORANGE_1)
            end
            return false
        end
    end
    return true
end
 
Back
Top