Jump to content

Burnout script..


Jockie

Recommended Posts

I'm creating a burnout script, but it seem it isn't working. :roll:

function popTheTires(vehicle)
   setVehicleWheelState(getPedOccupiedVehicle(source), rearLeft, 1)
   setVehicleWheelState(getPedOccupiedVehicle(source), rearRight, 1)
end
 
function burnoutTheTires(vehicles)
if (burnoutTimer == nil) then
	bournoutTimer = {}
end
if getKeyState ("s") == true or getKeyState("arrow_d") == true then
   burnoutTimer[player] = setTimer(popTheTires,5000,1)
else
outputChatBox(source, "*Why do you want to create a burnout while walking?...")
end
end
bindKey("arrow_u",getRootElement(),burnoutTheTires)
bindKey("w",getRootElement(),burnoutTheTires)
 
function unpressedTheKeys(vehicles)
if getKeyState ("s") == false or getKeyState("arrow_d") == false then
if (isTimer(burnoutTimer[player])) then
killTimer(burnoutTimer[player])
end
else
return
end
end
bindKey("arrow_u",getRootElement(),unpressedTheKeys)
bindKey("w",getRootElement(),unpressedTheKeys)
 
function isTimer(timer)
local timers = getTimers()
for k,v in ipairs(timers) do
if (v == timer) then
return true
end
end
return false
end

Edited by Guest
Link to comment
I'm creating a burnout script, but it isn't working. :roll:

We could of course spend our whole afternoon trying to figure out what you mean by "it isn't working", but saying what's wrong by yourself is so much faster.

So, what's wrong with the script?

P.S. isTimer is a MTA function now, you can delete line 31 up to and including 39.

Link to comment

Damnit... Damnit... OMG.

Stupid S...

I'll try it again. xD

EDIT: Nope, nothing. :?

I'm now with this.

function popTheTires(vehicle)
setVehicleWheelStates(getPedOccupiedVehicle(source), 1, 1)
end
 
function burnoutTheTires(vehicles)
if (burnoutTimer == nil) then
	bournoutTimer = {}
end
if getKeyState ("s") == true or getKeyState("arrow_d") == true then
   burnoutTimer[player] = setTimer(popTheTires,5000,1)
else
outputChatBox(source, "*You want to do a burnout while walking?")
end
end
bindKey(source,"arrow_u","down",burnoutTheTires)
bindKey(source,"w","down",burnoutTheTires)
 
function unpressedTheKeys(vehicles)
if getKeyState ("s") == false or getKeyState("arrow_d") == false then
if (isTimer(burnoutTimer[player])) then
killTimer(burnoutTimer[player])
end
else
return
end
end

It says the whole time:

[14:34:40] WARNING: burnout.lua: Bad argument @ 'bindKey' - Line: 15
[14:34:40] WARNING: burnout.lua: Bad argument @ 'bindKey' - Line: 16

Link to comment
[14:34:40] WARNING: burnout.lua: Bad argument @ 'bindKey' - Line: 15
[14:34:40] WARNING: burnout.lua: Bad argument @ 'bindKey' - Line: 16

now this is something you can actually work with.

unfortunately there is quite a few problems in your script, actually too many to list them here, i fixed it for you, i hope you can learn from it anyways

local burnoutTimer = {}
 
function popTheTires(player)
setVehicleWheelStates(getPedOccupiedVehicle(player),-1, 1,-1, 1)
end
 
function burnoutTheTires(player,key)
if (key == "accelerate" and getControlState (player,"brake_reverse") == true) or (key == "brake_reverse" and getControlState (player,"accelerate") == true) then
     burnoutTimer[player] = setTimer(popTheTires,5000,1,player)
else
outputChatBox("*You want to do a burnout while walking?",player) -- ?
end
end
 
function unpressedTheKeys(player)
if (isTimer(burnoutTimer[player])) then
killTimer(burnoutTimer[player])
end
end
 
for i,v in ipairs(getElementsByType("player")) do
bindKey(v,"accelerate","down",burnoutTheTires)
bindKey(v,"brake_reverse","down",burnoutTheTires)
 
bindKey(v,"accelerate","up",unpressedTheKeys)
bindKey(v,"brake_reverse","up",unpressedTheKeys)
end
 
function joinBinds()
bindKey(source,"accelerate","down",burnoutTheTires)
bindKey(v,"brake_reverse","down",burnoutTheTires)
 
bindKey(source,"accelerate","up",unpressedTheKeys)
bindKey(source,"brake_reverse","up",unpressedTheKeys)
end
addEventHandler("onPlayerJoin",getRootElement(),joinBinds)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...