Gandh1
Member
- Joined
- Jan 15, 2008
- Messages
- 16
- Reaction score
- 8
Hi. Sorry for my bad english xd. This is a my new noob scirpt. I'm write it to my server (aries 8.1) but it must work on a newest engines.
Later I plan to edit this script for the latest version of the TFS.
How it works?
Script gives us a four useful commands (two for normal players and two for GM's)
• /o - simply speaking their own form (example: /o "=])
• /target - your target will say what you want (for example, /target "Zaraz zgine, pomocy!)
• /say - command for gm. It allows you to speak another player (ex. /say "Rafaello, bubu)
• /all - command for GM. It allows the characters in the specified range will say what you want. Example: /all "4, I am cool
4 - range
Now the script. Enter the talkactions/scripts and create there a file called "say.lua" and paste to it:
Version for Aries, Devland etc. (tibia 8.1)
Now paste it in talkactions.xml:
Version for latest TFS (8.4+)
Screenshot:
And you can now enjoy the new command (;
Please comments
Rahim
Later I plan to edit this script for the latest version of the TFS.
How it works?
Script gives us a four useful commands (two for normal players and two for GM's)
• /o - simply speaking their own form (example: /o "=])
• /target - your target will say what you want (for example, /target "Zaraz zgine, pomocy!)
• /say - command for gm. It allows you to speak another player (ex. /say "Rafaello, bubu)
• /all - command for GM. It allows the characters in the specified range will say what you want. Example: /all "4, I am cool
4 - range
Now the script. Enter the talkactions/scripts and create there a file called "say.lua" and paste to it:
Version for Aries, Devland etc. (tibia 8.1)
Code:
function onSay(cid, words, param)
--by Rahim (kanciak)
--for tibia.net.pl
local access = 3 --access, ktory moze uzywac niektorych komend!
if param == "" or param == nil then
return doPlayerSendCancel(cid,"Command required param!")
end
if string.sub(words,2,2) == "s" then
if getPlayerAccess(cid) < access then
return doPlayerSendCancel(cid,"This command can use only a gamemaster.")
end
if string.find(param, ",") == nil then
return doPlayerSendCancel(cid,"Command required param! Example: /say \"Rafaello, Yo men!")
end
local znajdz = string.find(param, ",")
local nick = string.sub(param, 1, znajdz-1)
if getPlayerByName(nick) == 0 or isPlayer(getPlayerByName(nick)) ~= TRUE then
return doPlayerSendCancel(cid,"Player not found!")
end
local player = getPlayerByName(nick)
local tekst = string.sub(param, znajdz+1)
return doPlayerSay(player,tekst,17)
elseif string.sub(words,2,2) == "o" then
return doPlayerSay(cid,param,16)
elseif string.sub(words,2,2) == "t" then
if getCreatureTarget(cid) == FALSE then
return doPlayerSendCancel(cid,"You need a target to use this command! Example: /target \"I kill you! :<")
end
return doCreatureSay(getCreatureTarget(cid),param,17)
elseif string.sub(words,2,2) == "a" then
if getPlayerAccess(cid) < access then
return doPlayerSendCancel(cid,"This command can use only a gamemaster.")
end
if string.find(param, ",") == nil then
return doPlayerSendCancel(cid,"Command required param! Example: /all \"Buahahhaha,3")
end
local znajdz = string.find(param, ",")
local zasieg = tonumber(string.sub(param, 0, znajdz-1))
if zasieg >= 6 then
return doPlayerSendCancel(cid,"Max range: 5")
end
local tekst = string.sub(param, znajdz+1, 999)
local pos = getCreaturePosition(cid)
local frompos = {x=pos.x-zasieg,y=pos.y-zasieg,z=pos.z}
local topos = {x=pos.x+zasieg,y=pos.y+zasieg,z=pos.z}
local xd = 0
for x2 = frompos.x, topos.x do
for y2 = frompos.y, topos.y do
local pos = {x=x2,y=y2,z=topos.z,stackpos=253}
local creature = getThingfromPos(pos)
if isPlayer(creature.uid) == TRUE and cid ~= creature.uid then
doCreatureSay(creature.uid,tekst,17)
end
end
end
return TRUE
end
end
Code:
<talkaction words="/o" script="say.lua" />
<talkaction words="/say" script="say.lua" />
<talkaction words="/target" script="say.lua" />
<talkaction words="/all" script="say.lua" />
Version for latest TFS (8.4+)
Code:
function onSay(cid, words, param)
if(param == "") then
doPlayerSendCancel(cid,"Command required param!")
return TRUE
end
local s = string.explode(param,"\"")
if(s[2] == "") or (s[2] == nil) then
doPlayerSendCancel(cid,"Command required param!")
return TRUE
end
if(words:sub(2,2) == "o") then
doCreatureSay(cid,s[2],TALKTYPE_ORANGE_1)
return TRUE
elseif(words:sub(2,2) == "t") then
local target = getCreatureTarget(cid)
if(isCreature(target) ~= TRUE) then
doPlayerSendCancel(cid,"You must have a target to use this command!")
return TRUE
end
doCreatureSay(target,s[2],TALKTYPE_ORANGE_1)
return TRUE
elseif(words:sub(2,2) == "s") then
local y = string.explode(s[2],",")
local player = getPlayerByNameWildcard(y[1])
if(isPlayer(player) ~= TRUE) then
doPlayerSendCancel(cid,"Player not found!")
return TRUE
end
doCreatureSay(cid,y[2],TALKTYPE_ORANGE_1)
return TRUE
elseif(words:sub(2,2) == "a") then
local y = string.explode(s[2],",")
local zasieg = tonumber(y[2])
if(zasieg >= 6)then
doPlayerSendCancel(cid,"Max range: 5")
return TRUE
end
local pos = getCreaturePosition(cid)
local frompos = {x=pos.x-zasieg,y=pos.y-zasieg,z=pos.z}
local topos = {x=pos.x+zasieg,y=pos.y+zasieg,z=pos.z}
for x = frompos.x, topos.x do
for y = frompos.y, topos.y do
local pos = {x=x,y=y,z=topos.z,stackpos=253}
local creature = getThingfromPos(pos)
if((isPlayer(creature.uid) == TRUE) and (cid ~= creature.uid)) then
doCreatureSay(creature.uid,y[1],TALKTYPE_ORANGE_1)
end
end
end
return TRUE
end
return TRUE
end
Code:
<talkaction words="/o" access="0" event="script" value="say.lua"/>
<talkaction words="/all" access="3" event="script" value="say.lua"/>
<talkaction words="/say" access="3" event="script" value="say.lua"/>
<talkaction words="/target" access="0" event="script" value="say.lua"/>
Screenshot:
And you can now enjoy the new command (;
Please comments
Rahim
Last edited: