BenceDev Posted June 7, 2022 Share Posted June 7, 2022 (edited) Hi i want to shoot weapon in the vehicle, but if i bind it i got mouse1 Debugscript 3 says: WARNING: fs_raindSit\client.lua:17: Bad argument @ 'setWeaponState' [Expected weapon at argument 1, got string 'mouse1] WARNING: fs_raindSit\client.lua:23: Bad argument @ 'setWeaponState' [Expected weapon at argument 1, got string 'mouse1] Client Side: function createMinigunWeapon(myRaindanc) -- Create the weapon 1 meter above the player local pX, pY, pZ = getElementPosition(myRaindanc) local weapon = createWeapon("minigun", pX, pY, pZ) -- Give it some ammo and fire it setWeaponClipAmmo(weapon, 99999) setWeaponState(weapon, "ready") setWeaponProperty(weapon, "fire_rotation", 0, -30, 0) attachElements(weapon, myRaindanc, 0.9, 0.34, 0.2, 0, 30, 0 ) end addEvent("createMinigun", true) addEventHandler("createMinigun", resourceRoot, createMinigunWeapon) function onPilotFireOn(weapon) setWeaponState(weapon, "firing") end bindKey("mouse1", "down", onPilotFireOn) function onPilotFireOff(weapon) setWeaponState(weapon, "ready") end bindKey("mouse1", "up", onPilotFireOff) Edited June 7, 2022 by SphinxDev bad error argument Link to comment
TAPL Posted June 8, 2022 Share Posted June 8, 2022 I assume this code is for testing purpose as it's incomplete and if you wish to use it you should be aware that you will need to do server/client side triggers to sync the weapon creation and its state. function createMinigunWeapon(myRaindanc) -- Create the weapon 1 meter above the player local pX, pY, pZ = getElementPosition(myRaindanc) weapon = createWeapon("minigun", pX, pY, pZ) -- Give it some ammo and fire it setWeaponClipAmmo(weapon, 99999) setWeaponState(weapon, "ready") setWeaponProperty(weapon, "fire_rotation", 0, -30, 0) attachElements(weapon, myRaindanc, 0.9, 0.34, 0.2, 0, 30, 0 ) end addEvent("createMinigun", true) addEventHandler("createMinigun", resourceRoot, createMinigunWeapon) function onPilotFireOn() setWeaponState(weapon, "firing") end bindKey("mouse1", "down", onPilotFireOn) function onPilotFireOff() setWeaponState(weapon, "ready") end bindKey("mouse1", "up", onPilotFireOff) 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