@@ -77,7 +77,6 @@ local finalRank = 0
7777function killBattleGroundsPlayer (player ,killer ,headshot )
7878 if not player then player = source end
7979 local x ,y ,z = getElementPosition (player )
80- local deadPlayerTable = {}
8180 pedCol = false
8281 killPed (player )
8382 if not isElementInWater (player ) then
@@ -88,7 +87,7 @@ function killBattleGroundsPlayer(player,killer,headshot)
8887 local dimension = getElementDimension (player )
8988 ped = createPed (skin ,6000 ,6000 ,0 ,rotZ )
9089 pedCol = createColSphere (6000 ,6000 ,0 ,1.5 )
91- deadPlayerTable [pedCol ] = {}
90+ lootpointData [pedCol ] = {}
9291 killPed (ped )
9392 setElementDimension (ped ,dimension )
9493 setTimer (destroyDeadPlayer ,600000 ,1 ,ped ,pedCol )
@@ -108,7 +107,7 @@ function killBattleGroundsPlayer(player,killer,headshot)
108107 end
109108 if pedCol then
110109 for k , data in ipairs (playerDataInfo [player ]) do
111- table.insert (deadPlayerTable [pedCol ],{data [2 ],data [3 ]})
110+ table.insert (lootpointData [pedCol ],{data [2 ],data [3 ]})
112111 end
113112 end
114113 setTimer (setElementPosition ,500 ,1 ,player ,6000 ,6000 ,0 )
@@ -139,8 +138,8 @@ function killBattleGroundsPlayer(player,killer,headshot)
139138 homeScreenDimension = homeScreenDimension + 1
140139 finalRank = gameCache [" playerAmount" ]
141140 gameCache [" playerAmount" ] = gameCache [" playerAmount" ]- 1
142- setElementData (player ," participatingInGame" ,false )
143141 if isElement (killer ) then
142+ setElementData (player ," participatingInGame" ,false )
144143 checkForWinner (killer )
145144 for i , players in ipairs (getElementsByType (" player" )) do
146145 if getElementData (players ," participatingInGame" ) then
@@ -149,16 +148,17 @@ function killBattleGroundsPlayer(player,killer,headshot)
149148 end
150149 triggerClientEvent (player ," mtabg_showEndscreen" ,player ,finalRank ,homeScreenDimension )
151150 else
152- if gameCache [" playerAmount" ] > 1 then
151+ if gameCache [" playerAmount" ] <= 1 then
152+ setElementData (player ," participatingInGame" ,false )
153153 for i , players in ipairs (getElementsByType (" player" )) do
154154 if getElementData (players ," participatingInGame" ) then
155- outputSideChat ( " Player " .. getPlayerName ( player ) .. " has died - " .. gameCache [ " playerAmount " ] .. " left " , players , 255 , 255 , 255 )
155+ checkForWinner ( players )
156156 end
157157 end
158158 else
159159 for i , players in ipairs (getElementsByType (" player" )) do
160160 if getElementData (players ," participatingInGame" ) then
161- checkForWinner ( players )
161+ outputSideChat ( " Player " .. getPlayerName ( player ) .. " has died - " .. gameCache [ " playerAmount " ] .. " left " , players , 255 , 255 , 255 )
162162 end
163163 end
164164 end
0 commit comments