@@ -170,17 +170,17 @@ end
170170
171171function Superman .onJoin (player )
172172 local self = Superman
173- local player = player or source
173+ local playerElement = player or source
174174
175- setPlayerFlying (player , false )
175+ setPlayerFlying (playerElement , false )
176176end
177177
178178function Superman .onQuit (reason , player )
179179 local self = Superman
180- local player = player or source
180+ local playerElement = player or source
181181
182- if isPlayerFlying (player ) then
183- self :restorePlayer (player )
182+ if isPlayerFlying (playerElement ) then
183+ self :restorePlayer (playerElement )
184184 end
185185end
186186
@@ -271,7 +271,7 @@ function Superman.startFlight()
271271 return
272272 end
273273
274- triggerServerEvent (" superman:start" , root )
274+ triggerServerEvent (" superman:start" , localPlayer )
275275 setPlayerFlying (localPlayer , true )
276276 setElementVelocity (localPlayer , 0 , 0 , 0 )
277277 self .currentSpeed = 0
@@ -285,7 +285,7 @@ function Superman.processControls()
285285 local self = Superman
286286
287287 if not isPlayerFlying (localPlayer ) then
288- jump , oldJump = getPedControlState (" jump" ), jump
288+ jump , oldJump = getPedControlState (localPlayer , " jump" ), jump
289289 if not oldJump and jump then
290290 Superman .onJump ()
291291 end
@@ -295,15 +295,15 @@ function Superman.processControls()
295295 -- Calculate the requested movement direction
296296 local Direction = Vector3D :new (0 , 0 , 0 )
297297
298- if getPedControlState (" forwards" ) then
298+ if getPedControlState (localPlayer , " forwards" ) then
299299 Direction .y = 1
300- elseif getPedControlState (" backwards" ) then
300+ elseif getPedControlState (localPlayer , " backwards" ) then
301301 Direction .y = - 1
302302 end
303303
304- if getPedControlState (" left" ) then
304+ if getPedControlState (localPlayer , " left" ) then
305305 Direction .x = 1
306- elseif getPedControlState (" right" ) then
306+ elseif getPedControlState (localPlayer , " right" ) then
307307 Direction .x = - 1
308308 end
309309
@@ -314,18 +314,18 @@ function Superman.processControls()
314314 local SightDirection = Vector3D :new ((lookX - cameraX ), (lookY - cameraY ), (lookZ - cameraZ ))
315315 SightDirection :Normalize ()
316316
317- if getPedControlState (" look_behind" ) then
317+ if getPedControlState (localPlayer , " look_behind" ) then
318318 SightDirection = SightDirection :Mul (- 1 )
319319 end
320320
321321 -- Calculate the current max speed and acceleration values
322322 local maxSpeed = MAX_SPEED
323323 local acceleration = ACCELERATION
324324
325- if getPedControlState (" sprint" ) then
325+ if getPedControlState (localPlayer , " sprint" ) then
326326 maxSpeed = MAX_SPEED * EXTRA_SPEED_FACTOR
327327 acceleration = acceleration * EXTRA_ACCELERATION_FACTOR
328- elseif getPedControlState (" walk" ) then
328+ elseif getPedControlState (localPlayer , " walk" ) then
329329 maxSpeed = MAX_SPEED * LOW_SPEED_FACTOR
330330 acceleration = acceleration * LOW_ACCELERATION_FACTOR
331331 end
@@ -449,7 +449,7 @@ function Superman.processFlight()
449449 self :restorePlayer (player )
450450 if player == localPlayer then
451451 setGravity (serverGravity )
452- triggerServerEvent (" superman:stop" , root )
452+ triggerServerEvent (" superman:stop" , localPlayer )
453453 end
454454 elseif distanceToGround and distanceToGround < LANDING_DISTANCE then
455455 self :processLanding (player , Velocity , distanceToGround )
@@ -476,7 +476,7 @@ function Superman:processIdleFlight(player)
476476 local Sight = Vector3D :new (lookX - cameraX , lookY - cameraY , lookZ - cameraZ )
477477 Sight :Normalize ()
478478
479- if getPedControlState (" look_behind" ) then
479+ if getPedControlState (localPlayer , " look_behind" ) then
480480 Sight = Sight :Mul (- 1 )
481481 end
482482
622622-- Vectors
623623--
624624Vector3D = {
625- new = function (self , _x , _y , _z )
626- local newVector = {x = _x or 0.0 , y = _y or 0.0 , z = _z or 0.0 }
625+ new = function (self , posX , posY , posZ )
626+ local newVector = {x = posX or 0.0 , y = posY or 0.0 , z = posZ or 0.0 }
627627 return setmetatable (newVector , {__index = Vector3D })
628628 end ,
629629
0 commit comments