• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Scrip Problem

Ghost Knight

New Member
Joined
Nov 12, 2012
Messages
25
Reaction score
0
well this happen went i use the item

Code:
[16/11/2012 14:23:01] [Error - Action Interface] 
[16/11/2012 14:23:01] data/actions/scripts/spell1.lua:onUse
[16/11/2012 14:23:01] Description: 
[16/11/2012 14:23:01] data/actions/scripts/spell1.lua:8: attempt to call global 'doPlayerSendtextMessage' (a nil value)
[16/11/2012 14:23:01] stack traceback:
[16/11/2012 14:23:01] 	data/actions/scripts/spell1.lua:8: in function <data/actions/scripts/spell1.lua:2>


here scrip
Code:
local spell = "Fusion Spell"
function onUse(cid, item, fromPos, itemEx, toPos)
if getPlayerLearnedInstantSpell(cid, spell) then
doPlayerSendCancel(cid, "You already have this spell.")
else
doPlayerLearnInstantSpell(cid, spell)
doRemoveItem(item.uid, 1)
doPlayerSendtextMessage(cid, 22, "You have learned ".. spell .. " .")
end
return true
end
 
The global call means that it is trying to find a function "x" in your script and cannot find it. But as you already have it maybe the script is not in the right order. And also, what TFS version are you using?
 
You gotta capitalize your t in text.
LUA:
doPlayerSendTextMessage

LUA:
local spell = "Fusion Spell"
function onUse(cid, item, fromPos, itemEx, toPos)
if getPlayerLearnedInstantSpell(cid, spell) then
doPlayerSendCancel(cid, "You already have this spell.")
else
doPlayerLearnInstantSpell(cid, spell)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, 22, "You have learned ".. spell .. " .")
end
return true
end
 
Back
Top