- Joined
- Feb 14, 2015
- Messages
- 5,640
- Solutions
- 559
- Reaction score
- 3,976
TFS 0.3.6
I'm having a problem with this script, I don't get any errors but when I equip the exp ring, it sends the textmessages twice instead of only once and I have absolutely no idea why, can anyone help?
I'm having a problem with this script, I don't get any errors but when I equip the exp ring, it sends the textmessages twice instead of only once and I have absolutely no idea why, can anyone help?
Code:
local rates = {
[0] = {rate = 1},
[1] = {rate = 0.94},
[2] = {rate = 0.88},
[3] = {rate = 0.82},
[4] = {rate = 0.76},
[5] = {rate = 0.70},
[6] = {rate = 0.65},
[7] = {rate = 0.60},
[8] = {rate = 0.55},
[9] = {rate = 0.50},
[10] = {rate = 0.45},
[11] = {rate = 0.41},
[12] = {rate = 0.37},
[13] = {rate = 0.33},
[14] = {rate = 0.29},
[15] = {rate = 0.25},
[16] = {rate = 0.23},
[17] = {rate = 0.19},
[18] = {rate = 0.15},
[19] = {rate = 0.11},
[20] = {rate = 0.07},
[21] = {rate = 0.06},
[22] = {rate = 0.05},
[23] = {rate = 0.04},
[24] = {rate = 0.03},
[25] = {rate = 0.02}
}
function onDeEquip(cid, item, slot)
local pr = getPlayerStorageValue(cid, 85987)
local v = rates[pr]
doPlayerSetRate(cid, SKILL__LEVEL, v.rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "EXP Rate set back to ".. v.rate .."")
return true
end
function onEquip(cid, item, slot)
local pr = getPlayerStorageValue(cid, 85987)
local v = rates[pr]
doPlayerSetRate(cid, SKILL__LEVEL, (v.rate+v.rate*0.50))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ("Your prestige is [".. pr .."]. EXP Rate increased by: " .. v.rate*0.50 .. ""))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, ("EXP Rate is now ".. v.rate+v.rate*0.50 ..""))
return true
end