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

Solved.

Nashalito

New Member
Joined
May 21, 2009
Messages
273
Reaction score
0
Hello guys, i got a problem with my script . When i open serv i get this error.

[14/10/2010 19:27:44] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/levelrebalance.lua:4: 'end' expected (to close 'function' at line 1) near 'else'
[14/10/2010 19:27:44] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/levelrebalance.lua)
[14/10/2010 19:27:44] data/creaturescripts/scripts/levelrebalance.lua:4: 'end' expected (to close 'function' at line 1) near 'else'

This is my scipt for levelrebelance


PHP:
function onLogin(cid)
local rebalanceStor = getPlayerStorageValue(cid, 37454)

    else if rebalanceStor == -1 and getPlayerLevel(cid) < 50 then
    doPlayerAddExperience(cid, (getExperienceForLevel(50) - getPlayerExperience(cid)))
    setPlayerStorageValue(cid, 37454, 1)
    
    else setPlayerStorageValue(cid, 37454, 1)

end
return TRUE
end


i use tfs 0.3.6
 
Lua:
function onLogin(cid)
	if getPlayerStorageValue(cid, 37454) == -1 and getPlayerLevel(cid) < 50 then
		doPlayerAddExperience(cid, getExperienceForLevel(50) - getPlayerExperience(cid))
		setPlayerStorageValue(cid, 37454, -1)
	else
		setPlayerStorageValue(cid, 37454, 1)
	end
	return true
end
 
thanks thanks bro . now i got another problem..

when some1 dies i want the last hit that he get reward 5 platinum coins
i got that script but doesnt work.

Lua:
function onKill(cid, target, lastHit)
local reward = {
item = 2152, --ITEM ID!
count = 5 -- How many?
}
if(isPlayer(cid) and isPlayer(target)) then
if getPlayerIp(cid) ~= getPlayerIp(target) then
doPlayerAddItem(cid, reward.item, reward.count)
else
doPlayerAddExperience(cid, -1000000)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a player of the same IP.")
end
end
return TRUE
end

i want the mc check to in the script
 
Code:
function onKill(cid, target, lastHit)
local reward = {
        item = 2152, --ITEM ID!
        count = 5 -- How many?
}
        if(isPlayer(cid) and isPlayer(target)) then
	if getPlayerIp(cid) ~= getPlayerIp(target) then
                doPlayerAddItem(cid, reward.item, reward.count)
else
doPlayerAddExperience(cid, -1000000)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You cannot boost your levels on your own IP.")
                end
end
return TRUE
end
 
Don't know if lastHit is a boolean, if it is, this won't work.

Lua:
local i,c,e = 2152,5,-1000000
function onKill(cid,target,lastHit)
local k = getCreatureName(lastHit)
    if isPlayer(k) and isPlayer(target) then
        if getPlayerIp(k) ~= getPlayerIp(target) then
            doPlayerAddItem(k,i,c)
        else
            doPlayerAddExperience(k,e)
            doPlayerSendTextMsesage(k,MESSAGE_STATUS_CONSOLE_BLUE,'You can\'t may not kill players with same IP.')
        end
    end
    return true
end
 
Last edited:
Back
Top