Guest User

Untitled

a guest
May 5th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z) //linia asta
  2. {
  3.     new Float:TempFloatX, Float:TempFloatY, Float:TempFloatZ;
  4.     new ActTempState, ActTempCar;
  5.     if(vel_z >= 300.000000)
  6.     {
  7.         SetVehicleToRespawn(vehicleid);
  8.         GetVehiclePos(vehicleid, TempFloatX, TempFloatY, TempFloatZ);
  9.         for(new x; x < MAX_VEHICLES; x++)
  10.         {
  11.             if(!IsValidVehicle(x) || vehicleData[x][broadVehicleOwner] != INVALID_PLAYER_ID) continue;
  12.             if(GetVehicleDistanceFromPoint(vehicleid, TempFloatX, TempFloatY, TempFloatZ) <= 20) SetVehicleToRespawn(x);
  13.         }
  14.         for(new i, j = GetPlayerPoolSize(); i <= j; i++)
  15.         {
  16.             ActTempState = GetPlayerState(i);
  17.             ActTempCar = GetPlayerVehicleID(i);
  18.  
  19.             if(!IsPlayerConnected(i)) continue;
  20.             if(IsPlayerInRangeOfPoint(i, 4.0, new_x, new_y, new_z))
  21.             {
  22.                 if (i != playerid)
  23.                 {
  24.                     if(ActTempState != PLAYER_STATE_ONFOOT) GetVehiclePos(ActTempCar, TempFloatX, TempFloatY, TempFloatZ);
  25.                     SetPlayerHealthEx(playerid, 0.0);
  26.  
  27.                     if(ActTempState == PLAYER_STATE_ONFOOT && !playerData[i][playerCarsFix])
  28.                     {
  29.                         playerData[i][playerCarsFix] = true,
  30.                         TogglePlayerControllable(i, 0),
  31.                         SetTimerEx("ResetVariableValues", 2500, false, "ii", i, 7);
  32.                     }
  33.                     else if(ActTempState != PLAYER_STATE_ONFOOT && !playerData[i][playerCarsFix])
  34.                     {
  35.                         SetVehicleToRespawn(ActTempCar);
  36.  
  37.                         playerData[i][playerCarsFix] = true,
  38.                         TogglePlayerControllable(i, 0),
  39.                         SetTimerEx("ResetVariableValues", 2500, false, "ii", i, 7);
  40.                     }
  41.  
  42.                     DetectTrollCheat(playerid, vehicleid, i, RACT_KICKPLAYER_CAR);
  43.                     break;
  44.                 }
  45.             }
  46.         }
  47.     }
  48.     return 1;
  49. }
Add Comment
Please, Sign In to add comment