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

[TFS 0.36] [8.6] - Automatic message after completing an action.

oen432

Legendary OT User
Joined
Oct 3, 2014
Messages
1,914
Solutions
55
Reaction score
2,138
Location
Poland
GitHub
Oen44
Hello,
I'm looking for scricpt that send messages to players when they do something.
Example:
Player FIRST TIME joined the server and got message:
"XXXXX xxxxx xxxx xxx"
Player opened chest with ID 34854 and got message:
"XxXxxx xxxxxx"
Player talked to NPC with ID 54546 and got message:
"XXXXX xxxxxx"
Player killed monster with ID 45453 and got message:
"xxxxx xxxxxx"
Messages can be send as Private Message (like NPC) or as orange messages (like server information). Can anyone do something like this?
 
I wrote something like this. It works but not like i want. I want to change the way we get message.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if item.uid == 3587 then
     doPlayerSendTextMessage(cid,21,"XXXXX")
   end
  return TRUE
end
And when i add this script i can't get items from chest, only this message.
 
You can add the message in the system.lua, same way with checking for uniqueid and you can add it under function onUse or if you have more chests with extra messages you can do it with a table.
 
I added this:
Code:
if item.uid == 3578 then
     doPlayerSendTextMessage(cid, 25, "XXXXX")
     return true
   end
Above:
Code:
  if(getPlayerStorageValue(cid, storage) > 0) then

But still can't get item.
 
With npcs you can just add the message to the npc Lua file.
Messages for killing monsters can be done with creaturescripts type kill (function onKill).

When exactly should a player receive the message?
Here is an example for a task script that gives messages after killing monsters.
http://otland.net/threads/npc-mission.211063/#post-2022378
 
You can remove all the storage parts, so you have something like this.
Code:
local config = {
     ["boss name"] = {message = "blabla"},
     ["other boss name"] = {message = "blabla"}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster then
         return true
     end

     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, monster.message)
     return true
end
 
message.lua
Code:
local config = {
  ["Bear"] = {message = "Test"},
  ["Rat"] = {message = "test"}
}
function onKill(cid, target)
  local monster = config[getCreatureName(target):lower()]
  if isPlayer(target) or not monster then
  return true
  end

  doPlayerSendTextMessage(cid, 20, monster.message)
  return true
end

creaturescripts.xml
Code:
   <event type="kill" name="Message" script="message.lua"/>

login.lua
Code:
registerCreatureEvent(cid, "Message")

After killing Rat or Bear I'm not getting any message.

Ohh... I forgot about message when someone first time log in to the game.
 
Last edited:
TFS 0.3 uses event and value.
Code:
<event type="kill" name="Message" event="script" value="message.lua"/>

You can add the first time login message in login.lua.
 
Back
Top