Jump to content

help


WASSIm.

Recommended Posts

Posted

sanstitregqu.png

Client

addEventHandler("onClientVehicleEnter", root, 
    function(thePlayer, seat) 
        local theVehicle = source 
        if seat == 0 and thePlayer == localPlayer and  getElementModel(theVehicle) == 601 then 
         local x, y, z = getElementPosition ( theVehicle )  
         local rx, ry, rz = getElementRotation ( theVehicle )  
         minigunOne = createWeapon ( "minigun",  x,  y,  z ) 
         setElementAlpha ( minigunOne,0) 
         attachElements ( minigunOne, theVehicle, 0.15, 0, 1.3, 0, 0, 93 )       
                                         bindKey ( "mouse1", "down", enableFire )         
         bindKey ( "mouse1", "up", disableFire )     
        end 
    end 
) 
addEventHandler("onClientVehicleExit", root, 
    function(thePlayer, seat) 
        local theVehicle = source 
        if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 601 then 
        if minigunOne then 
        destroyElement (minigunOne) 
         unbindKey ( "mouse1", "down", enableFire )       
         unbindKey ( "mouse1", "up", disableFire ) 
        end 
    end 
    end 
) 
 function enableFire() 
 if isTimer(MGtimer) and minigunOne then 
  killTimer(MGtimer) 
   else 
                    MGtimer = setTimer(function() setWeaponState ( minigunOne, "firing" ) end, 50, 1) 
    MiniSound = playSound( "Pro_Minigun.wav", true)  
                        setSoundVolume(MiniSound, 0.4) 
                        setSoundSpeed ( MiniSound, 0.9 ) 
                            end 
                        end 
function disableFire() 
                     if isTimer(MGtimer) and minigunOne then 
                      killTimer(MGtimer) 
                       else 
                        MGtimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) 
                          stopSound ( MiniSound ) 
                            end 
                        end 
  
function mgRotate () 
    if minigunOne then 
         triggerServerEvent ("mgserver", source, mgserver) 
         setElementRotation(minigunOne,rotX,rotY,rotZ) 
         end 
    end 
addEventHandler ( "onClientRender", root, mgRotate ) 

Server

function mgserver () 
rotX,rotY,rotZ = getCameraMatrix (source) 
end 
addEvent("mgserver",true) 
addEventHandler("mgserver", root, mgserver) 

Omerta Roleplay

Posted

client:

addEventHandler("onClientVehicleEnter", root, 
    function(thePlayer, seat) 
        local theVehicle = source 
        if seat == 0 and thePlayer == localPlayer and  getElementModel(theVehicle) == 601 then 
         x, y, z = getElementPosition ( theVehicle ) 
         rx, ry, rz = getElementRotation ( theVehicle ) 
         minigunOne = createWeapon ( "minigun",  x,  y,  z ) 
         setElementAlpha ( minigunOne,0) 
         attachElements ( minigunOne, theVehicle, 0.15, 0, 1.3, 0, 0, 93 )      
                                         bindKey ( "mouse1", "down", enableFire )         
         bindKey ( "mouse1", "up", disableFire )    
        end 
    end 
) 
addEventHandler("onClientVehicleExit", root, 
    function(thePlayer, seat) 
        local theVehicle = source 
        if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 601 then 
        if minigunOne then 
        destroyElement (minigunOne) 
         unbindKey ( "mouse1", "down", enableFire )       
         unbindKey ( "mouse1", "up", disableFire ) 
        end 
    end 
    end 
) 
 function enableFire() 
 if isTimer(MGtimer) and minigunOne then 
  killTimer(MGtimer) 
   else 
                    MGtimer = setTimer(function() setWeaponState ( minigunOne, "firing" ) end, 50, 1) 
    MiniSound = playSound( "Pro_Minigun.wav", true) 
                        setSoundVolume(MiniSound, 0.4) 
                        setSoundSpeed ( MiniSound, 0.9 ) 
                            end 
                        end 
function disableFire() 
                     if isTimer(MGtimer) and minigunOne then 
                      killTimer(MGtimer) 
                       else 
                        MGtimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) 
                          stopSound ( MiniSound ) 
                            end 
                        end 
  
function mgRotate () 
    if minigunOne then 
         triggerServerEvent ("mgserver", source, mgserver) 
         setElementRotation(minigunOne,rotX,rotY,rotZ) 
         end 
    end 
addEventHandler ( "onClientRender", root, mgRotate ) 

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted
client:
addEventHandler("onClientVehicleEnter", root, 
    function(thePlayer, seat) 
        local theVehicle = source 
        if seat == 0 and thePlayer == localPlayer and  getElementModel(theVehicle) == 601 then 
         x, y, z = getElementPosition ( theVehicle ) 
         rx, ry, rz = getElementRotation ( theVehicle ) 
         minigunOne = createWeapon ( "minigun",  x,  y,  z ) 
         setElementAlpha ( minigunOne,0) 
         attachElements ( minigunOne, theVehicle, 0.15, 0, 1.3, 0, 0, 93 )      
                                         bindKey ( "mouse1", "down", enableFire )         
         bindKey ( "mouse1", "up", disableFire )    
        end 
    end 
) 
addEventHandler("onClientVehicleExit", root, 
    function(thePlayer, seat) 
        local theVehicle = source 
        if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 601 then 
        if minigunOne then 
        destroyElement (minigunOne) 
         unbindKey ( "mouse1", "down", enableFire )       
         unbindKey ( "mouse1", "up", disableFire ) 
        end 
    end 
    end 
) 
 function enableFire() 
 if isTimer(MGtimer) and minigunOne then 
  killTimer(MGtimer) 
   else 
                    MGtimer = setTimer(function() setWeaponState ( minigunOne, "firing" ) end, 50, 1) 
    MiniSound = playSound( "Pro_Minigun.wav", true) 
                        setSoundVolume(MiniSound, 0.4) 
                        setSoundSpeed ( MiniSound, 0.9 ) 
                            end 
                        end 
function disableFire() 
                     if isTimer(MGtimer) and minigunOne then 
                      killTimer(MGtimer) 
                       else 
                        MGtimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) 
                          stopSound ( MiniSound ) 
                            end 
                        end 
  
function mgRotate () 
    if minigunOne then 
         triggerServerEvent ("mgserver", source, mgserver) 
         setElementRotation(minigunOne,rotX,rotY,rotZ) 
         end 
    end 
addEventHandler ( "onClientRender", root, mgRotate ) 

i want rotation getCameraMatrix not rotation car

Omerta Roleplay

Posted

'rotX,rotY,rotZ' Are not defined.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Maybe you want to use "rx, ry, rz" instead? because that's what you defined:

rx, ry, rz = getElementRotation ( theVehicle ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...