• Print

Author Topic: ULX Command Help Please  (Read 7055 times)

0 Members and 1 Guest are viewing this topic.

Offline GlossyELHS

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
ULX Command Help Please
« on: July 05, 2017, 04:17:10 am »
Hey guys. So I have a ULX command that I want to implement to my server. I have started to learn a lot of GLua and coded my own HUD so I'm not like bad at programming but I want to start doing ULX commands as well and I was hoping someone could help me.

 I know how to make a ULX command to target someone but I want to make a ULX command that makes someone say something, so like this:

They type !glossy and it says "I hate Glossy" from them.

Thanks in advance for the help

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: ULX Command Help Please
« Reply #1 on: July 05, 2017, 04:39:08 am »
You can use Player:Say to make a player to say something.

Offline GlossyELHS

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: ULX Command Help Please
« Reply #2 on: July 05, 2017, 04:40:35 am »
Okay, so how would I structure the command? I have a command that I have done already which is structured like this -

Code: [Select]
function ulx.trout(calling_ply, target_plys)

ulx.fancyLogAdmin( calling_ply, "#A slapped #T with a trout", target_plys)
end
local trout = ulx.command("Donor Commands", "ulx trout", ulx.trout, "!trout",true)
trout:addParam{ type=ULib.cmds.PlayersArg }
trout:defaultAccess( ULib.ACCESS_SUPERADMIN )
trout:help( "trout someone." )

Offline GlossyELHS

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: ULX Command Help Please
« Reply #3 on: July 05, 2017, 04:45:16 am »
You can use Player:Say to make a player to say something.

^^

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: ULX Command Help Please
« Reply #4 on: July 05, 2017, 05:37:22 am »
Awesome! The structure for a command that acts on the calling_ply is similar. :)

Example - A command that heals the calling_ply:
Code: Lua
  1. function ulx.heal( calling_ply )
  2.     calling_ply:SetHealth( calling_ply:GetMaxHealth() )
  3. end
  4. local heal = ulx.command( "Fun", "ulx heal", ulx.heal, "!heal" )
  5. heal:defaultAccess( ULib.ACCESS_ALL )
  6. heal:help( "Heals self." )

You will notice I removed cmd:addParam{ type=ULib.cmds.PlayersArg }. We don’t add this parameter because our command is not going to target other players.

See if you can update that example to make the calling_ply say something.
« Last Edit: July 05, 2017, 06:52:20 am by Timmy »

Offline GlossyELHS

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: ULX Command Help Please
« Reply #5 on: July 05, 2017, 05:38:49 am »
Awesome! The structure for a command that acts on the calling_ply is similar. :)

Example - A command that heals the calling_ply:
Code: Lua
  1. function ulx.heal( calling_ply )
  2.     local v = target_plys[ i ]
  3.     v:SetHealth( v:GetMaxHealth() )
  4. end
  5. local heal = ulx.command( "Fun", "ulx heal", ulx.heal, "!heal" )
  6. heal:defaultAccess( ULib.ACCESS_ALL )
  7. heal:help( "Heals self." )

You will notice I removed cmd:addParam{ type=ULib.cmds.PlayersArg }. We don’t add this parameter because our command is not going to target other players.

See if you can update that example to make the calling_ply say something.

Okay thank you, can you add me on Steam so we can speak a bit more please?

  • Print