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

Help with add item talkaction

Elcohe

New Member
Joined
May 10, 2020
Messages
6
Reaction score
2
Location
México
Hello community, I'd like to know if some of you could help me figure out a God talkaction that adds money to player's bank account in Otservbr TFS 1.3.
 
Ok. So what have you tried so far? What scripts have you found using the search tool? How far have you got?
Thanks for your reply. Since I have basically no knowledge I've tried modifying this to add directly gold to player this way, but it won't work, so I'd like to know if might work some other way, as I repeat I have no knowledge what I'm doing wrong

local addgoldCoins = TalkAction("/addgold")

function addgoldCoins.onSay(player, words, param)

if not player:getGroup():getAccess() or player:getAccountType() < ACCOUNT_TYPE_GOD then
return true
end
local usage = "/addgold PLAYER NAME,GOLD AMOUNT"
if param == "" then
player:sendCancelMessage("Command param required. Usage: ".. usage)
return false
end

local split = param:split(",")
if not split[2] then
player:sendCancelMessage("Insufficient parameters. Usage: ".. usage)
return false
end

local target = Player(split[1])
if not target then
player:sendCancelMessage("A player with that name is not online.")
return false
end
split[2] = split[2]:gsub("^%s*(.-)$", "%1")

player:sendCancelMessage("Added " .. split[2] .. " gold coins to the character '" .. target:getName() .. "'.")
target:sendCancelMessage("Received " .. split[2] .. " gold coins!")
target:addGoldCoins(tonumber(split[2]))
target:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)


end
goldCoins:separator(" ")
goldCoins:register()
 
Back
Top