Skip to content

Commit af0129f

Browse files
authored
Merge pull request #504 from bloodycop6385/feat-proper-bot-spawn
Improve model selection for bot character spawn
2 parents 434f13b + 9c6a616 commit af0129f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gamemode/core/hooks/sv_hooks.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ function GM:PlayerInitialSpawn(client)
99
local index = math.random(1, table.Count(ix.faction.indices))
1010
local faction = ix.faction.indices[index]
1111

12+
local models = faction:GetModels( client )
13+
14+
local model = models[ math.random( #models ) ]
15+
if ( istable( model ) ) then model = model[ 1 ] end
16+
17+
if ( !isstring( model ) ) then model = "models/gman.mdl" end
18+
1219
local character = ix.char.New({
1320
name = client:Name(),
1421
faction = faction and faction.uniqueID or "unknown",
15-
model = faction and table.Random(faction:GetModels(client)) or "models/gman.mdl"
22+
model = model,
1623
}, botID, client, client:SteamID64())
1724
character.isBot = true
1825

0 commit comments

Comments
 (0)