SweetyWolf Posted June 16, 2015 Share Posted June 16, 2015 I'm trying to make custom player's weapon. But I've got a problem. 1. Player equipped normal AK-47 2. I'm creating custom weapon with createWeapon ( "ak-47" 3. I'm attaching this custom weapon via crystalmv bone_attach to player (bone 12) 4. Both AK-47s are in the same position (visually) 5. When custom weapon firing, it's hit position is slightly to the left-bottom than crosshair I tried to change custom weapon's fire_rotation. So it worked fine on middle-distance firing, but when I moved camera to the bottom, hit position moved to the left from the crosshair, and when I moved camera to the top, hit position moved to the right from the crosshair. Also I tried to use setWeaponTarhet in onClientRender: function fireWeapOnClientRender() for i, v in ipairs ( getElementsByType ("weapon", true) ) do if getElementData ( v, "cweap" ) then local owner = getElementData ( v, "cweap.owner" ) local sx, sy, sz = getPedTargetEnd(owner) setWeaponTarget (v,sx, sy, sz) end end end addEventHandler('onClientRender', root, fireWeapOnClientRender ) But in this case custom weapon just don't fire. Maybe someone knows how fix this problem? 5. When custom weapon firing, it's hit position is slightly to the left-bottom than crosshair Link to comment
Moderators IIYAMA Posted June 16, 2015 Moderators Share Posted June 16, 2015 1) Get the extend line function from the stealth resource. (used for the laser) 2) Extend the line from getPedTargetStart t/m getPedTargetEnd t/m as far as possible. and you got your target. Link to comment
SweetyWolf Posted June 17, 2015 Author Share Posted June 17, 2015 1) Get the extend line function from the stealth resource. (used for the laser)2) Extend the line from getPedTargetStart t/m getPedTargetEnd t/m as far as possible. and you got your target. Thanks, but my problem was that weapon didn't shoot if I'm was using setWeponTarget. Setting these two flags fixed the problem: setWeaponFlags (weapon, "shoot_if_out_of_range", true) setWeaponFlags (weapon, "shoot_if_blocked", true) Link to comment
Einheit-101 Posted June 19, 2015 Share Posted June 19, 2015 Are Custom weapons even synced nowadays? I wanted to make some scripts with custom weapons but i heard that they are still WIP, not finished and buggy/not synced/ have whatever problems. Link to comment
Moderators IIYAMA Posted June 20, 2015 Moderators Share Posted June 20, 2015 They are not by default, it is something you have to make. When the custom weapons got released, I created my own script for it. You should do it too if you want it that badly. Link to comment
Einheit-101 Posted June 21, 2015 Share Posted June 21, 2015 It's not really important for me at the moment, I have to do other stuff first. I plan some things like MG Nests and coaxial rhino machine guns. 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