Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function toggleFreezeStatus(thePlayer)
- -- if he is in a vehicle,
- if getPedOccupiedVehicle(thePlayer) then
- -- get the vehicle element
- local playerVehicle = getPlayerOccupiedVehicle(thePlayer)
- -- get the current freeze status
- local currentFreezeStatus = isElementFrozen(playerVehicle)
- -- get the new freeze status (the opposite of the previous state)
- local newFreezeStatus = not currentFreezeStatus
- -- set the new freeze status
- setElementFrozen(playerVehicle, newFreezeStatus)
- -- now bind a key to this function for all players.
- -- first get a list of all players
- local connectedPlayers = getElementsByType("player")
- -- then, for each player,
- for i, aPlayer in ipairs(connectedPlayers) do
- -- bind the player's "p" key to the toggleFreezeStatus function
- bindKey (aPlayer, "p", "down", "Toggle freeze status",toggleFreezeStatus)
- addEventHandler("onMarkerHit", Blitz, Blitz_func,toggleFreezeStatus)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement