Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vehicle = getPedOccupiedVehicle ( getLocalPlayer() )
- centre = createObject ( 1097, 0, 0, 0 )
- setElementAlpha ( centre, 0 )
- point = createObject ( 1097, 0, 0, 0 )
- setElementAlpha ( point, 0 )
- speed = 0.8/15
- cx = 0 cy = -5 cz = 1 ox = 0 oy = 0 oz = 1
- isAKeyPressed = false
- isDKeyPressed = false
- areAllStock = true
- function getA()
- aTimer = setTimer ( function () isAKeyPressed = true isATimerRunning = false end, 150, 1 )
- isATimerRunning = true
- end
- function getD()
- dTimer = setTimer ( function () isDKeyPressed = true isDTimerRunning = false end, 150, 1 )
- isDTimerRunning = true
- end
- function getS()
- isSKeyPressed = true
- isSTimerRunning = true
- end
- function getAStock()
- if isATimerRunning == true then
- killTimer ( aTimer )
- isATimerRunning = false
- end
- isAKeyPressed = false
- end
- function getDStock()
- if isDTimerRunning == true then
- killTimer ( dTimer )
- isDTimerRunning = false
- end
- isDKeyPressed = false
- end
- function getSStock()
- isSKeyPressed = false
- end
- bindKey ( "a", "down", getA )
- bindKey ( "a", "up", getAStock )
- bindKey ( "d", "down", getD )
- bindKey ( "d", "up", getDStock )
- bindKey ( "s", "down", getS )
- bindKey ( "s", "up", getSStock )
- function moving()
- vehicle = getPedOccupiedVehicle ( getLocalPlayer() )
- if vehicle then
- attachElements ( centre, vehicle, ox, oy, oz )
- attachElements ( point, vehicle, cx, cy, cz )
- x, y, z = getElementPosition ( centre )
- px, py, pz = getElementPosition ( point )
- setCameraMatrix ( px, py, pz, x, y, z )
- if isDKeyPressed == true then
- if cx < 1.5 then
- cx = cx + speed
- elseif cx > 1.5 then
- cx = 1.5
- end
- elseif isAKeyPressed == true then
- if cx > -1.5 then
- cx = cx - speed
- elseif cx < -1.5 then
- cx = -1.5
- end
- elseif cx > 0.1 then
- cx = cx - speed
- elseif cx < -0.1 then
- cx = cx + speed
- end
- if isDKeyPressed == true then
- if ox < 1 then
- ox = ox + speed
- elseif cx > 1 then
- ox = 1
- end
- elseif isAKeyPressed == true then
- if ox > -1 then
- ox = ox - speed
- elseif ox < -1 then
- ox = -1
- end
- elseif ox > 0.1 then
- ox = ox - speed
- elseif ox < -0.1 then
- ox = ox + speed
- end
- if isSKeyPressed == true then
- if oz > -1 then
- oz = oz - speed*2
- end
- elseif oz < 1 then
- oz = oz + speed*2
- end
- end
- end
- addEventHandler ( "onClientPreRender", root, moving )
Add Comment
Please, Sign In to add comment