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

doPlayerSetExtraExpRate.. didnt work for me

hepy

New Member
Joined
Aug 15, 2007
Messages
217
Reaction score
1
Hi im having some trouble with this script:
Code:
if isPremium(cid) then
		doPlayerSetExtraExpRate(cid, 2)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Se ha activado tu VIP extra exp rate.")
end

error:
Code:
[9:58:22.636] [Error - CreatureScript Interface]
[9:58:22.636] data/creaturescripts/scripts/login.lua:onLogin
[9:58:22.636] Description:
[9:58:22.636] data/creaturescripts/scripts/login.lua:39: attempt to call global 'doPlayerSetExtraExpRate' (a nil value)
[9:58:22.636] stack traceback:
[9:58:22.636]   data/creaturescripts/scripts/login.lua:39: in function <data/creaturescripts/scripts/login.lua:37>

the idea is premium players get extra exp rate at login
im using this function cause it says so in the doc file.. but idk why isnt working

any idea? thanks
im usin TFS 0.4 rev 3840
 
Hi im having some trouble with this script:
Code:
if isPremium(cid) then
		doPlayerSetExtraExpRate(cid, 2)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Se ha activado tu VIP extra exp rate.")
end

error:
Code:
[9:58:22.636] [Error - CreatureScript Interface]
[9:58:22.636] data/creaturescripts/scripts/login.lua:onLogin
[9:58:22.636] Description:
[9:58:22.636] data/creaturescripts/scripts/login.lua:39: attempt to call global 'doPlayerSetExtraExpRate' (a nil value)
[9:58:22.636] stack traceback:
[9:58:22.636]   data/creaturescripts/scripts/login.lua:39: in function <data/creaturescripts/scripts/login.lua:37>

the idea is premium players get extra exp rate at login
im using this function cause it says so in the doc file.. but idk why isnt working

any idea? thanks
im usin TFS 0.4 rev 3840

doPlayerSetRate(cid, type, value)

You can't just exchange a functions parameters with a simple space, it's not the way it works. It makes the function invalid. If you don't have anything to insert into a parameter then don't edit it at all.

In this case you removed the "type" parameter. It stands for the different kinds of skills which Chojrak already proved above of my post. Just making sure if you copy&pasted Chojrak's example without understanding.
 
@up:
look: doPlayerSetExtraExpRate(cid, value), that what it says on the lua_functions DOC file from my rev...so i though this function could work cause it is in the doc file... look at my script i wasnt using the function from Chojrak.. only this, and thanks i understand that i must use all the parameters :)

but this function isnt working for me.. i got no errors, but i dont have the extra exp rate, when i log in with a premium player i only get the
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Se ha activado tu VIP extra exp rate.")
any idea? thanks :)
 
Ah sorry, I didn't read your whole comment haha xD.. I can make you a script give me a second
 
Last edited:
@up
i think you didnt understood... when i log in i dont get the extra exp rate i only get the message... the function isnt working
 
I was working on a script for you, but now I have to go so you can keep on advancing it yourself and maybe finish it. I was going to test it because I'm not familiar with so many functions because of I've been idle from scripting for some time now. but try this

Lua:
function onLogin(cid)
	if isPremium(cid) and getPlayerStorageValue(cid, 1499) then
		doPlayerSetRate(cid, SKILL__LEVEL, 2)
		setPlayerStorageValue(cid, 1500)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your exp rate was set doubled " ..getPlayerExtraExpRate(cid).." times.")
	elseif(not [isPremium(cid)]) and getPlayerStorage 1399 then
		getExperienceStageList()
		doPlayerSetRate(cid, SKILL__LEVEL, [getExperienceStage(level)])
		setPlayerStorageValue(cid, 1400)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your exp rate was set to regular server rate.")
	else
		return
	end
end
 
oh really nice thx :D
but i think it wont work for me cause the function doPlayerSetRate(cid, SKILL__LEVEL, 2) isnt working :(
 
Last edited:
I was working on a script for you, but now I have to go so you can keep on advancing it yourself and maybe finish it. I was going to test it because I'm not familiar with so many functions because of I've been idle from scripting for some time now. but try this

Lua:
function onLogin(cid)
	if isPremium(cid) and getPlayerStorageValue(cid, 1499) then
		doPlayerSetRate(cid, SKILL__LEVEL, 2)
		setPlayerStorageValue(cid, 1500)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your exp rate was set doubled " ..getPlayerExtraExpRate(cid).." times.")
	elseif(not [isPremium(cid)]) and getPlayerStorage 1399 then
		getExperienceStageList()
		doPlayerSetRate(cid, SKILL__LEVEL, [getExperienceStage(level)])
		setPlayerStorageValue(cid, 1400)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your exp rate was set to regular server rate.")
	else
		return
	end
end

Experience rate is not doubled but set to "2". It's diffrence.
 
im using TFS 0.4 rev 3840 :)

@up: yes but it still dont work cause with free account i have 10x exp rate and with premium account too
 
You're not a newfag who needs a help with fixing. I am just poining wrong things. I like when somebody tells me that i have a wrong thing somewhere in code, i learn then to not make the same in future.

@Topic
Evil Mark's script after fixing would be good if we multiple a rate by current exp stage. Anyway when players stage changes, due this script it won't change till relog. It'll need onAdvance function either. I had same problem and has written simple c++ code which allows me to multiple current players exp stage, really easy. It was easier way than checking 3 events ;P
 
You're not a newfag who needs a help with fixing. I am just poining wrong things. I like when somebody tells me that i have a wrong thing somewhere in code, i learn then to not make the same in future.

@Topic
Evil Mark's script after fixing would be good if we multiple a rate by current exp stage. Anyway when players stage changes, due this script it won't change till relog. It'll need onAdvance function either. I had same problem and has written simple c++ code which allows me to multiple current players exp stage, really easy. It was easier way than checking 3 events ;P

It's not that I don't like being corrected. I've just had a fucked up day that's all.
 
Last edited:
hahah... now.. did anyone knows why this function isnt working? its not changing anything :)
bcuz 'doPlayerSetExtraExpRate' is deprecated at 0.4
don't always trust the DOC, it can be outdated with some functions
instead of that, check luascript.cpp (source file) & data/lib/050-functions.lua
 
Back
Top