Hi,
this is the function I have created in server\lua folder called passTarget.lua. It should enable you to pass the player target table from spells for example, and access it from another folder.
This is the code I have my in my spells:
This is the code I have in my talkactions:
But it does not work and I am not sure why. When I use the command in talkactions WITHOUT actually passing any variables i.e. without casting the spell (the one that should actually pass the target variable), it will print some table even though I have not passed anything -> it will print that in the console window.
this is the function I have created in server\lua folder called passTarget.lua. It should enable you to pass the player target table from spells for example, and access it from another folder.
Lua:
local value = {}
local function saveTarget(originalTarget)
return originalTarget
end
value.saveTarget = saveTarget
value.getTarget = value.saveTarget
return value
This is the code I have my in my spells:
Lua:
local file = require("passTarget")
function onCastSpell(cid, var)
local player = Player(cid)
local target = player:getTarget()
file.saveTarget(target)
return combat:execute(cid, var)
end
This is the code I have in my talkactions:
Lua:
local file = require("passTarget")
function onSay(cid, words, param)
print(file.getTarget)
return false
end
But it does not work and I am not sure why. When I use the command in talkactions WITHOUT actually passing any variables i.e. without casting the spell (the one that should actually pass the target variable), it will print some table even though I have not passed anything -> it will print that in the console window.