Ulysses
Home
Help
Ulysses
»
General
»
Developers Corner
»
Having Lua error
« previous next »
Print
Pages: [
1
]
Go Down
Author
Topic: Having Lua error (Read 5378 times)
0 Members and 1 Guest are viewing this topic.
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
Logged
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
ULib
.
tsay
(
calling_ply v
:
Nick
..
" is dead!"
,
true
)
Do you see anything missing? Maybe a comma?
Logged
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.
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
Logged
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 )
Logged
jay209015
Ulysses Team Member
Hero Member
Posts: 934
Karma: 62
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
function
ulx
.
trail
(
calling_ply
,
target_plys
,
string_arg
)
for
_
,
v
in
ipairs
(
target_plys
)
do
if
not
v
:
Alive
(
)
then
ULib
.
tsay
(
calling_ply
,
v
:
Nick
..
"is dead!"
,
true
)
return
else
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"
)
end
end
ulx
.
fancyLogAdmin
(
calling_ply
,
"#A turned #T into a smoke"
,
target_plys
)
end
local
trail
=
ulx
.
command
(
"Fun"
,
"ulx trail"
,
ulx
.
trail
,
"!trail"
)
trail
:
addParam
{
type
=
ULib
.
cmds
.
PlayersArg
}
trail
:
defaultAccess
(
ULib
.
ACCESS_ADMIN
)
Logged
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
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 ... ?
Logged
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
»
Logged
Print
Pages: [
1
]
Go Up
« previous next »
Ulysses
»
General
»
Developers Corner
»
Having Lua error