I can't quite get it to work though This script should create a ped in the Las Venturas Planning Department that sits in the chair at the front desk. When I run this code, the ped spawns and sits down, but then continuously rotates 180 degrees back and forth. A strange detail is that it only rotates when I move my mouse or press the keyboard, as long as i don't touch both mouse and keyboard, the ped performs its normal animation.
Sidenote:
In my code I'm using a timer, because it doesn't seem to work to set a ped's animation right after creating it. If there's a better way without timer, it would be great if anybody could tell me.
My server code:
townhallWorker = createPed ( 17, 359.72, 173.544, 1008.39, 270 )
setElementInterior(townhallWorker, 3)
setElementDimension (townhallWorker, 2)
setTimer (
function()
local useditemdummy = createObject(1714, 359.051, 173.585, 1007.38, 0, 0, 90.719604)
setElementInterior(useditemdummy, 3)
setElementDimension (useditemdummy, 2)
setElementData(townhallWorker, "itembeingused", useditemdummy, false)
attachElements(townhallWorker, useditemdummy, -0.5, 0, .3)
setElementRotation(townhallWorker, 0,0, 270)
setElementCollisionsEnabled(useditemdummy, false)
setElementAlpha(useditemdummy, 150)
setElementFrozen ( townhallWorker, true )
setPedAnimation(townhallWorker, "INT_OFFICE", "OFF_Sit_Idle_Loop", -1, false, false, false, true)
end
, 1000, 0 )
Any help would be greatly appreciated!