can someone help me with this lua error?
[ERROR] gamemodes/darkrp/gamemode/shared.lua:448: ')' expected (to close '(' at line 434) near '}'
1. unknown - gamemodes/darkrp/gamemode/shared.lua:0
F
TEAM_CAR = AddExtraTeam("Car Dealer", {
color = Color(0, 162, 46, 255),
model = "models/Characters/Hostage_02.mdl",
description = [[You are a Car Dealer, you engineer and sell vehicles to other players!
try and make a profit off everything you sell.
Raid=No
Mug=No]],
weapons = {},
command = "cardealer",
max = 2,
salary = 65,
admin = 0,
vote = false,
hasLicense = false,
})
What is line 434?
[QUOTE=blarescares;44401182]TEAM_CAR = AddExtraTeam("Car Dealer", {
color = Color(0, 162, 46, 255),
model = "models/Characters/Hostage_02.mdl",
description = [[You are a Car Dealer, you engineer and sell vehicles to other players!
try and make a profit off everything you sell.
Raid=No
Mug=No]],
weapons = {},
command = "cardealer",
max = 2,
salary = 65,
admin = 0,
vote = false,
hasLicense = false,
})[/QUOTE]
If you're using DarkRP 2.5.X, I think it's because of the top line.
Change
[lua]TEAM_CAR = AddExtraTeam("Car Dealer", {[/lua]
to
[lua]TEAM_CAR = DarkRP.createJob("Car Dealer", {[/lua]
Going by thread title: "this" isn't used in Lua, instead of using this-> ... we use self. or self: depending on how the function was defined or if you're accessing a variable, or function:
[lua]local blah = { };
// in . delimited functions, self is expected to be the first argument if it's within a meta-table system
function blah.newfunc( self )
// Accessing variables must be done using .
self.var = true;
end
// is the same as
// in : delimited functions, self is automatic in meta-table system
function blah:newfunc( )
// Accessing variables must be done using .
self.var = true;
end[/lua]
For thread content: DarkRP Help Thread: [url]http://facepunch.com/showthread.php?t=1249475[/url]
I'm not sure if this was intended or not:
change:
[lua]description = [[You are a Car Dealer, you engineer and sell vehicles to other players!
try and make a profit off everything you sell.
Raid=No
Mug=No]],[/lua]
to:
[lua]description = [[You are a Car Dealer, you engineer and sell vehicles to other players!
try and make a profit off everything you sell.]],
Raid=No,
Mug=No,[/lua]
[QUOTE=Acecool;44405994]Going by thread title: "this" isn't used in Lua, instead of using this-> ... we use self. or self: depending on how the function was defined or if you're accessing a variable, or function:
[lua]local blah = { };
// in . delimited functions, self is expected to be the first argument if it's within a meta-table system
function blah.newfunc( self )
// Accessing variables must be done using .
self.var = true;
end
// is the same as
// in : delimited functions, self is automatic in meta-table system
function blah:newfunc( )
// Accessing variables must be done using .
self.var = true;
end[/lua]
For thread content: DarkRP Help Thread: [url]http://facepunch.com/showthread.php?t=1249475[/url]
I'm not sure if this was intended or not:
change:
[lua]description = [[You are a Car Dealer, you engineer and sell vehicles to other players!
try and make a profit off everything you sell.
Raid=No
Mug=No]],[/lua]
to:
[lua]description = [[You are a Car Dealer, you engineer and sell vehicles to other players!
try and make a profit off everything you sell.]],
Raid=No,
Mug=No,[/lua][/QUOTE]
It's intended; raid and mug aren't valid parameters for the table.
[editline]30th March 2014[/editline]
Also, what is the first half of your post even relating to?
Ah, I wasn't sure whether or not he had that for the description vs custom vars..
The first half answers the thread-title question.
In C#, you use "this" instead of "self", I assume the same goes for C, C++,
That's what Acecool was referring too, he thought that he tried using "this." instead of self.
thanks guys I already fixed it tho :/ to late now
Sorry, you need to Log In to post a reply to this thread.