Ulysses Stuff > General Chat & Help and Support

How can i add a admin message to the server when a ulx command is proformed?

<< < (2/2)

Golden-Death:
Sorry, I forgot a parenthesis. I just tried and it works for me.

function cc_ulxGimp( userid, args, argv, argc )
   local target = getUser( userid, argv[ 1 ] )
   if target == nil then
      return
   end
      
   ulx_gimp( _PlayerInfo( target, "networkid" ) )

   ulx_log( "Admin " .. ulx_playerString( userid ) .. " gimped player " .. ulx_playerString( target ) )

   local gimpname = _PlayerInfo( target, "name" )
   _PrintMessageAll(HUD_PRINTTALK, "Admin gimped "..gimpname..", Everyone point and laugh at the gimp.")
end

Griff:
i pasted exactly that in and still nothing....

this is the whole of the ulx gimp code

--- Code: ---gimps = {}
sayText = ""
gss = 1

function ulx_gimp( steamid )
gimps[steamid] = true
end

function ulx_ungimp( steamid )
gimps[steamid] = nil
end

function GimpSay()
gstr = table.getn(gimp_say)
gss = math.random( 1, gstr )
return gimp_say[gss];
end

function gimpCallback( userid, strText )
if isGimped( userid ) then
local player_name = _PlayerInfo( userid, "name" )
local sayText = GimpSay()
return player_name .. ": " .. sayText
else
return strText
end
end

function isGimped( userid )
local steamid = _PlayerInfo( userid, "networkid" )
if ( gimps[steamid] == true ) then
return true;
else
return false;
end
end

addMessageHook( gimpCallback )

-- Gimp Messages --
gimp_say = {}
table.insert( gimp_say, "Liek Oh, mai, GAWD!!! taht is soooo seks3!" )
table.insert( gimp_say, "ohh, ahhh, oohhh, ahhhhhh" )
table.insert( gimp_say, "I like to be a mingebag" )
table.insert( gimp_say, "" )

function cc_ulxGimp( userid, args, argv, argc )
   local target = getUser( userid, argv[ 1 ] )
   if target == nil then
      return
   end
     
   ulx_gimp( _PlayerInfo( target, "networkid" ) )

   ulx_log( "Admin " .. ulx_playerString( userid ) .. " gimped player " .. ulx_playerString( target ) )

   local gimpname = _PlayerInfo( target, "name" )
   _PrintMessageAll(HUD_PRINTTALK, "Admin gimped "..gimpname..", Everyone point and laugh at the gimp.")
end

ULX_CONCOMMAND( "ulx_gimp", cc_ulxGimp, ACCESS_SLAY, "<user> - gimps the specified player", 1, "gimp" )

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

ulx_ungimp( _PlayerInfo( target, "networkid" ) )
ulx_log( "Admin " .. ulx_playerString( userid ) .. " ungimped player " .. ulx_playerString( target ) )
end

ULX_CONCOMMAND( "ulx_ungimp", cc_ulxUngimp, ACCESS_SLAY, "<user> - ungimps the specified player", 1, "ungimp" )

--- End code ---

Megiddo:
Why not just change ulx_log to print to the screen? All the admin commands use the log.

Griff:
well, i dont have a clue how to do that..... the only lanhuage i know is a little vb...

JamminR:
Step by step...
To try to keep things simple, restore your ulx_fun.lua to default either by the backup you made (you DID make one, right? :P), or by extracting from the downloaded ulx from this site.
1)Then, go into ulx_fun.lua.
2)Find function cc_ulxgimp section,
3) In that function, after where the LUA tests if target == nil,
Right after 'end' 2nd lines down (ending the if test)
3) on a 3rd line below that, place
_PrintMessageAll(HUD_PRINTTALK, "Admin gimped "..gimpname..", Everyone point and laugh at the gimp.")
there.


Do same for ulx_ungimp, but change the text in the _PrintMessageAll to more appropriate for what you wish to say.

Hope that helps a bit more, step by step.
If there is some other way any of us can help you understand, please say so. :)

Navigation

[0] Message Index

[*] Previous page

Go to full version