Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock AutoOcupado(vid)
- {
- for(new i, j = GetPlayerPoolSize(); i <= j; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(GetPlayerVehicleID(i) == vid && GetPlayerVehicleSeat(i) == 0) return 1;
- }
- return 0;
- }
- public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
- {
- if(AutoOcupado(vehicleid) == 1) return 1;
- new Float:vehx, Float:vehy, Float:vehz;
- GetVehiclePos(vehicleid, vehx, vehy, vehz);
- if(GetVehicleDistanceFromPoint(vehicleid, new_x, new_y, new_z) > 10)
- {
- SetVehiclePos(vehicleid, vehx, vehy, vehz);
- SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
- return 0;
- }
- new Float:PlayerSpeedDistance;
- PlayerSpeedDistance = floatmul(floatsqroot(floatadd(floatadd(floatpower(vel_x, 2), floatpower(vel_y, 2)), floatpower(vel_z, 2))), 170.0);
- new spe = floatround(PlayerSpeedDistance * 1);
- if(spe > 5 && passenger_seat > 0)
- {
- SetVehiclePos(vehicleid, vehx, vehy, vehz);
- SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
- return 0;
- }
- if(passenger_seat == 0)
- {
- if(spe > 25)
- {
- SetVehiclePos(vehicleid, vehx, vehy, vehz);
- SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
- return 0;
- }
- new Float: fDistance = GetPlayerDistanceFromPoint(playerid, vehx, vehy, vehz);
- if(fDistance > 7 && spe > 5)
- {
- SetVehiclePos(vehicleid, vehx, vehy, vehz);
- SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
- return 0;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment