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

Action Extra exp rate scroll

mpa

Member
Joined
Oct 8, 2008
Messages
319
Reaction score
13
Location
Sweden
This is my first (working) script!
I've tested it and it works.

When you use poweritem you will get 5x extra exprate.

PHP:
local poweritem = 1958
local rate = 5

function onUse(cid, item)
            if doPlayerRemoveItem(cid, poweritem, 1) == 1 then            
            setPlayerExtraExpRate(cid, getPlayerextraExpRate(cid) + rate)
            doSendAnimatedText(getThingPos(cid), "Power!", TEXTCOLOR_RED)
            doPlayerSendTextMessage(cid,19, 'Your extra exprate is now ' .. rate .. '!')
end
return TRUE
end
 
Last edited:
I would change one since if the player already had some 'extra exp rate' it will be changed on 5 and better if only was + 5
Code:
setPlayerExtraExpRate(cid, getPlayerextraExpRate(cid) + rate)
 
I would change one since if the player already had some 'extra exp rate' it will be changed on 5 and better if only was + 5
Code:
setPlayerExtraExpRate(cid, getPlayerextraExpRate(cid) + rate)
Thanks, changed it :thumbup:
 
an fixx

Lua:
local config = {
         local poweritem = 1958
         local rate = 5
}

function onUse(cid, item)
            if doPlayerRemoveItem(cid, poweritem, 1) == 1 then            
            setPlayerExtraExpRate(cid, getPlayerextraExpRate(cid) + rate)
            doSendAnimatedText(getThingPos(cid), "Power!", TEXTCOLOR_RED)
            doPlayerSendTextMessage(cid,19, 'Your extra exprate is now ' .. rate .. '!')
end
return 1
end
 
an fixx

Lua:
local config = {
         local poweritem = 1958
         local rate = 5
}

function onUse(cid, item)
            if doPlayerRemoveItem(cid, poweritem, 1) == 1 then            
            setPlayerExtraExpRate(cid, getPlayerextraExpRate(cid) + rate)
            doSendAnimatedText(getThingPos(cid), "Power!", TEXTCOLOR_RED)
            doPlayerSendTextMessage(cid,19, 'Your extra exprate is now ' .. rate .. '!')
end
return 1
end

Won't work...
Fixed:
Lua:
local config = {
         local item = 1958,
         local rate = 5
}

function onUse(cid, item)
	if doPlayerRemoveItem(cid, config.item, 1) == true then            
		setPlayerExtraExpRate(cid, getPlayerextraExpRate(cid) + config.rate)
		doSendAnimatedText(getCreaturePosition(cid), "Exp!", TEXTCOLOR_RED)
		doPlayerSendTextMessage(cid, 19, 'Your extra exp rate is now ' .. getPlayerextraExpRate(cid) .. '!')
	end
	return true
end
 
Won't work...
Fixed:
Lua:
local config = {
         local item = 1958,
         local rate = 5
}

function onUse(cid, item)
	if doPlayerRemoveItem(cid, config.item, 1) == true then            
		setPlayerExtraExpRate(cid, getPlayerextraExpRate(cid) + config.rate)
		doSendAnimatedText(getCreaturePosition(cid), "Exp!", TEXTCOLOR_RED)
		doPlayerSendTextMessage(cid, 19, 'Your extra exp rate is now ' .. getPlayerextraExpRate(cid) .. '!')
	end
	return true
end

PHP:
[29/10/2009 15:41:56] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/expitem.lua)
[29/10/2009 15:41:56] data/actions/scripts/other/expitem.lua:2: unexpected symbol near 'local'
 
Sorry don't fixed all bugs:
Lua:
  local config = {
         item = 1958,
         rate = 5
}

function onUse(cid, item)
        if doPlayerRemoveItem(cid, config.item, 1) == true then            
                setPlayerExtraExpRate(cid, getPlayerExtraExpRate(cid) + config.rate)
                doSendAnimatedText(getCreaturePosition(cid), "Exp!", TEXTCOLOR_RED)
                doPlayerSendTextMessage(cid, 19, 'Your extra exp rate is now ' .. getPlayerextraExpRate(cid) .. '!')
        end
        return true
end
 
Last edited:
Sorry don't fixed all bugs:
Lua:
  local config = {
         item = 1958,
         rate = 5
}

function onUse(cid, item)
        if doPlayerRemoveItem(cid, config.item, 1) == true then            
                setPlayerExtraExpRate(cid, getPlayerextraExpRate(cid) + config.rate)
                doSendAnimatedText(getCreaturePosition(cid), "Exp!", TEXTCOLOR_RED)
                doPlayerSendTextMessage(cid, 19, 'Your extra exp rate is now ' .. getPlayerextraExpRate(cid) .. '!')
        end
        return true
end



PHP:
[29/10/2009 17:41:44] Lua Script Error: [Action Interface] 
[29/10/2009 17:41:45] data/actions/scripts/other/expitem.lua:onUse

[29/10/2009 17:41:45] data/actions/scripts/other/expitem.lua:8: attempt to call global 'getPlayerextraExpRate' (a nil value)
[29/10/2009 17:41:46] stack traceback:
[29/10/2009 17:41:46] 	data/actions/scripts/other/expitem.lua:8: in function <data/actions/scripts/other/expitem.lua:6>
 
Back
Top