1
- local stats = {
1
+ local statsTable = {
2
2
[69 ] = 500 , -- Pistol
3
3
[70 ] = 999 , -- Silenced pistol
4
4
[71 ] = 999 , -- Desert eagle
@@ -15,22 +15,24 @@ local stats = {
15
15
[230 ] = 999 -- Cycling
16
16
}
17
17
18
- local function applyStatsForPlayer (player )
19
- for stat , value in pairs (stats ) do
20
- player : setStat ( stat , value )
18
+ local function applyStatsForPlayer (playerElement )
19
+ for statName , statValue in pairs (statsTable ) do
20
+ setPedStat ( playerElement , statName , statValue )
21
21
end
22
22
end
23
23
24
- local function applyStatsForEveryone ()
25
- for _ , player in pairs (Element .getAllByType " player" ) do
26
- applyStatsForPlayer (player )
27
- end
28
- end
29
- addEventHandler (" onResourceStart" , resourceRoot , applyStatsForEveryone )
30
- addEventHandler (" onGamemodeMapStart" , root , applyStatsForEveryone )
31
-
32
24
local function applyStatsForSource ()
33
25
applyStatsForPlayer (source )
34
26
end
35
27
addEventHandler (" onPlayerJoin" , root , applyStatsForSource )
36
28
addEventHandler (" onPlayerSpawn" , root , applyStatsForSource )
29
+
30
+ local function applyStatsForEveryone ()
31
+ local playersTable = getElementsByType (" player" )
32
+
33
+ for playerID = 1 , # playersTable do
34
+ applyStatsForPlayer (playersTable [playerID ])
35
+ end
36
+ end
37
+ addEventHandler (" onResourceStart" , resourceRoot , applyStatsForEveryone )
38
+ addEventHandler (" onGamemodeMapStart" , root , applyStatsForEveryone )
0 commit comments