There is a code for not repeating the playermodels, that is a single player using the model
hook.Add("PlayerInitialSpawn", "PlayerModelHook", function(ply)
num = math.random(1, 8)
if num == 1 then
ply:SetModel("models/player/swat.mdl")
elseif num == 2 then
ply:SetModel("models/player/skeleton.mdl")
elseif num == 3 then
ply:SetModel("models/player/doa5_kasumi.mdl")
elseif num == 4 then
ply:SetModel("models/player/kermit.mdl")
elseif num == 5 then
ply:SetModel("models/player/sanic.jpeg.mdl")
elseif num == 6 then
ply:SetModel("models/player/racisanic.mdl")
elseif num == 7 then
ply:SetModel("models/player/zombie_classic.mdl")
elseif num == 8 then
ply:SetModel("models/code_gs/buzz/buzzplayer.mdl")
end
end)
You could do this:
hook.Add("PlayerInitialSpawn", "PlayerModelHook", function(ply)
local models = {
"models/player/swat.mdl",
"models/player/skeleton.mdl",
"models/player/doa5_kasumi.mdl",
"models/player/kermit.mdl",
"models/player/sanic.jpeg.mdl",
"models/player/racisanic.mdl",
"models/player/zombie_classic.mdl",
"models/code_gs/buzz/buzzplayer.mdl"
}
ply:SetModel( table.Random( models ) )
end)
table.Random
There's a lot of ways to achieve what you're looking for, the best way would depend on your gamemode, could you please supply that.
When a player leaves during the game and another enters, this error appears:
[ERROR] gamemodes/terrortown/gamemode/player.lua:258: bad argument #1 to 'SetModel' (string expected, got nil)
1. SetModel - [C]:-1
2. v - gamemodes/terrortown/gamemode/player.lua:258
3. unknown - lua/includes/modules/hook.lua:84
4. CreateNextBot - [C]:-1
5. unknown - addons/ttt bots/lua/autorun/server/potato_ttt_bots.lua:571
6. unknown - lua/includes/modules/concommand.lua:54
Try using
local availableModels = table.Copy(spawnModels)
Ta
Thank you!!!!!
Sorry, you need to Log In to post a reply to this thread.