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

TalkAction [TFS 0.2.6] /parrot

SaLeM

New Member
Joined
Oct 14, 2007
Messages
97
Reaction score
0
Location
Spain
Hiya!

Here you have a very comical script which will let you talk THROUGH any player xD:

First:

Type this into your data/talkactions/talkactions.xml file:

PHP:
<talkaction words="/parrot" script="parrot.lua"/>

Then, go to data/talkactions/scripts/ and create a .lua file called parrot.lua. Within it, paste this using Notepad or any text editor:

PHP:
local idgroup = 5   --Min Group Access

function onSay(cid, words, param)
	if getPlayerGroupId(cid) < idgroup then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You aren't allowed to use this command")
  elseif param ~= "" then
    if string.find(param, ',') ~= nil then
      local sep1 = string.find(param, ',')
      local param1 = string.sub(param, 1, sep1-1)
      local param2 = string.sub(param,sep1+1,string.len(param))
      local target = getPlayerByName(param1)
      
      if target == FALSE then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online")
      elseif param1 == "" then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player")
      elseif (param2 == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type some text")
      elseif words == "/parrot" then	
        player = getCreatureName(target)
        text = param2
        doCreatureSay(target,text,1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, player.. " has said: "..text)
      end

    else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Wrong format: /parrot \"Player,Text")
    end
  else
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player and some text")
  end
end

Where:

idgroup

is the minimun group id to use this command.

Then, ingame, type this to make a player say whatever you want:

/parrot "playername,text

If you find any bug, just tell it to me. :)

Greetz
 
Last edited:
What if playername contains a - character?
 
Then, you have a problem XD. What separator you suggest me to use? (someone that cannot be used as name) :D
 
Last edited:
I suggest using , as separation character.
 
yea, maybe in this script. But in scripts with more than 2 parameters, a comma will not work, since may be commas in that parameters. Then I could use as separator a double comma (,,).

But yes, on this script a comma is Ok, since only the first comma matters.

ty
 
Last edited:
Never heard about a /makesay command, but if it means what I think it means, yes it is. It'll just make any player say everything you want.
 
Back
Top