• Print

Author Topic: Ulx lua help  (Read 5542 times)

0 Members and 1 Guest are viewing this topic.

Offline Gigabait

  • Newbie
  • *
  • Posts: 13
  • Karma: -2
Ulx lua help
« on: February 06, 2017, 05:57:12 am »
Me need help on ulx

Code: [Select]
ulx.crash( calling_ply, target_ply, should_silent ) // Original
ulx.crash( "Console", ply:Nick(), true )
Who is calling_ply if this code using in server side ? I don't understand :/
Code: [Select]
[ERROR] addons/customcommands/lua/ulx/modules/sh/cc_util.lua:393: attempt to index a
string value with bad key ('SendLua' is not part of the string library)
  1. error - [C]:-1
   2. __index - lua/includes/extensions/string.lua:301
    3. crash - addons/customcommands/lua/ulx/modules/sh/cc_util.lua:393
     4. fn - lua/autorun/server/sv_list.lua:13
      5. unknown - addons/ulib/lua/ulib/shared/hook.lua:179

I think my problem in wrong calling_ply on calling_ply

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: Ulx lua help
« Reply #1 on: February 06, 2017, 06:33:05 am »
Well "calling_ply" doesn't work with the console.

It would be something more like this, for what I would do:

Code: Lua
  1. if not calling_ply:IsValid() then
  2. --Insert the rest of your code here--
  3. else
  4. --Insert here as well--

Offline Gigabait

  • Newbie
  • *
  • Posts: 13
  • Karma: -2
Re: Ulx lua help
« Reply #2 on: February 06, 2017, 08:50:54 am »
Well "calling_ply" doesn't work with the console.

It would be something more like this, for what I would do:

Code: Lua
  1. if not calling_ply:IsValid() then
  2. --Insert the rest of your code here--
  3. else
  4. --Insert here as well--

I use PlayerInitialSpawn func , or

Code: [Select]
if SERVER then

util.AddNetworkString( "Test" )

local function test( ply )
net.Start("Test")
net.Send(ply)
end
hook.Add( "PlayerInitialSpawn", "test", test )

else


net.Receive( "Test", function(ply)
ulx.crash( calling_ply, ply, true ) // And who is calling_ply ? :////

end )
end

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Ulx lua help
« Reply #3 on: February 06, 2017, 09:13:47 am »
"calling_ply" is a variable ULX uses to store the player that is calling the command. When in the function of the command, you can call this, like "calling_ply:Nick()" to display the name of the person who called the command. If you're passing the argument, I think you can edit who is considered the calling_ply if you pass it. Not sure, though.


Also, net.Receive takes two arguments to its function, Len and ply. The first is Len (length of the message) and ply the second. Even if you're not using Len, you need to specify it (or just put a placeholder)
« Last Edit: February 06, 2017, 09:17:32 am by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Gigabait

  • Newbie
  • *
  • Posts: 13
  • Karma: -2
Re: Ulx lua help
« Reply #4 on: February 06, 2017, 07:24:53 pm »
"calling_ply" is a variable ULX uses to store the player that is calling the command. When in the function of the command, you can call this, like "calling_ply:Nick()" to display the name of the person who called the command. If you're passing the argument, I think you can edit who is considered the calling_ply if you pass it. Not sure, though.


Also, net.Receive takes two arguments to its function, Len and ply. The first is Len (length of the message) and ply the second. Even if you're not using Len, you need to specify it (or just put a placeholder)
"calling_ply" may be a console ? or only player ? as if using ulx command in srcds ,will be adding message in chat "by console". Who is there calling_ply?

And i found my answer , i just used function on directly.

Code: [Select]
local function test( ply )
ply:SendLua( code )
hook.Add( "PlayerInitialSpawn", "test", test )

  • Print