I am currently making a MilitaryRP and am using lots of models that require bodygroups for what I'm aiming to do. Below is what I currently have put under the model:
[CODE]PlayerSpawn = function(ply)
ply:SetBodygroup(1, 3)
ply:SetBodygroup(2, 0)
ply:SetBodygroup(3, 3)
ply:SetBodygroup(4, 0)
ply:SetBodygroup(5, 0)
ply:SetBodygroup(6, 0)
ply:SetSkin(0)
ply:SetHealth("100")
end,[/CODE]
If anybody has any solutions, I'm all ears.
Ehm...
Where is this code at?
How are you running it?
And also ply:SetHealth first argument is a number, not an string, so put instead 100.
[QUOTE=geferon;50868515]Ehm...
Where is this code at?
How are you running it?
And also ply:SetHealth first argument is a number, not an string, so put instead 100.[/QUOTE]
This code is in my darkrpmodification-master/lua/darkrpcustomthings/jobs.lua
Here's the full code for the job with the edit to ply:SetHealth that you said:
[CODE]
TEAM_MARINE = DarkRP.createJob("Marine Leisure",{
color = Color(0, 255, 0, 255),
model = {"models/player/sanic/marinedp.mdl"},
description = [[You are a Marine]],
weapons = {"tfa_bf4_aek971","tfa_deagle","tfa_tec9"},
command = "marinel",
max = 0,
salary = 50,
admin = 0,
vote = false,
hasLicense = false,
category = "Marines",
PlayerSpawn = function(ply)
ply:SetBodygroup(1, 3)
ply:SetBodygroup(2, 0)
ply:SetBodygroup(3, 3)
ply:SetBodygroup(4, 0)
ply:SetBodygroup(5, 0)
ply:SetBodygroup(6, 0)
ply:SetSkin(0)
ply:SetHealth(100)
end,
customCheck = function(ply) return CLIENT or ply:GetNWString("usergroup") == "marine" or ply:IsAdmin() end,
CustomCheckFailMsg = "You are not authorized to access this rank"
})
[/code]
Try setting a timer for 0.1 secs
[QUOTE=geferon;50868778]Try setting a timer for 0.1 secs[/QUOTE]
Can you possibly show me how to do so? I've never used timers before, and I'd appreciate just having it to copy/paste rather than having to mess around with it, possibly having to redo it multiple times.
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/timer/Simple]timer.Simple[/url]
Theres a couple examples on the wiki.
The timer didn't work. Is there anywhere specific it needs to be in the files? If so, where should it be?
[QUOTE=EliJenkin;50869203]The timer didn't work. Is there anywhere specific it needs to be in the files? If so, where should it be?[/QUOTE]
[CODE]
PlayerSpawn = function(ply)
timer.Simple(.1, function()
ply:SetBodygroup(1, 3)
ply:SetBodygroup(2, 0)
ply:SetBodygroup(3, 3)
ply:SetBodygroup(4, 0)
ply:SetBodygroup(5, 0)
ply:SetBodygroup(6, 0)
ply:SetSkin(0)
ply:SetHealth(100)
end)
end,
[/CODE]
So, that didn't seem to work either. Could it possibly be something with mounted addons? I'm only asking because I have sound issues with certain addons because of this.
[QUOTE=EliJenkin;50871138]So, that didn't seem to work either. Could it possibly be something with mounted addons? I'm only asking because I have sound issues with certain addons because of this.[/QUOTE]
As long as you're able to see the model I don't think so. If it comes down to it here's a really ghetto fix.
[CODE]
hook.Add("PlayerSpawn", "BodyGroupsYo", function(ply)
if ply:GetModel() == "models/player/sanic/marinedp.mdl" then
ply:SetBodygroup(1, 3)
ply:SetBodygroup(2, 0)
ply:SetBodygroup(3, 3)
ply:SetBodygroup(4, 0)
ply:SetBodygroup(5, 0)
ply:SetBodygroup(6, 0)
ply:SetSkin(0)
end
end)
[/CODE]
Try using PlayerSetModel
[code]
TEAM_MARINE = DarkRP.createJob("Marine Leisure",{
color = Color(0, 255, 0, 255),
model = {"models/player/sanic/marinedp.mdl"},
description = [[You are a Marine]],
weapons = {"tfa_bf4_aek971","tfa_deagle","tfa_tec9"},
command = "marinel",
max = 0,
salary = 50,
admin = 0,
vote = false,
hasLicense = false,
category = "Marines",
PlayerSetModel = function(ply)
...
end
[/code]
[QUOTE=Coffeee;50872234]Try using PlayerSetModel
[code]
TEAM_MARINE = DarkRP.createJob("Marine Leisure",{
color = Color(0, 255, 0, 255),
model = {"models/player/sanic/marinedp.mdl"},
description = [[You are a Marine]],
weapons = {"tfa_bf4_aek971","tfa_deagle","tfa_tec9"},
command = "marinel",
max = 0,
salary = 50,
admin = 0,
vote = false,
hasLicense = false,
category = "Marines",
PlayerSetModel = function(ply)
...
end
[/code][/QUOTE]
So far none of these have worked. I'm not sure why, since I've seen plenty of others with this problem and use these same fixes, to an extent, and it was fine for them.
Show what code you used
[QUOTE=Coffeee;50873607]Show what code you used[/QUOTE]
This is what I used off of my assumption as to what to put in place of "...":
[LUA]
TEAM_MARINE = DarkRP.createJob("Marine Leisure",{
color = Color(0, 255, 0, 255),
model = {"models/player/sanic/marinedp.mdl"},
description = [[You are a Marine]],
weapons = {"tfa_bf4_aek971","tfa_deagle","tfa_tec9"},
command = "marinel",
max = 0,
salary = 50,
admin = 0,
vote = false,
hasLicense = false,
category = "Marines",
PlayerSetModel = function(ply)
ply:SetBodygroup(1, 3)
ply:SetBodygroup(2, 0)
ply:SetBodygroup(3, 3)
ply:SetBodygroup(4, 0)
ply:SetBodygroup(5, 0)
ply:SetBodygroup(6, 0)
ply:SetSkin(0)
end,
customCheck = function(ply) return CLIENT or ply:GetNWString("usergroup") == "marine" or ply:IsAdmin() end,
CustomCheckFailMsg = "You are not authorized to access this rank"
})
[/LUA]
[QUOTE=EliJenkin;50873524]So far none of these have worked. I'm not sure why, since I've seen plenty of others with this problem and use these same fixes, to an extent, and it was fine for them.[/QUOTE]
It's probably an issue with the model itself. Maybe those body groups don't exist?
[QUOTE=Jiwer;50874959]It's probably an issue with the model itself. Maybe those body groups don't exist?[/QUOTE]
I mean, I'm not sure why they wouldn't since they're set up like that in the context menu.
[QUOTE=EliJenkin;50874986]I mean, I'm not sure why they wouldn't since they're set up like that in the context menu.[/QUOTE]
This might be the problem, I don't know but body groups start from 0 usually.
Sorry, you need to Log In to post a reply to this thread.