Newbie Posted July 15, 2014 Share Posted July 15, 2014 (edited) Hello. I am trying to do anti forward script for infernus. If player goes forward in this case he press "W" car blows. function blowNoobs ( thePlayer ) id = getVehicleID ( theVehicle ) if id == 411 then blowVehicle ( source ) outputChatBox ( "You're noob..", getRootElement(), 255, 0, 0, true ) end end bindKey ( "W", blowNoobs ) bad argument bind key Edited July 15, 2014 by Guest Link to comment
Et-win Posted July 15, 2014 Share Posted July 15, 2014 bindKey ( "w", blowNoobs ) Also use: getPedOccupiedVehicle Link to comment
Newbie Posted July 15, 2014 Author Share Posted July 15, 2014 function blowNoobs ( thePlayer ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) id = getVehicleID ( theVehicle ) if id == 411 then blowVehicle ( source ) outputChatBox ( "You're noob..", getRootElement(), 255, 0, 0, true ) end end bindKey ( "W", blowNoobs ) Hmmm ? Link to comment
Newbie Posted July 15, 2014 Author Share Posted July 15, 2014 Made it! function blowNoobs ( thePlayer ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) id = getVehicleID ( theVehicle ) if id == 411 then blowVehicle ( theVehicle ) outputChatBox ( "You're noob..", getRootElement(), 255, 0, 0, true ) else outputChatBox ( "Test", getRootElement(), 255, 0, 0, true ) end end addCommandHandler ( "nx", blowNoobs ) But now i need to make it at a bind not as command, could any one help ? I got bad argument while testing with bind key Link to comment
Et-win Posted July 15, 2014 Share Posted July 15, 2014 Good. Also I advise you to use getElementModel instead of getVehicleID, because getVehicleID is an old function and will maybe not exist in future versions. (Atleast that is what they say at Wiki) EDIT: Search here for codes: https://wiki.multitheftauto.com/wiki/Main_Page (Left side: Server/Client functions/event) Use: bindKey But also note that players can change their driving key to another key. At this moment I don't know how to get this key. Link to comment
Et-win Posted July 15, 2014 Share Posted July 15, 2014 Use: bindKey("accelerate", function) (As far as I understand out of wiki this should work) Link to comment
Newbie Posted July 15, 2014 Author Share Posted July 15, 2014 Use: bindKey("accelerate", function) (As far as I understand out of wiki this should work) i got bad argument Link to comment
Newbie Posted July 15, 2014 Author Share Posted July 15, 2014 so nobody will help when i need so so.. to finish it ? Link to comment
GTX Posted July 15, 2014 Share Posted July 15, 2014 Take a look at wiki. -- From Wiki: function fanFunction() bindKey (source,"forwards","down", function(player,key,state) outputChatBox (getPlayerName (player) .. "#FFFF00 thinks Aintaro is cool.",getRootElement(),255,255,0,true) end ) end addEventHandler ("onPlayerLogin",getRootElement(),fanFunction) https://wiki.multitheftauto.com/wiki/BindKey Link to comment
ADCX Posted July 15, 2014 Share Posted July 15, 2014 function blowNoobs(thePlayer) local theVehicle = getPedOccupiedVehicle(thePlayer) if (theVehicle) then local id = getElementModel(theVehicle) if (id == 411) then blowVehicle(source) outputChatBox("You're noob..", getRootElement(),255,0,0,true) end end end function onPlayerJoin() bindKey(source,"W","down",blowNoobs) end addEventHandler("onPlayerJoin",getRootElement(),onPlayerJoin) But wouldn't it be better to just disable front movement when you enter the vehicle? With 'toggleControl'. 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