SetPedCameraRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 23: Line 23:
addEventHandler ( 'onClientResourceStart', resourceRoot, function ()
addEventHandler ( 'onClientResourceStart', resourceRoot, function ()
ped = createPed ( 0, 0,0,3) -- create the ped at the coordinate ( x = 0, y = 0, z = 3 )
ped = createPed ( 0, 0,0,3) -- create the ped at the coordinate ( x = 0, y = 0, z = 3 )
setPedControlState ( ped, "forwards", true )
addEventHandler ('onClientPedDamage', ped, function () -- add Event when the ped got damaged
addEventHandler ('onClientPedDamage', ped, function () -- add Event when the ped got damaged

Revision as of 10:05, 20 October 2013

This function sets the camera rotation of a ped.

Syntax

bool setPedCameraRotation ( ped thePed, float cameraRotation )

Required Arguments

  • thePed: The ped whose camera rotation is to be changed
  • cameraRotation: The new direction that the ped will walk if you set their forwards control state

Returns

Returns true if the camera rotation was changed, false otherwise.

Example

--TODO

See Also

Shared



addEventHandler ( 'onClientResourceStart', resourceRoot, function () ped = createPed ( 0, 0,0,3) -- create the ped at the coordinate ( x = 0, y = 0, z = 3 )

addEventHandler ('onClientPedDamage', ped, function () -- add Event when the ped got damaged local rot = getPedCameraRotation ( ped ) -- get the current camera rotation setPedCameraRotation ( ped, rot + 90 ) -- add to the current camerarotation 90 deg. end)

end)