Author Topic: Text floating plugin (ULX v2)  (Read 10280 times)

0 Members and 1 Guest are viewing this topic.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Text floating plugin (ULX v2)
« on: November 05, 2006, 11:28:13 AM »
Original thread:
http://forums.ulyssesmod.net/index.php/topic,50.0.html

I didn't think any one wanted it, but since Ltp0wer requested it, here it is.

---------------------------------------------
New Features
  • Works with ULX v2
  • No more cvars. (See below)
  • Supports more than one text (Used to be overwritten if you used more than one at a time)

Limitations
  • Running two texts on a player will make them overlap, you'll have to clear all other texts to start new ones, or if you can make it disappear in another manner
  • Can only remove everyone's text. Not one at a time. Maybe some one can figure out a system, because don't have enough time sadly.
---------------------------------------------



Usage:
Say:
!text (player) (red) (green) (blue) (transparency) ("message")

Example:
!text gol 255 0 0 255 "I am an admin"

Remember, quotes are needed on the message part if it contains spaces.
Have fun!


http://ulyssesmod.net/gd/ulxv2scripts/textfloat/ulx_textfloat.lua
« Last Edit: November 05, 2006, 12:06:04 PM by Golden-Death »


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Text floating plugin (ULX v2)
« Reply #1 on: November 05, 2006, 11:29:09 AM »
Download?
Experiencing God's grace one day at a time.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Text floating plugin (ULX v2)
« Reply #2 on: November 05, 2006, 12:45:53 PM »
 Download links are overrated :P


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Text floating plugin (ULX v2)
« Reply #3 on: November 05, 2006, 01:33:17 PM »
Good job GD!
Experiencing God's grace one day at a time.

Offline Ltp0wer

  • Silent
  • Posts: 0
  • Karma: 0
Re: Text floating plugin (ULX v2)
« Reply #4 on: November 08, 2006, 04:16:45 PM »
Haha, sweet.

Exactly what I wanted.


Thanks man, A+ job.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Text floating plugin (ULX v2)
« Reply #5 on: November 09, 2006, 10:11:22 PM »
 8)


Offline Ltp0wer

  • Silent
  • Posts: 0
  • Karma: 0
Re: Text floating plugin (ULX v2)
« Reply #6 on: November 13, 2006, 03:39:10 PM »
I have an idea. I'd like if I was able to float text on props aswell.

Like, what you are pointing at, you'd type "!proptext 255 255 255 255 MESSAGE"


Just a thought.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Text floating plugin (ULX v2)
« Reply #7 on: November 13, 2006, 05:29:13 PM »
Well, I could just change a few lines of code, I don't know if it will work though.

use !textprop (player who is looking at prop) (red) (green) (blue) (alpha) (message) (z offset)

where the Z offset is how high above the prop it floats, since the prop size will vary. (Players head height is 35 or so)

Code: [Select]
--------------------------------------------------------------------
--             Do Not Edit Below: Use the cvars to set            --
--------------------------------------------------------------------




function cc_ulxtextfloatprop( userid, args, argv, argc )
if argc < 7 then
ULib.tsay( userid, ulx.LOW_ARGS )
return
end

local targets, err = ULib.getUsers( argv[ 1 ], _, true ) -- Enable keywords
if not targets then
ULib.tsay( userid, err )
return
end

for _, v in ipairs( targets ) do

  _GModText_Start( "Default" );
  _GModText_SetColor( argv[2],argv[3],argv[4],argv[5]);
  _GModText_SetTime( 9999, 0.5, 0.5 ); --How long it stays, and the fading times
  _GModText_SetEntityOffset( vector3( 0, 0, argv[7] ) ); --Messages appear 35 Units above Players
local trace = PlayerLookTrace(v, 9999)
local fent = _TraceGetEnt();
  _GModText_SetEntity( fent ); --Entity/Player the message will follow
  _GModText_SetText( argv[6]); --Set the message
  _GModText_Send( 0, math.random(1,500) );


end

end

function ulx.cleartext(userid, args, argv, argc )
for i=1, _MaxPlayers() do
if IsPlayerOnline(i) then
_GModText_HideAll(i)
end
end
end
ulx.CONCOMMAND( "textfloatprop", cc_ulxtextfloatprop, "<user><red><green><blue><alpha><message><location offset in Z> Set text above players", ACCESS_SLAY, "!textprop" )
ulx.CONCOMMAND( "cleartext", ulx.cleartext, "Remove all text floating around", ACCESS_SLAY, "!cleartext" )


Offline Ltp0wer

  • Silent
  • Posts: 0
  • Karma: 0
Re: Text floating plugin (ULX v2)
« Reply #8 on: November 13, 2006, 05:44:03 PM »
Well, I could just change a few lines of code, I don't know if it will work though.

use !textprop (player who is looking at prop) (red) (green) (blue) (alpha) (message) (z offset)

where the Z offset is how high above the prop it floats, since the prop size will vary. (Players head height is 35 or so)

Code: [Select]
--------------------------------------------------------------------
--             Do Not Edit Below: Use the cvars to set            --
--------------------------------------------------------------------




function cc_ulxtextfloatprop( userid, args, argv, argc )
if argc < 7 then
ULib.tsay( userid, ulx.LOW_ARGS )
return
end

local targets, err = ULib.getUsers( argv[ 1 ], _, true ) -- Enable keywords
if not targets then
ULib.tsay( userid, err )
return
end

for _, v in ipairs( targets ) do

  _GModText_Start( "Default" );
  _GModText_SetColor( argv[2],argv[3],argv[4],argv[5]);
  _GModText_SetTime( 9999, 0.5, 0.5 ); --How long it stays, and the fading times
  _GModText_SetEntityOffset( vector3( 0, 0, argv[7] ) ); --Messages appear 35 Units above Players
local trace = PlayerLookTrace(v, 9999)
local fent = _TraceGetEnt();
  _GModText_SetEntity( fent ); --Entity/Player the message will follow
  _GModText_SetText( argv[6]); --Set the message
  _GModText_Send( 0, math.random(1,500) );


end

end

function ulx.cleartext(userid, args, argv, argc )
for i=1, _MaxPlayers() do
if IsPlayerOnline(i) then
_GModText_HideAll(i)
end
end
end
ulx.CONCOMMAND( "textfloatprop", cc_ulxtextfloatprop, "<user><red><green><blue><alpha><message><location offset in Z> Set text above players", ACCESS_SLAY, "!textprop" )
ulx.CONCOMMAND( "cleartext", ulx.cleartext, "Remove all text floating around", ACCESS_SLAY, "!cleartext" )

But will that still allow me to do it on players?