Jump to content

Player look


Recommended Posts

Posted

Hey, I don't really know anything about LUA, and I have a question.

Would it be possible to script something that your look is like in an ego-shooter ?

And if it is, would it be possible to script sometthing that you can still see your arms and weapons then ?

Would be nice if someone answers ;P

Posted

If you are talking about first person look, then I have to say that is possible. This function is in GTA-MP Zombie Infestation server, you just need to write /fp and test it. I think it was done by setting player's camera position, but I dunno indeed. :?

Posted
If you are talking about first person look, then I have to say that is possible. This function is in GTA-MP Zombie Infestation server, you just need to write /fp and test it. I think it was done by setting player's camera position, but I dunno indeed. :?

I don't know if thats what i mean, cause i can't play on this server....somehow after downloading i'm not able to spawn.

Posted

Here's a very basic script to show the idea of how things can be done. However you can't aim with your weapon when camera is not following the player in it's "typical" way. You can make a separate client-side script file out of it.

local x, y, z, x1, y1, z1
local fpcam = false
local PLAYER = getLocalPlayer()
 
bindKey( "F1", "down",
function()
if fpcam then
setCameraTarget( PLAYER, PLAYER )
end
	fpcam = not fpcam
end
)
 
addEventHandler( "onClientPreRender", root,
function()
if fpcam then
		x, y, z = getPedBonePosition( PLAYER, 6 )
setCameraMatrix( x, y, z, x + x1, y + y1, z + z1 )
end
end
)
 
addEventHandler( "onClientCursorMove", root,
function( _, _, _, _, wx, wy, wz )
local cx, cy, cz = getCameraMatrix()
	x1 = ( wx - cx ) / 300
	y1 = ( wy - cy ) / 300
	z1 = ( wz - cz ) / 300
end
)

Posted
Here's a very basic script to show the idea of how things can be done. However you can't aim with your weapon when camera is not following the player in it's "typical" way. You can make a separate client-side script file out of it.
local x, y, z, x1, y1, z1
local fpcam = false
local PLAYER = getLocalPlayer()
 
bindKey( "F1", "down",
function()
if fpcam then
setCameraTarget( PLAYER, PLAYER )
end
	fpcam = not fpcam
end
)
 
addEventHandler( "onClientPreRender", root,
function()
if fpcam then
		x, y, z = getPedBonePosition( PLAYER, 6 )
setCameraMatrix( x, y, z, x + x1, y + y1, z + z1 )
end
end
)
 
addEventHandler( "onClientCursorMove", root,
function( _, _, _, _, wx, wy, wz )
local cx, cy, cz = getCameraMatrix()
	x1 = ( wx - cx ) / 300
	y1 = ( wy - cy ) / 300
	z1 = ( wz - cz ) / 300
end
)

What do you mean with "when camera is not following the player in it's "typical" way" :?:

Posted

It's like in single player. An ordinary default camera "attached" to the Cj and following him wherever he moves. setCameraMatrix() makes your camera loose it's target ( your player ), in this case you can't aim with weapon like usually. setCameraTarget() return aiming ability and bounds the camera back to player, into it's "typical", unmodified state.

Posted
It's like in single player. An ordinary default camera "attached" to the Cj and following him wherever he moves. setCameraMatrix() makes your camera loose it's target ( your player ), in this case you can't aim with weapon like usually. setCameraTarget() return aiming ability and bounds the camera back to player, into it's "typical", unmodified state.

and there are no other possibilities like having a crosshair in the middle and moving your camera with this?

Posted
and there are no other possibilities like having a crosshair in the middle and moving your camera with this?

There are. It's a matter of scripting only. The first thing comes on my mind is to switch camera back to "normal" view on player press aim button and when he releases - set it to first person again.

Posted

evil geniz achieved this by attaching an object to the player so the camera gets moved very close to the head of cj, then simply set the ped alpha to 0. haven't seen it done better than that yet. at least for combat this works quite well.

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