Im trying to have the player who activates the command /cop to do all the things. Everything works except for the player model change. It either crashes my game or just doesnt work.
local copr = "0x5E3DA4A4"
RegisterCommand("cop", function()
SetEntityCoords(GetPlayerPed(-1), 853.1, -1272.95, 30.45, true, false, false, true)
GiveWeaponToPed(GetPlayerPed(-1), -2084633992, 999, false, false)
GiveWeaponToPed(GetPlayerPed(-1), 1593441988, 999, false, false)
GiveWeaponToPed(GetPlayerPed(-1), 487013001, 999, false, false)
SetPedAsCop(GetPlayerPed(-1), true)
SetPlayerModel(PlayerId(), copr)
SetPedArmour(-1, 50)
Wait(3000)
FreezeEntityPosition(GetPlayerPed(-1), true)
Wait(20000)
FreezeEntityPosition(GetPlayerPed(-1), false)
end)