Author Topic: Fake an achievemnet  (Read 5574 times)

0 Members and 1 Guest are viewing this topic.

Offline justinboggs

  • Newbie
  • *
  • Posts: 8
  • Karma: -1
Fake an achievemnet
« 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
Code: [Select]
/*-------------------------------------------------------------------------------------------------------------------------
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 )

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Fake an achievemnet
« Reply #1 on: February 25, 2012, 12:01:53 AM »
Code: [Select]
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.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Fake an achievemnet
« Reply #2 on: February 25, 2012, 09:44:02 AM »
Code: [Select]
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.
Experiencing God's grace one day at a time.

Offline justinboggs

  • Newbie
  • *
  • Posts: 8
  • Karma: -1
Re: Fake an achievemnet
« Reply #3 on: February 25, 2012, 12:17:22 PM »
it shows a message to everyone just like it does when they learn a real achievement same colors and everything

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Fake an achievemnet
« Reply #4 on: February 25, 2012, 11:41:10 PM »
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.

Offline justinboggs

  • Newbie
  • *
  • Posts: 8
  • Karma: -1
Re: Fake an achievemnet
« Reply #5 on: February 26, 2012, 01:34:49 AM »
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

Offline justinboggs

  • Newbie
  • *
  • Posts: 8
  • Karma: -1
Re: Fake an achievemnet
« Reply #6 on: February 26, 2012, 12:16:14 PM »
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

Offline justinboggs

  • Newbie
  • *
  • Posts: 8
  • Karma: -1
Re: Fake an achievemnet
« Reply #7 on: February 28, 2012, 02:16:16 PM »
anyone want to help with this???? and can someone point to me a page with ulx functions and i can try myself

Offline JackYack13

  • Newbie
  • *
  • Posts: 28
  • Karma: -1
Re: Fake an achievemnet
« Reply #8 on: March 16, 2012, 11:31:30 AM »
Code: [Select]
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
« Last Edit: March 16, 2012, 04:47:50 PM by JackYack13 »