Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. function toggleFreezeStatus(thePlayer)
  2. -- if he is in a vehicle,
  3. if getPedOccupiedVehicle(thePlayer) then
  4. -- get the vehicle element
  5. local playerVehicle = getPlayerOccupiedVehicle(thePlayer)
  6. -- get the current freeze status
  7. local currentFreezeStatus = isElementFrozen(playerVehicle)
  8. -- get the new freeze status (the opposite of the previous state)
  9. local newFreezeStatus = not currentFreezeStatus
  10. -- set the new freeze status
  11. setElementFrozen(playerVehicle, newFreezeStatus)
  12. -- now bind a key to this function for all players.
  13. -- first get a list of all players
  14. local connectedPlayers = getElementsByType("player")
  15. -- then, for each player,
  16. for i, aPlayer in ipairs(connectedPlayers) do
  17. -- bind the player's "p" key to the toggleFreezeStatus function
  18. bindKey (aPlayer, "p", "down", "Toggle freeze status",toggleFreezeStatus)
  19. addEventHandler("onMarkerHit", Blitz, Blitz_func,toggleFreezeStatus)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement