• Print

Author Topic: Having Lua error  (Read 5378 times)

0 Members and 1 Guest are viewing this topic.

Offline Loukiria

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Having Lua error
« on: July 21, 2017, 02:51:50 am »
Okay, so, i'm  an begginner at lua coding and I wanted to make an lua script which allow you to have "trail" on player but all I am having is this :
[ERROR] addons/ulx-master/lua/ulx/modules/sh/trail.lua:5: ')' expected near 'v'
  1. unknown - addons/ulx-master/lua/ulx/modules/sh/trail.lua:0



Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Having Lua error
« Reply #1 on: July 21, 2017, 02:57:12 am »
You can paste the code in instead of attaching it. Also
Code: Lua
  1. ULib.tsay( calling_ply v:Nick .. " is dead!", true )
  2.  

Do you see anything missing? Maybe a comma?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Loukiria

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Having Lua error
« Reply #2 on: July 21, 2017, 03:08:40 am »
oh, darn, I didnt saw it, Thank for the answer but the error is still here but differently this time :
[ERROR] addons/ulx-master/lua/ulx/modules/sh/trail.lua:5: function arguments expected near '..'
  1. unknown - addons/ulx-master/lua/ulx/modules/sh/trail.lua:0

also I am new here and  dont really know how to put the code here

Offline Loukiria

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Having Lua error
« Reply #3 on: July 21, 2017, 03:47:20 am »
Nevermind, I found another error but still getting error :
[ERROR] addons/ulx-master/lua/ulx/modules/sh/trail.lua:12: '<eof>' expected near 'end'
  1. unknown - addons/ulx-master/lua/ulx/modules/sh/trail.lua:0


I corrected these parts :
         ULib.tsay( calling_ply, v:Nick() .. "is dead!", true )



Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: Having Lua error
« Reply #4 on: July 21, 2017, 07:18:21 am »
You have an extra end on line 9

Updated code
Code: Lua
  1. function ulx.trail( calling_ply, target_plys, string_arg )
  2.  
  3.         for _, v in ipairs( target_plys ) do
  4.                 if not v:Alive() then
  5.                         ULib.tsay( calling_ply, v:Nick .. "is dead!", true )
  6.                         return
  7.                 else
  8.                         local trail = util.SpriteTrail( ply, 0, Color( math.Rand(0,255), math.Rand(0,255), math.Rand(0,225) ), fasle, 100, 0, 3, 1/(100)*0.5, "trails/plasma.vmt" )
  9.                 end
  10.         end
  11.         ulx.fancyLogAdmin( calling_ply, "#A turned #T into a smoke", target_plys )
  12. end
  13.  
  14. local trail = ulx.command( "Fun", "ulx trail", ulx.trail, "!trail" )
  15. trail:addParam{ type=ULib.cmds.PlayersArg }
  16. trail:defaultAccess( ULib.ACCESS_ADMIN )
  17.  
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline Loukiria

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Having Lua error
« Reply #5 on: July 21, 2017, 07:30:53 am »
Everything work, thanks, you guys are greats
anyways, I have one question
I wonder if it is possible to make the trail to be the "colors of the skin" like, I choosed red and the trail is red and more ... ?

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Having Lua error
« Reply #6 on: July 21, 2017, 11:18:05 pm »
For sure! Have a look at the following function: Player:GetPlayerColor.

Though the name of this function is a bit misleading, because Player:GetPlayerColor doesn't return a Color but a Vector! You still have to convert it ToColor.
« Last Edit: July 22, 2017, 12:59:38 am by Timmy »

  • Print