ULX

Author Topic: Text Floating Plugin  (Read 16032 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
« on: November 28, 2005, 04:12:26 PM »
Finally the DNS cache cleard, so I present you...

Overhead Text Plugin

This script has two versions, one for people who don't want to touch the script in any form, and one for people who don't want to clog up their ulx_helps with menu cvars.

Version One:
Code: [Select]
RED = 255
GREEN = 0
BLUE = 255
ALPHA = 100


--------------------------------------------------------------------
--                      Do Not Edit Below                          ---
--------------------------------------------------------------------




function gd_floattext( userid, args, argv, argc )
local target = getUser( userid, argv[ 1 ] )
if target == nil then
return
end



  _GModText_Start( "Default" );
  _GModText_SetColor( RED,GREEN,BLUE,ALPHA );
  _GModText_SetTime( 999, 0, 0.5 ); --How long it stays, and the fading times
  _GModText_SetEntityOffset( vector3( 0, 0, 40 ) ); --Messages appear 35 Units above Players
  _GModText_SetEntity( target ); --Entity/Player the message will follow
  _GModText_SetText( gd_msg ); --Set the message
  _GModText_Send( 0, 50+userid );



 



end





ULX_CONCOMMAND( "ulx_floatmsg", gd_floattext, ACCESS_CVAR, "Begin float text on user _ Plugin by Golden-Death", 1, "!float" )
ULX_CONVAR( "gd_msg", "This is my floating text!", ACCESS_CVAR, " Message to float" )

If you choose this script, you may set the RED - GREEN - BLUE - ALPHA to different values, as seen in the script above.
Code: [Select]
RED = 255
GREEN = 0
BLUE = 255
ALPHA = 100
This version has 1 CVAR:
gd_msg -sets the message

Copy the code and put it anywhere in a ULX file is exec'ed.
(Ex: copy and paste to bottom of gmod9/lua/ulx/fun.lua)


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




function gd_floattext( userid, args, argv, argc )
local target = getUser( userid, argv[ 1 ] )
if target == nil then
return
end



  _GModText_Start( "Default" );
  _GModText_SetColor( gd_red,gd_green,gd_blue,gd_alpha );
  _GModText_SetTime( 999, 0, 0.5 ); --How long it stays, and the fading times
  _GModText_SetEntityOffset( vector3( 0, 0, 40 ) ); --Messages appear 35 Units above Players
  _GModText_SetEntity( target ); --Entity/Player the message will follow
  _GModText_SetText( gd_msg ); --Set the message
  _GModText_Send( 0, 50+userid );



 



end





ULX_CONCOMMAND( "ulx_floatmsg", gd_floattext, ACCESS_CVAR, "Begin float text on user _ Plugin by Golden-Death", 1, "!float" )
ULX_CONVAR( "gd_msg", "This is my floating text!", ACCESS_CVAR, " Message to float" )
ULX_CONVAR( "gd_red", "0", ACCESS_CVAR, " Floating text - Red Value" )
ULX_CONVAR( "gd_green", "0", ACCESS_CVAR, " Floating text - Green Value" )
ULX_CONVAR( "gd_blue", "0", ACCESS_CVAR, " Floating text - Blue Value" )
ULX_CONVAR( "gd_alpha", "255", ACCESS_CVAR, " Floating text - Transparency Value" )

If you choose this one, you won't have to ever touch the script. Simply install and use CVARs to set the color and alpha
This version has 5 CVARS:
gd_red - sets amount of red
gd_green - sets amount of green
gd_blue - sets amount of blue
gd_alpha - sets amount of transparency
gd_msg - sets the message

Copy the code and put it anywhere in a ULX file is exec'ed.
(Ex: copy and paste to bottom of gmod9/lua/ulx/fun.lua)




« Last Edit: May 11, 2006, 08:24:10 PM by Golden-Death »


Offline Mank

  • Full Member
  • ***
  • Posts: 209
  • Karma: 9
    • Ulysses Mod!
Re: text floating plugin
« Reply #1 on: November 29, 2005, 09:02:53 AM »
Nice one, instead of making lots of small scripts how about you make one interesting one like your glow plugin!
If you doubt your powers you bring powers to your doubts.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: text floating plugin
« Reply #2 on: November 29, 2005, 03:46:41 PM »
the problem is finding ideas  ;)


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: text floating plugin
« Reply #3 on: November 29, 2005, 04:55:15 PM »
the problem is finding ideas  ;)

Hehe... no kidding. Programmers aren't creative, they just think of ways to implement other's ideas.
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
« Reply #4 on: November 29, 2005, 08:49:16 PM »
Im plenty imaginative, id have wonderful ideas if lua could implement flame throwing jetpacks with lasers that sprout flowers out of cs_italy bananas on implode.


Offline jesus

  • Jr. Member
  • **
  • Posts: 55
  • Karma: 0
Re: text floating plugin
« Reply #5 on: November 30, 2005, 05:57:17 AM »
Sorry to be a but could you maybe zip this up and make it downloadable?
I'm not sure how to lake a .lua file... ;D

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: text floating plugin
« Reply #6 on: November 30, 2005, 03:32:20 PM »
open notepad

copy the stuff above into it

click save as

browse to gmod9/lua

in the dropdown box, select 'All Files'

Name the file as textfloat.lua

save


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: text floating plugin
« Reply #7 on: November 30, 2005, 03:34:52 PM »
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
« Reply #8 on: December 03, 2005, 07:33:02 PM »


Offline neoshock2k

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: text floating plugin
« Reply #9 on: January 19, 2006, 02:40:00 AM »
yo dragon ur post up there about the jetpack.

I see no reason why u couldnt do that in hammer, and some lua, then simply vmfloader it or compile it for gmod+

just use an invisible pod, somtething that looks like a jetpack (vmfloader supports brushes now)

add the right entities, thrusters, logic etc

and i can load it up any time by the click of a button.

As for the bananas you would need to place a banana image in sprites, then use a laser setits width and bingo!

Hope that gets u creating :D


Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: text floating plugin
« Reply #10 on: January 19, 2006, 01:06:55 PM »
ahaha, i would but im too busy atm :(


Offline Griff

  • Newbie
  • *
  • Posts: 40
  • Karma: 3
Re: text floating plugin
« Reply #11 on: February 04, 2006, 05:27:28 AM »
erm. i cant get the floating text to work and am a bit confused about the commands needed to make it work. i have saved the file as textfloatuncvar.lua and added the line _OpenScript( "textfloatuncvar.lua" ) to ulx_init.lua but nothing works... can anyone explain?

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: text floating plugin
« Reply #12 on: February 04, 2006, 08:07:03 AM »
erm. i cant get the floating text to work and am a bit confused about the commands needed to make it work. i have saved the file as textfloatuncvar.lua and added the line _OpenScript( "textfloatuncvar.lua" ) to ulx_init.lua but nothing works... can anyone explain?

I havnt used it in a while, but if you are using the uncvar version, it should work like this if installed correctly
Ingame in console, type the following:
sv_cheats 1
thirdperson
gd_msg test
ulx_floatmsg "your player name here"


Offline Griff

  • Newbie
  • *
  • Posts: 40
  • Karma: 3
Re: text floating plugin
« Reply #13 on: February 05, 2006, 03:41:07 AM »
ok, ive done all that but when i say ulx_floatmsg "[**RvB**]Griff" it just says it cant find player name. (i copied and pasted it correctly from console) so i know the name is spelt correctly... any ideas?

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: text floating plugin
« Reply #14 on: February 05, 2006, 07:30:39 AM »
Might be a problem wiht your name, try changing your name to bob and seeing if it works.