Dice Rolling Script

Hey Everyone, I am making a dice rolling script for RTRP and I have everything working EXCEPT for the animation that the command triggers… I was thinking the Jerk Off or wank animation (its as close as I can get) Was wondering if someone could help me out:

I have the script working with Animations that start with WORLD_HUMAN and PROP_HUMAN but the Jerk off animation is mp_player_int_upperwank or mp_player_int_wank_01 and have no clue how to use these.

My Code:

local purpleText = {128, 0, 128}
function diceText(text)
    TriggerEvent("chatMessage", "[Dice]", purpleText, text)
end
Citizen.CreateThread(function()
    while true do
        Wait(0)
        local dice = math.random(1, 6)
        RegisterCommand("rolldice", function()
            if IsEntityDead(GetPlayerPed(-1)) then 
                diceText("Error: Cannot roll dice when your dead...")
            else
                diceText("You rolled: ".. dice)
                local diceAnim = "mp_player_int_wank_01"
                TaskStartScenarioInPlace(GetPlayerPed(-1), diceAnim, 0, true)
            end
        end)
    end
end)

Would love if someone could help… would make my week. Thanks in advance!

1 Like

try
TaskStartScenarioInPlace(GetPlayerPed(-1), mp_player_int_wank_01, 0, true)

1 Like

Or ty this

local lib, anim = ‘mp_player_int_upperwank’, ‘mp_player_int_wank_01’

ESX.Streaming.RequestAnimDict(lib, function()
TaskPlayAnim(PlayerPedId(), lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false)
Citizen.Wait(2000)
ClearPedTasks(GetPlayerPed(-1))
end)
2 Likes

I am not using ESX I am using FX @Joe_Beauchamp

loadAnimDict( mp_player_int_upperwank )
TaskPlayAnim(GetPlayerPed(-1), mp_player_int_upperwank,mp_player_int_wank_01, 3.0, 1.0, -1, 01, 0, 0, 0, 0 )
Wait(2000)
ClearPedTasks(GetPlayerPed(-1))

function loadAnimDict(dict)
while (not HasAnimDictLoaded(dict)) do
RequestAnimDict(dict)
Citizen.Wait(5)
end
end

That should work. How do you do that code box thing?

on the toolbar next to upload and quote @Joe_Beauchamp

loadAnimDict( mp_player_int_upperwank )
TaskPlayAnim(GetPlayerPed(-1), mp_player_int_upperwank,mp_player_int_wank_01, 3.0, 1.0, -1, 01, 0, 0, 0, 0 )
Wait(2000)
ClearPedTasks(GetPlayerPed(-1))
function loadAnimDict()
while (not HasAnimDictLoaded(mp_player_int_upperwank)) do
RequestAnimDict(mp_player_int_upperwank)
Citizen.Wait(5)
end
end

I dont get it lol

You have to select it

so you would select the code then press the </> button @Joe_Beauchamp

ah there we go

loadAnimDict( mp_player_int_upperwank )
                TaskPlayAnim(GetPlayerPed(-1), mp_player_int_upperwank,mp_player_int_wank_01, 3.0, 1.0, -1, 01, 0, 0, 0, 0 )
                Wait(2000)
                ClearPedTasks(GetPlayerPed(-1))

                function loadAnimDict(dict)
                    while (not HasAnimDictLoaded(dict)) do
                        RequestAnimDict(dict)
                        Citizen.Wait(5)
                    end
                end
            end

@Joe_Beauchamp does this look correct?

local purpleText = {128, 0, 128}
function diceText(text)
    TriggerEvent("chatMessage", "[Dice]", purpleText, text)
end
Citizen.CreateThread(function()
    while true do
        Wait(0)
        local dice = math.random(1, 6)
        RegisterCommand("rolldice", function()
            if IsEntityDead(GetPlayerPed(-1)) then 
                diceText("Error: Cannot roll dice when your dead...")
            else
                    while (not HasAnimDictLoaded(mp_player_int_upperwank)) do
                        RequestAnimDict(mp_player_int_upperwank)
                        Citizen.Wait(5)
                    end
                TaskPlayAnim(GetPlayerPed(-1),mp_player_int_upperwank,mp_player_int_wank_01, 3.0, 1.0, -1, 01, 0, 0, 0, 0 )
                Wait(2000)
                ClearPedTasks(GetPlayerPed(-1))
            end
        end)
    end
end)

try that shouldn’t need the other function

local purpleText = {128, 0, 128}
function diceText(text)
    TriggerEvent("chatMessage", "[Dice]", purpleText, text)
end
Citizen.CreateThread(function()
    while true do
        Wait(0)
        local dice = math.random(1, 6)
        RegisterCommand("rolldice", function()
            if IsEntityDead(GetPlayerPed(-1)) then 
                diceText("Error: Cannot roll dice when your dead...")
            else
                    while (not HasAnimDictLoaded(mp_player_int_upperwank)) do
                        RequestAnimDict(mp_player_int_upperwank)
                        Citizen.Wait(5)

                TaskPlayAnim(GetPlayerPed(-1),mp_player_int_upperwank,mp_player_int_wank_01, 3.0, 1.0, -1, 01, 0, 0, 0, 0 )
                Wait(2000)
                ClearPedTasks(GetPlayerPed(-1))
				end
            end
        end)
    end
end)

or this with the end after. ive still not quite got my head around the ends

still not working… grrrrrrrrrrrr @Joe_Beauchamp

getting any errors in f8?
il help more tomorrow, ive got to get to bed

nope and thanks so much

RegisterCommand('roll', function(source, args, rawCommand)
 local number = math.random(1,6)
 loadAnimDict("anim@mp_player_intcelebrationmale@wank")
 TaskPlayAnim(GetPlayerPed(-1), "anim@mp_player_intcelebrationmale@wank", "wank", 8.0, 1.0, -1, 49, 0, 0, 0, 0)
 Citizen.Wait(1500)
 ClearPedTasks(GetPlayerPed(-1))
 TriggerEvent('chatMessage', '[Dice]', {128, 0, 128}, 'You Rolled: '..number)
end)

function loadAnimDict(dict)
 while not HasAnimDictLoaded(dict) do
  RequestAnimDict( dict )
  Citizen.Wait(5)
 end
end
1 Like

This works thanks so much!!! @KeiranPower

no problem :smile: