• Print

Author Topic: /me is serverwide  (Read 10830 times)

0 Members and 1 Guest are viewing this topic.

Offline Daniel999

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
/me is serverwide
« on: May 28, 2013, 12:37:31 pm »
Hi guys, I'm having a problem with my dark rp server that for some reason the /me command can be seen by the whole server.
Can you guys help me please? Thanks.
Bare in mind, I'm pretty newb so if you do help me your instructions are going to have to be exact.

Thankyou :)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: /me is serverwide
« Reply #1 on: May 28, 2013, 01:44:03 pm »
First, who do you want it to be seen by?
Experiencing God's grace one day at a time.

Offline Daniel999

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: /me is serverwide
« Reply #2 on: May 29, 2013, 05:17:46 am »
Just the local area like it would normally happen on other servers.
Thanks :)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: /me is serverwide
« Reply #3 on: May 29, 2013, 05:27:49 am »
How large of an area?
Experiencing God's grace one day at a time.

Offline Daniel999

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: /me is serverwide
« Reply #4 on: May 29, 2013, 05:31:38 am »
5-10 meters would do.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: /me is serverwide
« Reply #5 on: May 29, 2013, 06:27:21 am »
10 meters is a very short distance, but try this (untested). Replace the me check in modules/chat.lua, which originally is like this:

Code: Lua
  1. local function meCheck( ply, strText, bTeam )
  2.         if ply.gimp or not ULib.isSandbox() then return end -- Don't mess
  3.  
  4.         if strText:sub( 1, 4 ) == "/me " then
  5.                 strText = string.format( "*** %s %s", ply:Nick(), strText:sub( 5 ) )
  6.                 if not bTeam then
  7.                         ULib.tsay( _, strText )
  8.                 else
  9.                         strText = "(TEAM) " .. strText
  10.                         local teamid = ply:Team()
  11.                         local players = team.GetPlayers( teamid )
  12.                         for _, ply2 in ipairs( players ) do
  13.                                 ULib.tsay( ply2, strText )
  14.                         end
  15.                 end
  16.  
  17.                 if game.IsDedicated() then
  18.                         Msg( strText .. "\n" ) -- Log to console
  19.                 end
  20.                 if util.tobool( GetConVarNumber( "ulx_logChat" ) ) then
  21.                         ulx.logString( strText )
  22.                 end
  23.  
  24.                 return ""
  25.         end
  26. end
  27. hook.Add( "PlayerSay", "ULXMeCheck", meCheck, 18 ) -- Extremely low priority

To this:
Code: Lua
  1. local meDist = 10
  2. local function meCheck( ply, strText, bTeam )
  3.         if ply.gimp or not ULib.isSandbox() then return end -- Don't mess
  4.  
  5.         if strText:sub( 1, 4 ) == "/me " then
  6.                 strText = string.format( "*** %s %s", ply:Nick(), strText:sub( 5 ) )
  7.                 if not bTeam then
  8.                         for _, ply2 in ipairs( player.GetAll() ) do
  9.                                 if (ply:GetPos():Distance(ply2:GetPos()) < meDist) then
  10.                                         ULib.tsay( ply2, strText )
  11.                                 end
  12.                         end
  13.                 else
  14.                         strText = "(TEAM) " .. strText
  15.                         local teamid = ply:Team()
  16.                         local players = team.GetPlayers( teamid )
  17.                         for _, ply2 in ipairs( players ) do
  18.                                 if (ply:GetPos():Distance(ply2:GetPos()) < meDist) then
  19.                                         ULib.tsay( ply2, strText )
  20.                                 end
  21.                         end
  22.                 end
  23.  
  24.                 if game.IsDedicated() then
  25.                         Msg( strText .. "\n" ) -- Log to console
  26.                 end
  27.                 if util.tobool( GetConVarNumber( "ulx_logChat" ) ) then
  28.                         ulx.logString( strText )
  29.                 end
  30.  
  31.                 return ""
  32.         end
  33. end
  34. hook.Add( "PlayerSay", "ULXMeCheck", meCheck, 18 ) -- Extremely low priority
Experiencing God's grace one day at a time.

Offline Daniel999

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: /me is serverwide
« Reply #6 on: May 29, 2013, 06:37:19 am »
It didn't seem to work.
Did I do it in the right place?

/orangebox/garrysmod/addons/ulx/lua/ulx/modules/sh/chat.lua

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: /me is serverwide
« Reply #7 on: May 29, 2013, 07:11:13 am »
You should know beyond a shadow of a doubt if you replaced the right code, since it's listed above. What does "it doesn't work" mean?
Experiencing God's grace one day at a time.

Offline Daniel999

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: /me is serverwide
« Reply #8 on: May 29, 2013, 07:15:00 am »
By it didn't work - I mean nothing happened. It just stayed the same.


Example

***Daniel falls over.

Tells the whole server that.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: /me is serverwide
« Reply #9 on: May 29, 2013, 07:24:30 am »
You'll need to change maps after making the change.
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: /me is serverwide
« Reply #10 on: May 29, 2013, 07:55:38 am »
Also, the units returned with entity:Distance(entity) is map units is it not?

If that is the case, 10 meters would be more closely 512 units.

or, you have the line:
Code: [Select]
if ply.gimp or not ULib.isSandbox() then return end -- Don't messWouldn't this return early since the gamemode he is running is DarkRP?
« Last Edit: May 29, 2013, 07:57:42 am by MrPresident »

Offline Daniel999

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: /me is serverwide
« Reply #11 on: May 29, 2013, 08:08:23 am »
I tried changing maps, that didnt work.

I do have this line
if ply.gimp or not ULib.isSandbox() then return end -- Don't mess

Should i remove it?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: /me is serverwide
« Reply #12 on: May 29, 2013, 09:05:34 am »
DarkRP is considered Sandbox, if it wasn't, he wouldn't be able to use the "/me" command at all. Not sure why the modification isn't taking effect for you Daniel, sorry. Make sure that you're actually changing the file on the server.
Experiencing God's grace one day at a time.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: /me is serverwide
« Reply #13 on: May 30, 2013, 12:45:07 am »
Why not try doing a find in sphere instead of a GetAll? (In the code above.)
-
Also are you running FAdmin as well and does FAdmin have its own /me command?
I cry every time I see that I am not a respected member of this community.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: /me is serverwide
« Reply #14 on: May 30, 2013, 06:21:21 am »
Why not try doing a find in sphere instead of a GetAll? (In the code above.)

I considered it, but the way I did it above is a much simpler modification.
Experiencing God's grace one day at a time.

  • Print