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

EvilSkillz

Back
Joined
Jul 12, 2012
Messages
1,811
Solutions
2
Reaction score
390
Location
Egypt - Cairo
Listen every one
i will explain what i mean fast
i have a chest and have rebirth 100 with vocation druid
so if i click on this chest it's will make my rebirth 75 also will change my vocation to sorcerer

i do script but it's change vocation but don't decrease my rebirth
LUA:
local str = 85987
local rebirth = 100
 
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getCreatureStorage(cid, str) >= rebirth then
	if not isSorcerer(cid) then
		doPlayerSetVocation(cid, 1)
		doSetCreatureStorage(cid, rebirth, 75)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "only Vocations with 100 Rebirth may use this chest.")
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "your vocation has been changed to sorcerer.")
		doRemoveCreature(cid)
	end
	end
	return true
end

anyway i got this error
Code:
11/06/2013 17:18:02] [Error - Action Interface] 
[11/06/2013 17:18:02] data/actions/scripts/other/chest.luanUse
[11/06/2013 17:18:02] Description: 
[11/06/2013 17:18:02] data/actions/scripts/other/chest.lua:9: attempt to call global 'doSetCreatureStorage' (a nil value)
[11/06/2013 17:18:02] stack traceback:
[11/06/2013 17:18:02] data/actions/scripts/other/chest.lua:9: in function <data/actions/scripts/other/chest.lua:5>
[11/06/2013 17:18:02] Wizava has logged out.
[11/06/2013 17:18:04] Wizava has logged in.
 
LUA:
local str = 85987
local rebirth = 100
 
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getCreatureStorage(cid, str) == rebirth and not isSorcerer(cid) then
		doPlayerSetVocation(cid, 1)
		doSetCreatureStorage(cid, rebirth-25)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "your vocation has been changed to sorcerer.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "only Vocations with 100 Rebirth may use this chest.")
		doRemoveCreature(cid)
	end
	return true
end
 
Same Error Brother
it's change vocation and never less count of rebirth
also same error in console
Code:
[12/06/2013 00:52:54] [Error - Action Interface] 
[12/06/2013 00:52:54] data/actions/scripts/other/chest.lua:onUse
[12/06/2013 00:52:54] Description: 
[12/06/2013 00:52:54] data/actions/scripts/other/chest.lua:8: attempt to call global 'doSetCreatureStorage' (a nil value)
[12/06/2013 00:52:54] stack traceback:
[12/06/2013 00:52:54] 	data/actions/scripts/other/chest.lua:8: in function <data/actions/scripts/other/chest.lua:5>
[12/06/2013 00:52:54] Wizava has logged out.
[12/06/2013 00:52:56] Wizava has logged in.
 
The function is wrong.

LUA:
local str = 85987
local rebirth = 100
 
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getCreatureStorage(cid, str) == rebirth and not isSorcerer(cid) then
		doPlayerSetVocation(cid, 1)
		doCreatureSetStorage(cid, rebirth-25)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "your vocation has been changed to sorcerer.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "only Vocations with 100 Rebirth may use this chest.")
		doRemoveCreature(cid)
	end
	return true
end
 
Back
Top