Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustPressed(0, 323) then --Start holding X
TaskArrestPed(GetPlayerPed(-1), 1000, GetPlayerPed(-1), -1, true) -- Perform animation.
RequestAnimDict("random@arrests@busted")
RequestAnimDict("get_up@cuffed")
TaskPlayAnim("random@arrests@busted")
TaskPlayAnim("get_up@cuffed")
end
end
end)
well need to make a function for the command and i think i would try a different native maybe but u need the client and server script to make sure it works right
@GanjaMonster Ok. U are making me sweat for it. So maybe the “TaskPlayAnimAdvanced” would be a nice choice-. Do u know what the first param is “p0” is? Is it PlayerId,PlayerPedID or even GetPlayerPed(-1)? U know when to use what? :=)
@GanjaMonster Like said in the op; “The Event is working but I can’t get the animation to run.” I’m experienced in many languages (And lua is one) it’s just there is no information on how to use most of the functions. I had to look around, and found 2 different ways to use Wait() and CreateThread, but the working one is Citizen.Wait() and Citizen.CreateThread. The native functions are worse no idea what does what just putting numbers in places and it worked D:
I’ll release my full rp player arrest script when it’s done just have to setup walking when hands are cuffed
I got the two commands finished so far have to get detaining working
/arrest PlayerName
/cuff PlayerName
I got the two commands finished so far have to get detaining working
/arrest PlayerName
/cuff PlayerName
Can’t it be PlayerId instad of name?
I just tried every thing and I can’t get it to work. Am just testing on my own player which should also work right?
@COndor I’m not sure what you are trying to do?
I was talking about my plugin using the commands /arrest /cuff :S
I add the player to an array when they join like this { playerid=“Name” }
so when I join the array will be { “Lex_The_Great”=1 } then I check if the argument playername is in the array
-- Server
Players = {}
function addPlayer(source, name) -- addPlayer(source, "Lex_The_Great") <- Source is from the function onPlayerConnect. "Lex_the_Great" is from GetPlayerName(source)
if (Players[name] == nil) then
Players[name] = source
end
end
function getPlayerByName(name)
if (Players[name] ~= nil) then
return Players[name] -- <- Int is the array
end
return false
end
Then I check the argument from /arrest with getPlayerByName(playername) for the ID
But @GanjaMonster posted something that might have a better way to get all the players :S
keep in mind when you find the " TriggerClientEvent " it means that it currently is on server side
if it was on client side it would be like this for client events " TriggerEvent "
this should solve most of the confusion you will get from some codes on the forum