Jockie Posted March 7, 2010 Share Posted March 7, 2010 (edited) I'm creating a burnout script, but it seem it isn't working. 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 March 7, 2010 by Guest Link to comment
Gamesnert Posted March 7, 2010 Share Posted March 7, 2010 I'm creating a burnout script, but it isn't working. 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
Jockie Posted March 7, 2010 Author Share Posted March 7, 2010 When I press W and S, W and Down, Up and S or Up and Down, the script is doing nothing. Instead of creating a timer to pop the tires... That's what I mean with it isn't working. Link to comment
MCvarial Posted March 7, 2010 Share Posted March 7, 2010 https://wiki.multitheftauto.com/wiki/SetVehicleWheelStates the functions is called setVehicleWheelStates, not WheelState and rearleft should be a int. Link to comment
Jockie Posted March 7, 2010 Author Share Posted March 7, 2010 Damnit... Damnit... OMG. Stupid S... I'll try it again. 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
Dark Dragon Posted March 7, 2010 Share Posted March 7, 2010 [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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now