I'm new to this server and I don't know if I posted this in the right place, if I did then I apologize!
The hands won't show for me. I need help with scripting, here is the error:
[ERROR] gamemodes/terrortown/gamemode/player.lua:94: attempt to call method 'Set PlayerHands' (a nil value)
1. unknown - gamemodes/terrortown/gamemode/player.lua:94
2. Spawn - [C]: -1
3. SpawnForRound - gamemodes/terrortown/gamemode/player_ext.lua:294
4. SpawnWillingPlayers - gamemodes/terrortown/gamemode/init.lua:567
5. unknown - gamemodes/terrortown/gamemode/init.lua:414
Please help me with this as soon as possible!
[highlight](User was banned for this post ("undescriptive thread title, wrong section" - postal))[/highlight]
Post your code.
That is the code
That's an error. Post the code that goes with it in [code] tags.
function GM:PlayerSpawn(ply)
-- Some spawns may be tilted
ply:ResetViewRoll()
-- Clear out stuff like whether we ordered guns or what bomb code we used
ply:ResetRoundFlags()
-- latejoiner, send him some info
if GetRoundState() == ROUND_ACTIVE then
SendRoundState(GetRoundState(), ply)
end
ply.spawn_nick = ply:Nick()
ply.has_spawned = true
-- let the client do things on spawn
SendUserMessage("plyspawned", ply, ply:IsSpec())
if ply:IsSpec() then
ply:StripAll()
ply:Spectate(OBS_MODE_ROAMING)
return
end
ply:UnSpectate()
-- ye olde hooks
hook.Call("PlayerLoadout", GAMEMODE, ply)
hook.Call("PlayerSetModel", GAMEMODE, ply)
local oldhands = ply:GetHands()
if IsValid(oldhands) then oldhands:Remove() end
local hands = ents.Create( "gmod_hands" )
if IsValid(hands) then
ply:SetHands(hands)
hands:SetOwner(ply)
-- Find model and attach to vm, currently ours
ply:SetPlayerHands()
ply:DeleteOnRemove()
hands:Spawn()
end
SCORE:HandleSpawn(ply)
end
Can you edit it so it's wrapped with [noparse][code][/code][/noparse] so that the indention is displayed?
This is for the player_ext
-- respawn anyone else
if self:Team() == TEAM_SPEC then
self:UnSpectate()
end
self:StripAll()
self:SetTeam(TEAM_TERROR)
self:Spawn()
-- tell caller that we spawned
return true
end
[editline]29th August 2014[/editline]
How do I do that?
[editline]29th August 2014[/editline]
[code][/code]function GM:NetworkIDValidated( name, steamid )
-- edge case where player authed after initspawn
for _, p in pairs(player.GetAll()) do
if IsValid(p) and p:SteamID() == steamid and p.delay_karma_recall then
KARMA.LateRecallAndSet(p)
return
end
end
end
function GM:PlayerSpawn(ply)
-- Some spawns may be tilted
ply:ResetViewRoll()
-- Clear out stuff like whether we ordered guns or what bomb code we used
ply:ResetRoundFlags()
-- latejoiner, send him some info
if GetRoundState() == ROUND_ACTIVE then
SendRoundState(GetRoundState(), ply)
end
ply.spawn_nick = ply:Nick()
ply.has_spawned = true
-- let the client do things on spawn
SendUserMessage("plyspawned", ply, ply:IsSpec())
if ply:IsSpec() then
ply:StripAll()
ply:Spectate(OBS_MODE_ROAMING)
return
end
ply:UnSpectate()
-- ye olde hooks
hook.Call("PlayerLoadout", GAMEMODE, ply)
hook.Call("PlayerSetModel", GAMEMODE, ply)
local oldhands = ply:GetHands()
if IsValid(oldhands) then oldhands:Remove() end
local hands = ents.Create( "gmod_hands" )
if IsValid(hands) then
ply:SetHands(hands)
hands:SetOwner(ply)
-- Find model and attach to vm, currently ours
ply:SetPlayerHands()
ply:DeleteOnRemove()
hands:Spawn()
end
SCORE:HandleSpawn(ply)
end
function GM:IsSpawnpointSuitable(ply, spwn, force, rigged)
if not IsValid(ply) or not ply:IsTerror() then return true end
if not rigged and (not IsValid(spwn) or not spwn:IsInWorld()) then return false end
-- spwn is normally an ent, but we sometimes use a vector for jury rigged
-- positions
local pos = rigged and spwn or spwn:GetPos()
if not util.IsInWorld(pos) then return false end
local blocking = ents.FindInBox(pos + Vector( -16, -16, 0 ), pos + Vector( 16, 16, 64 ))
for k, p in pairs(blocking) do
if IsValid(p) and p:IsPlayer() and p:IsTerror() and p:Alive() then
if force then
p:Kill()
else
return false
end
end
end
return true
end
[/QUOTE][/QUOTE]
Press the edit button in the bottom right, put [noparse][code] at the beginning of the code, and [/code][/noparse] at the end.
[code]function GM:NetworkIDValidated( name, steamid )
-- edge case where player authed after initspawn
for _, p in pairs(player.GetAll()) do
if IsValid(p) and p:SteamID() == steamid and p.delay_karma_recall then
KARMA.LateRecallAndSet(p)
return
end
end
end
function GM:PlayerSpawn(ply)
-- Some spawns may be tilted
ply:ResetViewRoll()
-- Clear out stuff like whether we ordered guns or what bomb code we used
ply:ResetRoundFlags()
-- latejoiner, send him some info
if GetRoundState() == ROUND_ACTIVE then
SendRoundState(GetRoundState(), ply)
end
ply.spawn_nick = ply:Nick()
ply.has_spawned = true
-- let the client do things on spawn
SendUserMessage("plyspawned", ply, ply:IsSpec())
if ply:IsSpec() then
ply:StripAll()
ply:Spectate(OBS_MODE_ROAMING)
return
end
ply:UnSpectate()
-- ye olde hooks
hook.Call("PlayerLoadout", GAMEMODE, ply)
hook.Call("PlayerSetModel", GAMEMODE, ply)
local oldhands = ply:GetHands()
if IsValid(oldhands) then oldhands:Remove() end
local hands = ents.Create( "gmod_hands" )
if IsValid(hands) then
ply:SetHands(hands)
hands:SetOwner(ply)
-- Find model and attach to vm, currently ours
ply:SetPlayerHands()
ply:DeleteOnRemove()
hands:Spawn()
end
SCORE:HandleSpawn(ply)
end
function GM:IsSpawnpointSuitable(ply, spwn, force, rigged)
if not IsValid(ply) or not ply:IsTerror() then return true end
if not rigged and (not IsValid(spwn) or not spwn:IsInWorld()) then return false end
-- spwn is normally an ent, but we sometimes use a vector for jury rigged
-- positions
local pos = rigged and spwn or spwn:GetPos()
if not util.IsInWorld(pos) then return false end
local blocking = ents.FindInBox(pos + Vector( -16, -16, 0 ), pos + Vector( 16, 16, 64 ))
for k, p in pairs(blocking) do
if IsValid(p) and p:IsPlayer() and p:IsTerror() and p:Alive() then
if force then
p:Kill()
else
return false
end
end
end
return true
end
[/code]
[editline]29th August 2014[/editline]
For player_ext.lua
[code]-- respawn anyone else
if self:Team() == TEAM_SPEC then
self:UnSpectate()
end
self:StripAll()
self:SetTeam(TEAM_TERROR)
self:Spawn()
-- tell caller that we spawned
return true
end[/code]
No point in creating a hands entity and doing all that junk; just use ply:SetupHands() -- implying that the gamemode you are using has the proper player classes for it.
For init.lua
[code]local function SpawnEntities()
local et = ents.TTT
-- Spawn weapons from script if there is one
local import = et.CanImportEntities(game.GetMap())
if import then
et.ProcessImportScript(game.GetMap())
else
-- Replace HL2DM/ZM ammo/weps with our own
et.ReplaceEntities()
-- Populate CS:S/TF2 maps with extra guns
et.PlaceExtraWeapons()
end
-- Finally, get players in there
SpawnWillingPlayers()
end[/code]
[code]function SpawnWillingPlayers(dead_only)
local plys = player.GetAll()
local wave_delay = GetConVar("ttt_spawn_wave_interval"):GetFloat()
-- simple method, should make this a case of the other method once that has
-- been tested.
if wave_delay <= 0 or dead_only then
for k, ply in pairs(player.GetAll()) do
if IsValid(ply) then
ply:SpawnForRound(dead_only)
end
end
else
-- wave method
local num_spawns = #GetSpawnEnts()
local to_spawn = {}
for _, ply in RandomPairs(plys) do
if IsValid(ply) and ply:ShouldSpawn() then
table.insert(to_spawn, ply)
GAMEMODE:PlayerSpawnAsSpectator(ply)
end
end[/code]
Oh, this is TTT. Update your gamemode; TTT hasn't had seperate hand entities like that in a while.
That's it? Only update it?
Do I have to redownload all the mods?
What mods? Just reinstall the entire gamemode.
I'm hosting a TTT server and added a few mods.
[editline]29th August 2014[/editline]
The problem is with my server :(
What mods? Addons? Modifications to core files?
All by CoderHire:
Detailed events
M9K assault rifles
Head decapitation v2.1
BF4 HUD and Scoreboard
ULX Ulysses
That's about it really
They don't have anything to do with the gamemode. Just reinstall the physical terrortown folder.
You have the pateince of a saint
[QUOTE=Exho;45834232]You have the pateince of a saint[/QUOTE]
Eh, at least this person isn't resisting his help. If someone is willing to receive help they should receive it.
Sorry, you need to Log In to post a reply to this thread.