Skip to content

Commit c319c02

Browse files
committed
play: Fix getting the same skins over and over
Every time I started the server I would spawn with the same skin, over 10 times in a row. math.randomseed fixes this garbage randomness.
1 parent 0eebbf6 commit c319c02

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

[gamemodes]/[play]/play/play_players.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ local spawnsCount = #playerSpawns
22
local skinsCount = #playerSkins
33

44
function playSpawnPlayer(playerElement)
5-
local validElement = isElement(playerElement)
6-
7-
if not validElement then
5+
if not isElement(playerElement) then
86
return false
97
end
10-
8+
9+
math.randomseed(getTickCount()) -- Fix getting exact same skins over and over
1110
local randomSpawn = math.random(spawnsCount)
1211
local spawnData = playerSpawns[randomSpawn]
1312
local posX, posY, posZ, rotX = unpack(spawnData)

0 commit comments

Comments
 (0)