GamerDeMTA Posted July 14, 2013 Share Posted July 14, 2013 Hi, I need help. I want to use bindKey of the "fire" bind, getting client's bind. I think I can use the function: getBoundKeys But then, how to bind it to bindKey, ? This code would be right? local = getBoundKeys("fire") bindKey("xd", "down", myFunction) Link to comment
iMr.3a[Z]eF Posted July 14, 2013 Share Posted July 14, 2013 do you want to shot a Weapon by bindKey? Link to comment
GamerDeMTA Posted July 14, 2013 Author Share Posted July 14, 2013 No, it's for my shooter map. I want to bind the key for shoot, to the "fire" bind of the player, Link to comment
lolcatsareawesome Posted July 14, 2013 Share Posted July 14, 2013 No, it's for my shooter map. I want to bind the key for shoot, to the "fire" bind of the player, bindKey("fire", "down", myFunction) ? Link to comment
GamerDeMTA Posted July 14, 2013 Author Share Posted July 14, 2013 It doesn't work and /debugscript 3 doesn't say nothing.. cLP = getLocalPlayer() function cdoshoot() if bindTrigger == 1 then if not isPlayerDead(cLP) then bindTrigger = 0 local x,y,z = getElementPosition(theVehicle) local rX,rY,rZ = getElementRotation(theVehicle) local x = x+4*math.cos(math.rad(rZ+90)) local y = y+4*math.sin(math.rad(rZ+90)) createProjectile(theVehicle, 19, x, y, z, 1.0, nil) setTimer(allowShoots, 4000, 1) local theVehicle = getPedOccupiedVehicle(cLP) allowShoots() bindKey("fire", "down", cdoshoot) end end end function allowShoots() bindTrigger = 1 end PS: Is my script wrong? if it's can u say me what is wrong or gimme a shoot script Link to comment
iMr.3a[Z]eF Posted July 14, 2013 Share Posted July 14, 2013 and what is theVehicle? theVehicle & cLP Aren't defined Link to comment
GamerDeMTA Posted July 14, 2013 Author Share Posted July 14, 2013 A vehicle . I used it "theVehicle" in line 7 and 8 and 11 But is the shooter script wrong? Link to comment
iMr.3a[Z]eF Posted July 14, 2013 Share Posted July 14, 2013 theVehicle & cLP Aren't defined Link to comment
GamerDeMTA Posted July 14, 2013 Author Share Posted July 14, 2013 CLP is defined in line 1 and theVehicle in 13 no? Link to comment
iMr.3a[Z]eF Posted July 14, 2013 Share Posted July 14, 2013 it's not defined in the function cdoshoot Link to comment
GamerDeMTA Posted July 14, 2013 Author Share Posted July 14, 2013 function cdoshoot() local cLP = getLocalPlayer() local theVehicle = getPedOccupiedVehicle(cLP) if bindTrigger == 1 then if not isPlayerDead(cLP) then bindTrigger = 0 local x,y,z = getElementPosition(theVehicle) local rX,rY,rZ = getElementRotation(theVehicle) local x = x+4*math.cos(math.rad(rZ+90)) local y = y+4*math.sin(math.rad(rZ+90)) createProjectile(theVehicle, 19, x, y, z, 1.0, nil) setTimer(allowShoots, 4000, 1) allowShoots() bindKey("fire", "down", cdoshoot) end end end function allowShoots() bindTrigger = 1 end Doesnt work, no debugscript 3. Link to comment
iMr.3a[Z]eF Posted July 14, 2013 Share Posted July 14, 2013 function cdoshoot(theVehicle) local theVehicle = getPedOccupiedVehicle(localPlayer) if bindTrigger == 1 then if not isPlayerDead(localPlayer) then bindTrigger = 0 local x,y,z = getElementPosition(theVehicle) local rX,rY,rZ = getElementRotation(theVehicle) local x = x+4*math.cos(math.rad(rZ+90)) local y = y+4*math.sin(math.rad(rZ+90)) createProjectile(theVehicle, 19, x, y, z, 1.0, nil) setTimer(allowShoots, 4000, 1) allowShoots() bindKey("fire", "down", cdoshoot) end end end function allowShoots() bindTrigger = 1 end Link to comment
GamerDeMTA Posted July 14, 2013 Author Share Posted July 14, 2013 it doesnt work i think it's teh shooter script is it wrong? Link to comment
iMr.3a[Z]eF Posted July 14, 2013 Share Posted July 14, 2013 is there any errors at debugscript 3? Link to comment
GamerDeMTA Posted July 14, 2013 Author Share Posted July 14, 2013 and it is added as client-side to meta Link to comment
itoko Posted July 15, 2013 Share Posted July 15, 2013 function cbinds() bindKey("vehicle_fire", "down", cdoshoot) bindKey("vehicle_secondary_fire", "down", cdoshoot) bindKey("lctrl", "down", cdoshoot) bindKey("rctrl", "down", cdoshoot) allowShoots() end addEventHandler("onClientResourceStart", getRootElement(), cbinds) function cdoshoot(theVehicle) local theVehicle = getPedOccupiedVehicle(localPlayer) if bindTrigger == 1 then if not isPlayerDead(localPlayer) then bindTrigger = 0 local x,y,z = getElementPosition(theVehicle) local rX,rY,rZ = getElementRotation(theVehicle) local x = x+4*math.cos(math.rad(rZ+90)) local y = y+4*math.sin(math.rad(rZ+90)) createProjectile(theVehicle, 19, x, y, z, 1.0, nil) setTimer(allowShoots, 4000, 1) end end end function allowShoots() bindTrigger = 1 end 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