So Iv Been Trying To Find Out What Is Wrong With A Script I’m Trying To Make Using 2 Other Scripts So I Came Here To Find Out What Wrong So Here Is The Code Can You Find What Is Wrong With It
also you should probably copy all the code and test it yourself because i dont receive any errors.:
Yes This Is A Remake Of crouch-n-prone!
local crouched = false
local proned = false
crouchKey = 36 – This Button Is Control
proneKey = 20 – This Button Is Z
Citizen.CreateThread( function() – DO NOT AND I REPEAT DO NOT DELETE ANY CODE FROM HERE UNTIL YOU ARE AT ShotLegsRagdoll() IF YOU DELETE ANYTHING HIGHTER UP IT WILL MAKE THIS SCRIPT NO LONGER WORK!
while true do
Citizen.Wait( 1 )
local ped = GetPlayerPed( -1 )
if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then
ProneMovement()
DisableControlAction( 0, proneKey, true )
DisableControlAction( 0, crouchKey, true )
if ( not IsPauseMenuActive() ) then
if ( IsDisabledControlJustPressed( 0, crouchKey ) and not proned ) then
RequestAnimSet( “move_ped_crouched” )
RequestAnimSet(“MOVE_M@TOUGH_GUY@”)
while ( not HasAnimSetLoaded( "move_ped_crouched" ) ) do
Citizen.Wait( 100 )
end
while ( not HasAnimSetLoaded( "MOVE_M@TOUGH_GUY@" ) ) do
Citizen.Wait( 100 )
end
if ( crouched and not proned ) then
ResetPedMovementClipset( ped )
ResetPedStrafeClipset(ped)
SetPedMovementClipset( ped,"MOVE_M@TOUGH_GUY@", 0.5)
crouched = false
elseif ( not crouched and not proned ) then
SetPedMovementClipset( ped, "move_ped_crouched", 0.55 )
SetPedStrafeClipset(ped, "move_ped_crouched_strafing")
crouched = true
end
elseif ( IsDisabledControlJustPressed(0, proneKey) and not crouched and not IsPedInAnyVehicle(ped, true) and not IsPedFalling(ped) and not IsPedDiving(ped) and not IsPedInCover(ped, false) and not IsPedInParachuteFreeFall(ped) and (GetPedParachuteState(ped) == 0 or GetPedParachuteState(ped) == -1) ) then
if proned then
ClearPedTasks(ped)
local me = GetEntityCoords(ped)
SetEntityCoords(ped, me.x, me.y, me.z-0.5)
proned = false
elseif not proned then
RequestAnimSet( "move_crawl" )
while ( not HasAnimSetLoaded( "move_crawl" ) ) do
Citizen.Wait( 100 )
end
ClearPedTasksImmediately(ped)
proned = true
if IsPedSprinting(ped) or IsPedRunning(ped) or GetEntitySpeed(ped) > 5 then
TaskPlayAnim(ped, "move_jump", "dive_start_run", 8.0, 1.0, -1, 0, 0.0, 0, 0, 0)
Citizen.Wait(1000)
end
SetProned()
end
end
end
else
proned = false
crouched = false
end
end
end)
function SetProned()
ped = PlayerPedId()
ClearPedTasksImmediately(ped)
TaskPlayAnimAdvanced(ped, “move_crawl”, “onfront_fwd”, GetEntityCoords(ped), 0.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 46, 1.0, 0, 0)
end
function ProneMovement()
if proned then
ped = PlayerPedId()
DisableControlAction(0, 23)
DisableControlAction(0, 21)
if IsControlPressed(0, 32) or IsControlPressed(0, 33) then
DisablePlayerFiring(ped, true)
elseif IsControlJustReleased(0, 32) or IsControlJustReleased(0, 33) then
DisablePlayerFiring(ped, false)
end
if IsControlJustPressed(0, 32) and not movefwd then
movefwd = true
TaskPlayAnimAdvanced(ped, “move_crawl”, “onfront_fwd”, GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 47, 1.0, 0, 0)
elseif IsControlJustReleased(0, 32) and movefwd then
TaskPlayAnimAdvanced(ped, “move_crawl”, “onfront_fwd”, GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 46, 1.0, 0, 0)
movefwd = false
end
if IsControlJustPressed(0, 33) and not movebwd then
movebwd = true
TaskPlayAnimAdvanced(ped, “move_crawl”, “onfront_bwd”, GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 47, 1.0, 0, 0)
elseif IsControlJustReleased(0, 33) and movebwd then
TaskPlayAnimAdvanced(ped, “move_crawl”, “onfront_bwd”, GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 46, 1.0, 0, 0)
movebwd = false
end
if IsControlPressed(0, 34) then
SetEntityHeading(ped, GetEntityHeading(ped)+2.0 )
elseif IsControlPressed(0, 35) then
SetEntityHeading(ped, GetEntityHeading(ped)-2.0 )
end
function ShotLegsRagdoll() # When Someone Is Shot In The Legs They Fall Over | If You Dont What This Delete function ShotLegsRagdoll() All The Way Down Until NoBunnyHope()
local BONES = {
--[[Pelvis]][11816] = true,
--[[SKEL_L_Thigh]][58271] = true,
--[[SKEL_L_Calf]][63931] = true,
--[[SKEL_L_Foot]][14201] = true,
--[[SKEL_L_Toe0]][2108] = true,
--[[IK_L_Foot]][65245] = true,
--[[PH_L_Foot]][57717] = true,
--[[MH_L_Knee]][46078] = true,
--[[SKEL_R_Thigh]][51826] = true,
--[[SKEL_R_Calf]][36864] = true,
--[[SKEL_R_Foot]][52301] = true,
--[[SKEL_R_Toe0]][20781] = true,
--[[IK_R_Foot]][35502] = true,
--[[PH_R_Foot]][24806] = true,
--[[MH_R_Knee]][16335] = true,
--[[RB_L_ThighRoll]][23639] = true,
--[[RB_R_ThighRoll]][6442] = true,
}
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = GetPlayerPed(-1)
--if IsShockingEventInSphere(102, 235.497,2894.511,43.339,999999.0) then
if HasEntityBeenDamagedByAnyPed(ped) then
--if GetPedLastDamageBone(ped) =
Disarm(ped)
end
ClearEntityLastDamageEntity(ped)
end
end)
function Bool (num) return num == 1 or num == true end
-- WEAPON DROP OFFSETS
local function GetDisarmOffsetsForPed (ped)
local v
if IsPedWalking(ped) then v = { 0.6, 4.7, -0.1 }
elseif IsPedSprinting(ped) then v = { 0.6, 5.7, -0.1 }
elseif IsPedRunning(ped) then v = { 0.6, 4.7, -0.1 }
else v = { 0.4, 4.7, -0.1 } end
return v
end
function Disarm (ped)
if IsEntityDead(ped) then return false end
local boneCoords
local hit, bone = GetPedLastDamageBone(ped)
hit = Bool(hit)
if hit then
if BONES[bone] then
boneCoords = GetWorldPositionOfEntityBone(ped, GetPedBoneIndex(ped, bone))
SetPedToRagdoll(GetPlayerPed(-1), 10000, 10000, 0, 0, 0, 0)
Citizen.Wait(600)
ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.08)
return true
end
end
return false
end
function NoBunnyHope() # This Stops People From Bunny Hopping | If You Dont What This Delete function NoBunnyHope() All The Way Down Until End
local ragdoll_chance = 0.8 -- edit this decimal value for chance of falling (e.g. 80% = 0.8 75% = 0.75 32% = 0.32)
print('chance of falling set to: ' .. ragdoll_chance)
Citizen.CreateThread(function()
while true do
Citizen.Wait(100) -- check every 100 ticks, performance matters
local ped = PlayerPedId()
if IsPedOnFoot(ped) and not IsPedSwimming(ped) and (IsPedRunning(ped) or IsPedSprinting(ped)) and not IsPedClimbing(ped) and IsPedJumping(ped) and not IsPedRagdoll(ped) then
local chance_result = math.random()
print('lose grip result: ' .. chance_result)
if chance_result < ragdoll_chance then
Citizen.Wait(600) -- roughly when the ped loses grip
ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.08) -- change this float to increase/decrease camera shake
SetPedToRagdoll(ped, 5000, 1, 2)
print('falling!')
else
Citizen.Wait(2000) -- cooldown before continuing
end
end
end
end)