Ulysses
Ulysses Stuff => Suggestions => Topic started by: justinboggs on February 24, 2012, 12:56:21 PM
-
I like evolves plugin that makes it look likes someone just got an achievemnet can someone make this for ulx
/*-------------------------------------------------------------------------------------------------------------------------
Fake an achievement
-------------------------------------------------------------------------------------------------------------------------*/
local PLUGIN = {}
PLUGIN.Title = "Achievement"
PLUGIN.Description = "Fake someone earning an achievement."
PLUGIN.Author = "Overv"
PLUGIN.ChatCommand = "ach"
PLUGIN.Usage = "<player> <achievement>"
PLUGIN.Privileges = { "Achievement" }
function PLUGIN:Call( ply, args )
if ( ply:EV_HasPrivilege( "Achievement" ) ) then
local players = evolve:FindPlayer( args[1], nil, nil, true )
if ( players[1] ) then
local achievement = table.concat( args, " ", 2 )
if ( #achievement > 0 ) then
for _, pl in ipairs( players ) do
evolve:Notify( team.GetColor( pl:Team() ), pl:Nick(), color_white, " earned the achievement ", Color( 255, 201, 0, 255 ), achievement )
end
else
evolve:Notify( ply, evolve.colors.red, "No achievement specified." )
end
else
evolve:Notify( ply, evolve.colors.red, evolve.constants.noplayersnoimmunity )
end
else
evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed )
end
end
evolve:RegisterPlugin( PLUGIN )
-
evolve:Notify( team.GetColor( pl:Team() ), pl:Nick(), color_white, " earned the achievement ", Color( 255, 201, 0, 255 ), achievement )
Notify looks to be an internal function of Evolve. What does this look like or do? Porting this over to ULib would be very easy, but the only problem is it looks like it's making use of some other internal Evolve code.
-
evolve:Notify( team.GetColor( pl:Team() ), pl:Nick(), color_white, " earned the achievement ", Color( 255, 201, 0, 255 ), achievement )
Notify looks to be an internal function of Evolve. What does this look like or do? Porting this over to ULib would be very easy, but the only problem is it looks like it's making use of some other internal Evolve code.
Looks like that function is the equivalent of ULib.tsayColor (http://ulyssesmod.net/docs/files/lua/ulib/shared/messages-lua.html#tsayColor).
-
it shows a message to everyone just like it does when they learn a real achievement same colors and everything
-
Are these the gmod internal achievements or some other achievements that Evolve has added? I wasn't aware that the game notified players when someone got an achievement.
-
there fake... it makes it look like you got an achievement..... when you get a real achievement it posts your name in yellow and in white it saids earned the achievement and in yellow again it saids what the achievement you put in the !ach
-
Also the command would have to be run silently all the time and never showed that it was being used even if run though chat
-
anyone want to help with this???? and can someone point to me a page with ulx functions and i can try myself
-
local CATEGORY_NAME = "Utility"
function ulx.fakeachievement(ply, targets, achievement)
local affected_plys = {}
for _, v in pairs(targets) do // loop through all players passed in the command argument
ULib.tsayColor(nil, false, team.GetColor(v:Team()), v:Nick(), Color(255, 255, 255), " earned the achievement ", Color(255, 200, 0), achievement) // print the message to chat
end
end
local fakeachievement = ulx.command(CATEGORY_NAME, "ulx fakeachievement", ulx.fakeachievement, "!fakeachievement", true) // add the command
fakeachievement:addParam{ type = ULib.cmds.PlayersArg, ULib.cmds.ignoreCanTarget } // add players parameter
fakeachievement:addParam{ type = ULib.cmds.StringArg, hint = "name of achievement" } // add achievement name parameter
fakeachievement:defaultAccess(ULib.ACCESS_ADMIN) // set default access to admin-only
fakeachievement:help("Print a fake achievement message to chat.")
I haven't tested the code but something like that should work. Just put that in a lua file under lua\ulx\modules\sh