Set ped task animation

Hi all,

I’m trying to set the animation on a ped, however i cant get this to work.
Can someone help me out with the animation task below ?

thanks in advance.

bartender =  CreatePed(5, 0x780c01bd, 128.900, -1283.21, 29.273, 123.98, true, true)
    SetPedCombatAttributes(bartender, 46, true)
    SetPedFleeAttributes(bartender, 0, 0)
    SetPedRelationshipGroupHash(bartender, GetHashKey("CIVFEMALE"))
    while (not HasAnimDictLoaded("random@arrests")) do
    TaskPlayAnim(bartender,"random@arrests","idle_2_hands_up",1.0,-2.0, 500, 0, 1, true, false, true)