• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction [ALL] Basic talkactions what you need at your OTS! [Fixed one]

Cornex

Web Developer
Staff member
Global Moderator
Joined
Jun 15, 2008
Messages
3,444
Solutions
5
Reaction score
1,166
Location
Sweden
Hello, this is update from http://otland.net/f81/all-basic-talkactions-what-you-need-your-ots-182192/

Since there was noworking scripts and more i update it.
Note, this script is tested in 0.4 should work down to 0.3~


Ok, lets start!

Go to your data/talkactions/talkactions.xml and put this lines in

Lua:
<talkaction words="!bless;/!blessings" script="bless.lua" />
<talkaction words="!aol" script="aol.lua" />
<talkaction words="!addon" event="script" value="addon.lua" />
<talkaction words="!spells" script="spellbook.lua"/>
<talkaction words="!commands;/commands" event="script" value="commands.lua"/>
<talkaction words="!online;/online" event="script" value="online.lua"/>

Not lets begin with the LUA part, go to data/talkactions/scripts

Make an file an name it bless.lua and paste this code in it :

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, 50000) == 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 50k to get blessed!")
        end
    end    
    return 1
end

Make an file an name it aol.lua and paste this code in it :

Lua:
function onSay(cid, words, param)  
        if doPlayerRemoveMoney(cid, 10000) == TRUE then  
doPlayerAddItem(cid, 2173, 1)  
                        doSendMagicEffect(getPlayerPosition(cid), 37)  
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have bought an amulet of loss!!')   
else  
         doSendMagicEffect(getPlayerPosition(cid), 2) 
            doPlayerSendCancel(cid,"You dont have enogh money to use !aol!") 
                end  
return TRUE  
                end

Make an file an name it addon.lua and paste this code in it :

Lua:
function onSay(cid, words, param) 
local femaleOutfits = { ["citizen"]={136}, ["hunter"]={137}, ["mage"]={138}, ["knight"]={139}, ["noblewoman"]={140}, ["summoner"]={141}, ["warrior"]={142}, ["barbarian"]={147}, ["druid"]={148}, ["wizard"]={149}, ["oriental"]={150}, ["pirate"]={155}, ["assassin"]={156}, ["beggar"]={157}, ["shaman"]={158}, ["norsewoman"]={252}, ["nightmare"]={269}, ["jester"]={270}, ["brotherhood"]={279}, ["demonhunter"]={288}, ["yalaharian"]={324}, ["warmaster"]={336}, ["wayfarer"]={367} } 
local maleOutfits = { ["citizen"]={128}, ["hunter"]={129}, ["mage"]={130}, ["knight"]={131}, ["nobleman"]={132},["summoner"]={133}, ["warrior"]={134}, ["barbarian"]={143}, ["druid"]={144}, ["wizard"]={145}, ["oriental"]={146}, ["pirate"]={151}, ["assassin"]={152}, ["beggar"]={153}, ["shaman"]={154}, ["norsewoman"]={251}, ["nightmare"]={268}, ["jester"]={273}, ["brotherhood"]={278}, ["demonhunter"]={289}, ["yalaharian"]={325}, ["warmaster"]={335}, ["wayfarer"]={366} } 
local msg = {"Command requires GOOD param!", "You dont have Addon Doll!", "Bad param!", "Full Addon Set sucesfully added!"} 
local param = string.lower(param) 
 
if(getPlayerItemCount(cid, 8982) > 0) then 
if(param ~= "" and maleOutfits[param] and femaleOutfits[param]) then 
doPlayerRemoveItem(cid, 8982, 1) 
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4]) 
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) 
if(getPlayerSex(cid) == 0)then 
doPlayerAddOutfit(cid, femaleOutfits[param][1], 3) 
else 
doPlayerAddOutfit(cid, maleOutfits[param][1], 3) 
end 
else 
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1]) 
end 
else 
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2]) 
end 
end

Make an file an name it spellbook.lua and paste this code in it :

Lua:
function onSay(cid, words, param)
	local count = getPlayerInstantSpellCount(cid)
	local text = ""
	local t = {}
	for i = 0, count - 1 do
		local spell = getPlayerInstantSpellInfo(cid, i)
		if spell.level ~= 0 then
			if spell.manapercent > 0 then
				spell.mana = spell.manapercent .. "%"
			end
			table.insert(t, spell)
		end
	end
	table.sort(t, function(a, b) return a.level < b.level end)
	local prevLevel = -1
	for i, spell in ipairs(t) do
		local line = ""
		if prevLevel ~= spell.level then
			if i ~= 1 then
				line = "\n"
			end
			line = line .. "Spells for Level " .. spell.level .. "\n"
			prevLevel = spell.level
		end
		text = text .. line .. "  " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
	end
    doShowTextDialog(cid, 2160, text)
	return TRUE
end

Make an file an name it commands.lua and paste this code in it :

Lua:
local config = {
	ingameGuilds = getBooleanFromString(getConfigValue('ingameGuildManagement'))
}

function onSay(cid, words, param, channel)
	local playerAccess, t = getPlayerAccess(cid), {}
	for i, talk in ipairs(getTalkActionList()) do
		if(not talk.hidden and playerAccess >= talk.access) then
			if(config.ingameGuilds or (talk.functionName ~= "guildjoin" and talk.functionName ~= "guildcreate")) then
				table.insert(t, talk)
			end
		end
	end

	table.sort(t, function(a, b) return a.access > b.access end)
	local lastAccess, str = -1, ""
	for i, talk in ipairs(t) do
		local line = ""
		if(lastAccess ~= talk.access) then
			if(i ~= 1) then
				line = "\n"
			end
			lastAccess = talk.access
		end
		str = str .. line .. talk.words .. "\n"
	end

	doShowTextDialog(cid, 2160, str)
	return true
end

Make an file an name it online.lua and paste this code in it :

Lua:
local config = {
	showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
	local strings, i, position, added = {""}, 1, 1, false
	for _, pid in ipairs(getPlayersOnline()) do
		if(added) then
			if(i > (position * 7)) then
				strings[position] = strings[position] .. ","
				position = position + 1
				strings[position] = ""
			else
				strings[position] = i == 1 and "" or strings[position] .. ", "
			end
		end

		added = false
		if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
			strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
			i = i + 1
			added = true
		end
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online:")
	for i, str in ipairs(strings) do
		if(str:sub(str:len()) ~= ",") then
			str = str .. "."
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
	end

	return true
end

Ok, thanks for me. And i hope this will help someone!
 
Totally useless thread! Why make a new thread as a update when it's exactly the same purpose?
 
Totally useless thread! Why make a new thread as a update when it's exactly the same purpose?

Wtf you talking about?

The older that the other guy make was unworking scripts and more. This contains more basic scripts also.

And please, stay ontopic instead of posting useless shit. Wanna talk? Lets write pm instead
 
Both theards are usless! Either you link the scripts to the real theards or write down the author of the scripts.
 
Both theards are usless! Either you link the scripts to the real theards or write down the author of the scripts.

I don't really now the author, i pick this scripts from my ot.
And please, stop posting this flame shit comments. I don't see anyway how this can be usless, you guys are full of hate lol..
 
not sure if it helps, but for sure it makes smaller query when someone spams and is exhausted:
Lua:
function onSay(cid, words, param, channel)
-- exhaustion check
if getPlayerStorageValue(cid,talkactiondelay[1]) > os.time() then
doPlayerSendCancel(cid,"You are exhausted (".. getPlayerStorageValue(cid,talkactiondelay[1])-os.time() .." seconds left).")
else
-- script
	local strings, i, position, added, showGamemasters = {""}, 1, 1, false, getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
	for _, pid in ipairs(getPlayersOnline()) do
		if(added) then
			if(i > (position * 7)) then
				strings[position] = strings[position] .. ","
				position = position + 1
				strings[position] = ""
			else
				strings[position] = i == 1 and "" or strings[position] .. ", "
			end
		end

		added = false
		if((showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
			strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
			i = i + 1
			added = true
		end
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " online:")
	for i, str in ipairs(strings) do
		if(str:sub(str:len()) ~= ",") then
			str = str .. "."
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
	end
setPlayerStorageValue(cid,talkactiondelay[1],os.time()+talkactiondelay[2]) -- makes exhaustion
	return true
end

my talkactions.lua lib used for player commands:
Lua:
talkactiondelay = {
		[1] = 24360, -- storage
		[2] = 5 -- seconds
	}
 
Back
Top