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

Windows Talkactions

Status
Not open for further replies.

Nikkster

Programmer
Joined
May 9, 2008
Messages
2,848
Reaction score
10
Location
Confidential
Hello, I need help with 3 different talkactions which are not working properly:

Server version: TFS 0.3.4PL2

The first one is bless.lua it's supposed to give all kind of blessings to your character when saying !bless, it takes the money but it doesn't bless your character, here is the script:

Code:
function onSay(cid, words, param)
    if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    else
        if doPlayerRemoveMoney(cid, 60000) == TRUE then
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
        else
            doPlayerSendCancel(cid, "You need 6 crystal coin to get blessed!")
        end
    end    
    return 1
end

And then we got the aol.lua, same problem as Bless.lua

Code:
local cost = 50000 -- How much does it cost?
local item = 2173 -- What item do you get?
local quantity = 1 -- How many do you get?
 
function onSay(cid, words, param)
    if doPlayerRemoveMoney(cid, cost) == 1 then
        doPlayerAddItem(cid, item, quantity)
    else
        doPlayerSendCancel(cid, "You have not enough gold.")
    end
    return 1
end

And the last one, the Demonhunter outfit that you are supposed to recieve for an Ancient Parchment. It takes the Ancient Parchment but you won't get the addon, even if you relog.

Demonhunter.lua
Code:
function onSay(cid, words, param)
	removenugget = doPlayerRemoveItem(cid, 8701, 1)
		if removenugget == 1 and getPlayerSex(cid) == 0 then
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
		doPlayerAddOutfit(cid, 288, 1)
		doPlayerAddOutfit(cid, 288, 2)
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You are now a true demonhunter!")
		elseif removenugget == 1 and getPlayerSex(cid) == 1 then
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
		doPlayerAddOutfit(cid, 289, 1)
		doPlayerAddOutfit(cid, 289, 2)
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You are now a true demonhunter!")
end
end

If anyone help me with these, I appreciate and will give you reputation points (19) of course.

/nikkster
 
LUA:
-----------------------By Nahruto--------------------------
-------------------http://otfans.net/----------------------
 function getPlayerMoney(cid)
gold = getPlayerItemCount(cid,2148)
plat = getPlayerItemCount(cid,2152)*100
crys = getPlayerItemCount(cid,2160)*10000
money = gold + plat + crys
return money
end
local items = {
    ["aol"] = {cash=50000, id=2173, amount=1}
} 
---------End Config ---------
function onSay(cid, words, param)
bitem = items[param]
        if (bitem ~= nil) then
            if getPlayerMoney(cid) >= bitem.cash then
                doPlayerAddItem(cid,bitem.id,bitem.amount)
                doPlayerRemoveMoney(cid,bitem.cash)
            else
                doPlayerSendCancel(cid,"Sorry, you dont have enough money")
            end
        else
            doPlayerSendCancel(cid, "Invalid item.")            
        end
return 1
end

i found that for aol
 
LUA:
-----------------------By Nahruto--------------------------
-------------------http://otfans.net/----------------------
 function getPlayerMoney(cid)
gold = getPlayerItemCount(cid,2148)
plat = getPlayerItemCount(cid,2152)*100
crys = getPlayerItemCount(cid,2160)*10000
money = gold + plat + crys
return money
end
local items = {
    ["aol"] = {cash=50000, id=2173, amount=1}
} 
---------End Config ---------
function onSay(cid, words, param)
bitem = items[param]
        if (bitem ~= nil) then
            if getPlayerMoney(cid) >= bitem.cash then
                doPlayerAddItem(cid,bitem.id,bitem.amount)
                doPlayerRemoveMoney(cid,bitem.cash)
            else
                doPlayerSendCancel(cid,"Sorry, you dont have enough money")
            end
        else
            doPlayerSendCancel(cid, "Invalid item.")            
        end
return 1
end

i found that for aol

tested with the talkactino "!aol" and it didn't work, nothing happens, just like you say it in-game.

And what about the others?
 
blessings
LUA:
function onSay(cid, words, param)
    if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    else
        if doPlayerRemoveMoney(cid, 60000) == true then
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
        else
            doPlayerSendCancel(cid, "You need 6 crystal coins to get blessed!")
        end
    end    
    return true
end

aol
LUA:
local cost = 50000 -- How much does it cost?
local item = 2173 -- What item do you get?
local quantity = 1 -- How many do you get?
 
function onSay(cid, words, param)
    if doPlayerRemoveMoney(cid, cost) == true then
        doPlayerAddItem(cid, item, quantity)
    else
        doPlayerSendCancel(cid, "You have not enough gold.")
    end
    return true
end

demonhunter outfit (your was done in wrong way also)
LUA:
function onSay(cid, words, param)
	removenugget = doPlayerRemoveItem(cid, 8701, 1)
		if removenugget == true then
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
		doPlayerAddOutfit(cid, 288, 3)
		doPlayerAddOutfit(cid, 288, 3)
		doPlayerAddOutfit(cid, 289, 3)
		doPlayerAddOutfit(cid, 289, 3)
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You are now a true demonhunter!")
end
end

They have to work because I've just tested them :)
 
Last edited:
lolwut.
I'm not quite advanced with this stuff, but how can you add a dubble else? XD.

I think about this: (Edit of life's code)

LUA:
function onSay(cid, words, param)

if getPlayerBlessing(cid,5) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
elseif doPlayerRemoveMoney(cid, 15000) == TRUE then
for i = 1,5 do
doPlayerAddBlessing(cid,i)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 15,000 gp in backpack for blessings.")
end
end
end
 
Status
Not open for further replies.
Back
Top