Skip to content

Commit 1f98aad

Browse files
authored
Apply suggestions from code review
1 parent 293e2ad commit 1f98aad

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

vMenuServer/MainServer.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ internal void GetOutOfCar([FromSource] Player source, int vehicleNetId)
553553
}
554554

555555
int playerHandle = NetworkGetEntityOwner(pedHandle);
556-
557556
Player player = GetPlayerFromServerId(playerHandle);
558557

559558
if (player is null || player == source)
@@ -912,10 +911,9 @@ internal async void SummonPlayer([FromSource] Player source, int target, int num
912911
return;
913912
}
914913

914+
bool lastVehicle = false;
915915
Ped sourcePed = source.Character;
916916
int sourcePedHandle = sourcePed.Handle;
917-
918-
bool lastVehicle = false;
919917
int sourcePedVehicle = GetVehiclePedIsIn(sourcePedHandle, lastVehicle);
920918

921919
if (sourcePedVehicle == 0)
@@ -938,15 +936,14 @@ internal async void SummonPlayer([FromSource] Player source, int target, int num
938936
continue;
939937
}
940938

939+
Vector3 checkPosition;
940+
long timeout = GetGameTimer() + 1_500;
941941
Vector3 priorPosition = targetPed.Position;
942942
Vector3 newPosition = sourcePed.Position + new Vector3(0f, 0f, 5f);
943943

944944
seatFound = true;
945945
targetPed.Position = newPosition;
946946

947-
Vector3 checkPosition;
948-
long timeout = GetGameTimer() + 1_500;
949-
950947
while (timeout > GetGameTimer() && priorPosition.DistanceToSquared(checkPosition = targetPed.Position) < newPosition.DistanceToSquared(checkPosition))
951948
{
952949
await Delay(100);
@@ -1163,9 +1160,11 @@ internal void OnPlayerJoining([FromSource] Player sourcePlayer)
11631160

11641161
PermissionsManager.SetPermissionsForPlayer(sourcePlayer);
11651162

1163+
string sourcePlayerName = sourcePlayer.Name;
1164+
11661165
foreach (Player notifPlayer in GetJoinQuitNotifPlayers())
11671166
{
1168-
notifPlayer.TriggerEvent("vMenu:PlayerJoinQuit", sourcePlayer.Name, null);
1167+
notifPlayer.TriggerEvent("vMenu:PlayerJoinQuit", sourcePlayerName, null);
11691168
}
11701169
}
11711170

@@ -1179,9 +1178,11 @@ internal void OnPlayerDropped([FromSource] Player sourcePlayer, string reason)
11791178

11801179
joinedPlayers.Remove(sourcePlayer.Handle);
11811180

1181+
string sourcePlayerName = sourcePlayer.Name;
1182+
11821183
foreach (Player notifPlayer in GetJoinQuitNotifPlayers())
11831184
{
1184-
notifPlayer.TriggerEvent("vMenu:PlayerJoinQuit", sourcePlayer.Name, reason);
1185+
notifPlayer.TriggerEvent("vMenu:PlayerJoinQuit", sourcePlayerName, reason);
11851186
}
11861187
}
11871188
#endregion

0 commit comments

Comments
 (0)