• 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 Why doesn't this work?

Wat

New Member
Joined
Mar 14, 2009
Messages
77
Reaction score
0
I'm trying to make it so when a player uses an item, he gets +2x EXP.

I've mashed some code together with some stuff I found on here, and it's not working.

Code:
local expitem = 9969
local extrarate = 7

function onUse(cid, item)
            setPlayerExtraExpRate(cid, extrarate)
            doPlayerSendTextMessage(cid,19, 'Your EXP rate is now ' .. rate .. '!')
end

When I comment out
Code:
  setPlayerExtraExpRate(cid, extrarate)

In actions.xml:

Code:
	<action itemid="9969" script="other/expring.lua"/>

It sends the message just fine, but not when it's uncommented D:

Help :O
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
setPlayerExtraExpRate(cid, 7)
doPlayerSendTextMessage(cid,19, 'Your EXP rate is now 7!')
        return TRUE
end
 
PHP:
local extrarate = 7

function onUse(cid, item)
            setPlayerExtraExpRate(cid, extrarate)
            doPlayerSendTextMessage(cid,19, 'Your EXP rate is now ' .. extrarate .. '!')
end

You didnt type right extrarate.
 
Why are you using extra exp rate when you stated that you want an amount of 2,000 experience points to be added to the player? o_o

PHP:
local config = {
     experience = 2000
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
     doPlayerAddExp(cid, config.experience)
     doSendAnimatedText(getCreaturePosition(cid), config.experience, TEXTCOLOR_WHITE)
     return TRUE
end
 
Back
Top