Xwad Posted March 18, 2015 Share Posted March 18, 2015 Hi. I made a script that attaches an m4 to the stuntplane and shoot with it like with the rustler. I started the rescource bu its not working. Client.lua function createM4Weapon() local vX, vY, vZ = getElementPosition(getPedOccupiedVehicle(localPlayer)) if getElementModel(source) == 513 then local weapon = createWeapon("m4", vx, vy, vz + 1) setWeaponClipAmmo(weapon, 99999) setWeaponState(weapon, "ready") addEventHandler("onClientKey", root, function(button,state) if button == "lctrl" and state == true then fireWeapon(m4) end end) end end addEventHandler( "onVehicleEnter", createM4Weapon) Link to comment
Ryancit2 Posted March 18, 2015 Share Posted March 18, 2015 Try changing fireWeapon(m4) from Line#11 to fireWeapon(weapon). If that doesnt works, change 'local weapon = ...' from Line#5 to 'weapon = ...' and remove 'local' to make it global and use-able by other events directly. Link to comment
xeon17 Posted March 18, 2015 Share Posted March 18, 2015 You are using a server side event together with client side functions , use onClientVehicleEnter instead of onVehicleEnter. Link to comment
Xwad Posted March 18, 2015 Author Share Posted March 18, 2015 ohh sure thanks:) Its working now:D Link to comment
xeon17 Posted March 18, 2015 Share Posted March 18, 2015 ohh sure thanks:) Its working now:D No problem 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