@@ -40,16 +40,14 @@ public EventManager()
4040 EventHandlers . Add ( "vMenu:SetAddons" , new Action ( SetConfigOptions ) ) ; // DEPRECATED: Backwards-compatible event handler; use 'vMenu:SetConfigOptions' instead
4141 EventHandlers . Add ( "vMenu:SetConfigOptions" , new Action ( SetConfigOptions ) ) ;
4242 EventHandlers . Add ( "vMenu:SetPermissions" , new Action < string > ( MainMenu . SetPermissions ) ) ;
43- EventHandlers . Add ( "vMenu:GoToPlayer" , new Action < string > ( SummonPlayer ) ) ;
4443 EventHandlers . Add ( "vMenu:KillMe" , new Action < string > ( KillMe ) ) ;
4544 EventHandlers . Add ( "vMenu:Notify" , new Action < string > ( NotifyPlayer ) ) ;
4645 EventHandlers . Add ( "vMenu:SetClouds" , new Action < float , string > ( SetClouds ) ) ;
4746 EventHandlers . Add ( "vMenu:GoodBye" , new Action ( GoodBye ) ) ;
4847 EventHandlers . Add ( "vMenu:SetBanList" , new Action < string > ( UpdateBanList ) ) ;
49- EventHandlers . Add ( "vMenu:ClearArea" , new Action < float , float , float > ( ClearAreaNearPos ) ) ;
48+ EventHandlers . Add ( "vMenu:ClearArea" , new Action < Vector3 > ( ClearAreaNearPos ) ) ;
5049 EventHandlers . Add ( "vMenu:updatePedDecors" , new Action ( UpdatePedDecors ) ) ;
5150 EventHandlers . Add ( "playerSpawned" , new Action ( SetAppearanceOnFirstSpawn ) ) ;
52- EventHandlers . Add ( "vMenu:GetOutOfCar" , new Action < int , int > ( GetOutOfCar ) ) ;
5351 EventHandlers . Add ( "vMenu:PrivateMessage" , new Action < string , string > ( PrivateMessage ) ) ;
5452 EventHandlers . Add ( "vMenu:UpdateTeleportLocations" , new Action < string > ( UpdateTeleportLocations ) ) ;
5553
@@ -353,92 +351,14 @@ private void KillMe(string sourceName)
353351 SetEntityHealth ( Game . PlayerPed . Handle , 0 ) ;
354352 }
355353
356- /// <summary>
357- /// Teleport to the specified player.
358- /// </summary>
359- /// <param name="targetPlayer"></param>
360- private async void SummonPlayer ( string targetPlayer )
361- {
362- // ensure the player list is requested in case of Infinity
363- MainMenu . PlayersList . RequestPlayerList ( ) ;
364- await MainMenu . PlayersList . WaitRequested ( ) ;
365-
366- var player = MainMenu . PlayersList . FirstOrDefault ( a => a . ServerId == int . Parse ( targetPlayer ) ) ;
367-
368- if ( player != null )
369- {
370- _ = TeleportToPlayer ( player ) ;
371- }
372- }
373-
374354 /// <summary>
375355 /// Clear the area around the provided x, y, z coordinates. Clears everything like (destroyed) objects, peds, (ai) vehicles, etc.
376356 /// Also restores broken streetlights, etc.
377357 /// </summary>
378358 /// <param name="x"></param>
379359 /// <param name="y"></param>
380360 /// <param name="z"></param>
381- private void ClearAreaNearPos ( float x , float y , float z )
382- {
383- ClearAreaOfEverything ( x , y , z , 100f , false , false , false , false ) ;
384- }
385-
386- /// <summary>
387- /// Kicks the current player from the specified vehicle if they're inside and don't own the vehicle themselves.
388- /// </summary>
389- /// <param name="vehNetId"></param>
390- /// <param name="vehicleOwnedBy"></param>
391- private async void GetOutOfCar ( int vehNetId , int vehicleOwnedBy )
392- {
393- if ( NetworkDoesNetworkIdExist ( vehNetId ) )
394- {
395- var veh = NetToVeh ( vehNetId ) ;
396- if ( DoesEntityExist ( veh ) )
397- {
398- var vehicle = new Vehicle ( veh ) ;
399-
400- if ( vehicle == null || ! vehicle . Exists ( ) )
401- {
402- return ;
403- }
404-
405- if ( Game . PlayerPed . IsInVehicle ( vehicle ) && vehicleOwnedBy != Game . Player . ServerId )
406- {
407- if ( ! vehicle . IsStopped )
408- {
409- Notify . Alert ( "The owner of this vehicle is reclaiming their personal vehicle. You will be kicked from this vehicle in about 10 seconds. Stop the vehicle now to avoid taking damage." , false , true ) ;
410- }
411-
412- // Wait for the vehicle to come to a stop, or 10 seconds, whichever is faster.
413- var timer = GetGameTimer ( ) ;
414- while ( vehicle != null && vehicle . Exists ( ) && ! vehicle . IsStopped )
415- {
416- await Delay ( 0 ) ;
417- if ( GetGameTimer ( ) - timer > ( 10 * 1000 ) ) // 10 second timeout
418- {
419- break ;
420- }
421- }
422-
423- // just to make sure they're actually still inside the vehicle and the vehicle still exists.
424- if ( vehicle != null && vehicle . Exists ( ) && Game . PlayerPed . IsInVehicle ( vehicle ) )
425- {
426- // Make the ped jump out because the car isn't stopped yet.
427- if ( ! vehicle . IsStopped )
428- {
429- Notify . Info ( "You were warned, now you'll have to suffer the consequences!" ) ;
430- TaskLeaveVehicle ( Game . PlayerPed . Handle , vehicle . Handle , 4160 ) ;
431- }
432- // Make the ped exit gently.
433- else
434- {
435- TaskLeaveVehicle ( Game . PlayerPed . Handle , vehicle . Handle , 0 ) ;
436- }
437- }
438- }
439- }
440- }
441- }
361+ private void ClearAreaNearPos ( Vector3 position ) => ClearAreaOfEverything ( position . X , position . Y , position . Z , 100f , false , false , false , false ) ;
442362
443363 /// <summary>
444364 /// Updates ped decorators for the clothing animation when players have joined.
0 commit comments