Action Extra exp rate scroll

mpa

Member
Joined
Oct 8, 2008
Messages
319
Best answers
0
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:

GangsteR

RPG Maker
Joined
Jul 1, 2007
Messages
815
Best answers
0
Reaction score
2
Location
Turkiye
Thanks mate ! :)
But if i logout i get normal exp again ?
 

Marcinek123

Badboy
Joined
Jan 21, 2008
Messages
49
Best answers
0
Reaction score
0
Location
Poland
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)
 
OP
mpa

mpa

Member
Joined
Oct 8, 2008
Messages
319
Best answers
0
Reaction score
13
Location
Sweden
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:
 

Inteligentny

Im not.
Joined
Aug 2, 2008
Messages
485
Best answers
0
Reaction score
0
How to make it works only for example 5 hours? could u make config able this?
 

hakkun

New Member
Joined
Oct 26, 2009
Messages
2
Best answers
0
Reaction score
0
Im not good in english. Where i add this script??!?!?!?
 

Rachaw

Experienced Member
Joined
Oct 17, 2009
Messages
602
Best answers
0
Reaction score
1
Location
Tha Sweden
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
 

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany
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
 

Orkhz

New Member
Joined
Sep 11, 2009
Messages
301
Best answers
0
Reaction score
0
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'
 

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,976
Best answers
2
Reaction score
101
Location
Germany
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:

Orkhz

New Member
Joined
Sep 11, 2009
Messages
301
Best answers
0
Reaction score
0
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>
 
Top