Jump to content

Help please


Dorega

Recommended Posts

  • Moderators

Well I am very interesting in weapon syncs so, yes I did try.

I tried the easy way, the way without all those special lines for locating the sniper.

--client 
addEventHandler ( "onClientRender", root,  
function () 
    if  getControlState ("aim_weapon" )  then 
        if getPedWeapon (getLocalPlayer ())== 34 then 
            setControlState ( "zoom_out", true )--zoom_in.... -_-" 
            setControlState ( "aim_weapon", true)    
        end 
    end 
end) 

but it worked out very strang, I am not sure if the same happens to you.

First I added zoom_in, but some how this script zoomed out... so I used zoom_out instead...

and this ..... script started to zoom in for me. wtf!

------------------

but a harder way:

  
--server 
setWeaponProperty(34,"pro","flags",0x000008) 
  

  
--client 
addEventHandler ( "onClientRender", root,  
function () 
    local player = getLocalPlayer () 
    if getPedWeapon (player)== 34  then 
        if getControlState ("aim_weapon" ) then 
            local xs, ys, zs = getPedWeaponMuzzlePosition ( player ) 
            local xe, ye, ze = getPedTargetEnd(player) 
            --getPedRotation(player) 
            setCameraMatrix ( xs, ys, zs, xe, ye, ze) 
            setControlState ( "aim_weapon", true)    
            dxDrawLine3D ( xs, ys, zs,  xe, ye, ze, tocolor(255,0,0,255), 1, false, 1 ) 
        elseif getCameraTarget (player)~= player then 
            setCameraTarget ( player ) 
        end 
    end 
end) 

-------------

  
--server 
setWeaponProperty(34,"pro","flags",0x000008) 
  

  
--client 
   addEventHandler ( "onClientRender", root, 
    function () 
        local player = getLocalPlayer () 
        if getPedWeapon (player)== 34  then 
            if getControlState ("aim_weapon" ) then 
                --if getControlState ("fire" ) then 
                    local xs, ys, zs = getPedWeaponMuzzlePosition ( player ) 
                    local xe, ye, ze = getPedTargetEnd(player) 
                    --getPedRotation(player) 
                    --setCameraMatrix ( xs, ys, zs, xe, ye, ze) 
                   -- setControlState ( "aim_weapon", true)   
                    dxDrawLine3D ( xs, ys, zs,  xe, ye, ze, tocolor(255,0,0,255), 1, false, 1 ) 
              -- elseif getCameraTarget (player)~= player then 
                    --setCameraTarget ( player ) 
              -- end 
            local x, y, z, lx, ly, lz = getCameraMatrix() 
            if x and y and lx and ly then 
            local zc = findRotation(x,y,lx,ly) 
                setElementRotation(player,0,0,zc) 
            end 
           end 
        end 
    end) 
  
-- source wiki mta  >> 
function findRotation(x1,y1,x2,y2)  
  local t = -math.deg(math.atan2(x2-x1,y2-y1)) 
  if t < 0 then t = t + 360 end; 
  return t; 
end 
--<< 
  

It does not work even 40%, many bugs etc. -_-"

If you really wanna have this you have to ask your pcp mates, they seems to have good scripters.

You are from the bomb da base server right?

Link to comment

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...