Hey, today I am here to release a simple dev tool I had to make to help me visualize attaching objects to a ped.
Commands:
- /co [OBJECT_NAME] [BONE] - Creates the object
- /cd - Deletes object
- /cout - Outputs to console the positions, bone, rotation etc
- /cst [number] - Sets the tolerance everytime you move something
- /cb [bone] - Changes the bone. The bone should be the name and not the id
Controls:
- Numpad 8 - Increases Z
- Numpad 5 - Decreases Z
- Arrow up - Moves Y
- Arrow down - Moves Y
- Arrow left - Moves X
- Arrow right - Moves X
- Numpad 7 - Rotates Z
- Numpad 9 - Rotates Z
- Numpad 4 - Rotates Y
- Numpad 6 - Rotates Y
- Numpad + - Rotates X
- Numpad - - Rotates X
bones = {
["SKEL_ROOT"] = 0,
["FB_R_Brow_Out_000"] = 1356,
["SKEL_L_Toe0"] = 2108,
["MH_R_Elbow"] = 2992,
["SKEL_L_Finger01"] = 4089,
["SKEL_L_Finger02"] = 4090,
["SKEL_L_Finger31"] = 4137,
["SKEL_L_Finger32"] = 4138,
["SKEL_L_Finger41"] = 4153,
["SKEL_L_Finger42"] = 4154,
["SKEL_L_Finger11"] = 4169,
["SKEL_L_Finger12"] = 4170,
["SKEL_L_Finger21"] = 4185,
["SKEL_L_Finger22"] = 4186,
["RB_L_ArmRoll"] = 5232,
["IK_R_Hand"] = 6286,
["RB_R_ThighRoll"] = 6442,
["SKEL_R_Clavicle"] = 10706,
["FB_R_Lip_Corner_000"] = 11174,
["SKEL_Pelvis"] = 11816,
["IK_Head"] = 12844,
["SKEL_L_Foot"] = 14201,
["MH_R_Knee"] = 16335,
["FB_LowerLipRoot_000"] = 17188,
["FB_R_Lip_Top_000"] = 17719,
["SKEL_L_Hand"] = 18905,
["FB_R_CheekBone_000"] = 19336,
["FB_UpperLipRoot_000"] = 20178,
["FB_L_Lip_Top_000"] = 20279,
["FB_LowerLip_000"] = 20623,
["SKEL_R_Toe0"] = 20781,
["FB_L_CheekBone_000"] = 21550,
["MH_L_Elbow"] = 22711,
["SKEL_Spine0"] = 23553,
["RB_L_ThighRoll"] = 23639,
["PH_R_Foot"] = 24806,
["SKEL_Spine1"] = 24816,
["SKEL_Spine2"] = 24817,
["SKEL_Spine3"] = 24818,
["FB_L_Eye_000"] = 25260,
["SKEL_L_Finger00"] = 26610,
["SKEL_L_Finger10"] = 26611,
["SKEL_L_Finger20"] = 26612,
["SKEL_L_Finger30"] = 26613,
["SKEL_L_Finger40"] = 26614,
["FB_R_Eye_000"] = 27474,
["SKEL_R_Forearm"] = 28252,
["PH_R_Hand"] = 28422,
["FB_L_Lip_Corner_000"] = 29868,
["SKEL_Head"] = 31086,
["IK_R_Foot"] = 35502,
["RB_Neck_1"] = 35731,
["IK_L_Hand"] = 36029,
["SKEL_R_Calf"] = 36864,
["RB_R_ArmRoll"] = 37119,
["FB_Brow_Centre_000"] = 37193,
["SKEL_Neck_1"] = 39317,
["SKEL_R_UpperArm"] = 40269,
["FB_R_Lid_Upper_000"] = 43536,
["RB_R_ForeArmRoll"] = 43810,
["SKEL_L_UpperArm"] = 45509,
["FB_L_Lid_Upper_000"] = 45750,
["MH_L_Knee"] = 46078,
["FB_Jaw_000"] = 46240,
["FB_L_Lip_Bot_000"] = 47419,
["FB_Tongue_000"] = 47495,
["FB_R_Lip_Bot_000"] = 49979,
["SKEL_R_Thigh"] = 51826,
["SKEL_R_Foot"] = 52301,
["IK_Root"] = 56604,
["SKEL_R_Hand"] = 57005,
["SKEL_Spine_Root"] = 57597,
["PH_L_Foot"] = 57717,
["SKEL_L_Thigh"] = 58271,
["FB_L_Brow_Out_000"] = 58331,
["SKEL_R_Finger00"] = 58866,
["SKEL_R_Finger10"] = 58867,
["SKEL_R_Finger20"] = 58868,
["SKEL_R_Finger30"] = 58869,
["SKEL_R_Finger40"] = 58870,
["PH_L_Hand"] = 60309,
["RB_L_ForeArmRoll"] = 61007,
["SKEL_L_Forearm"] = 61163,
["FB_UpperLip_000"] = 61839,
["SKEL_L_Calf"] = 63931,
["SKEL_R_Finger01"] = 64016,
["SKEL_R_Finger02"] = 64017,
["SKEL_R_Finger31"] = 64064,
["SKEL_R_Finger32"] = 64065,
["SKEL_R_Finger41"] = 64080,
["SKEL_R_Finger42"] = 64081,
["SKEL_R_Finger11"] = 64096,
["SKEL_R_Finger12"] = 64097,
["SKEL_R_Finger21"] = 64112,
["SKEL_R_Finger22"] = 64113,
["SKEL_L_Clavicle"] = 64729,
["FACIAL_facialRoot"] = 65068,
["IK_L_Foot"] = 65245
}
object=nil;
editMode=false;
x=0.0;
y=0.0;
z=0.0;
px=0.0;
py=0.0;
pz=0.0;
bone=nil;
tol=0.05;
RegisterCommand("co", function(source, args, rawCommand)
local objectName=args[1];
bone=args[2];
local ped=PlayerPedId();
local on=GetHashKey(objectName)
RequestModel(on)
while not HasModelLoaded(on) do
Wait(100)
end
object=CreateObject(on, 1.0, 1.0, 1.0, true, true, false)
AttachEntityToEntity(object, ped, GetPedBoneIndex(ped, bones[bone]), x,y,z,px,py,pz,1, 1, 0, 0, 2, 1);
editMode=true;
end, false)
RegisterCommand("cb", function(source,args, rawCommand)
bone=args[1];
DetachEntity(object,true,false);
AttachEntityToEntity(object, ped, GetPedBoneIndex(ped, bones[bone]), x,y,z,px,py,pz,1, 1, 0, 0, 2, 1);
end)
RegisterCommand("cout", function(source,args,rawCommand)
print("--------------------------------------------------------");
print("X: " .. x .. " Y: " .. y .. " Z: " .. z);
print("PX: " .. px .. " PY: " .. py .. " PZ: " .. pz);
print("Bone: " .. bone .. " Bone final: " .. bones[bone]);
print("--------------------------------------------------------");
end)
RegisterCommand("cd", function(source,args,rawCommand)
x=0.0;
y=0.0;
z=0.0;
px=0.0;
py=0.0;
pz=0.0;
DeleteObject(object)
end)
RegisterCommand("cst", function(source,args,rawCommand)
tol=tonumber(args[1]);
end)
Citizen.CreateThread(function()
while not NetworkIsSessionStarted() do
Citizen.Wait(500)
end
while true do
local sleep = 1500
if object and editMode then
sleep = 1
local playerPed = PlayerPedId()
local Waiting = 1500
local changed=false;
while editMode and object do
---Base code from: https://forum.cfx.re/t/free-object-spawn-standalone/4757038
Waiting = 1
--- Numpad 8 > Altitude +
if IsControlPressed(0, 111) then
z=z+tol;
changed=true;
end
---Numpa 5 > Altitude -
if IsControlPressed(0, 110) then
z=z-tol;
changed=true;
end
--- Arrow up - Move Y
if IsControlPressed(0, 172) then
y=y+tol;
changed=true;
end
--- Arrow down - Move Y
if IsControlPressed(0, 173) then
y=y-tol;
changed=true;
end
--- Arrow left - Move X
if IsControlPressed(0, 174) then
x=x-tol;
changed=true;
end
--- Arrow right - Move X
if IsControlPressed(0, 175) then
x=x+tol;
changed=true;
end
--- Numpad 7 - Z
if IsControlPressed(0, 117) then
pz=pz-tol;
changed=true;
end
--- Numpad 9 - Z
if IsControlPressed(0, 118) then
pz=pz+tol;
changed=true;
end
--- Numpad 4 - Y
if IsControlPressed(0, 124) then
py=py-tol;
changed=true;
end
--- Numpad 6 - Y
if IsControlPressed(0, 126) then
py=py+tol;
changed=true;
end
--- Numpad - - X
if IsControlPressed(0, 315) then
px=px-tol;
changed=true;
end
--- Numpad + - X
if IsControlPressed(0, 314) then
px=px+tol;
changed=true;
end
if(changed) then
DetachEntity(object,true,false);
AttachEntityToEntity(object, playerPed, GetPedBoneIndex(playerPed, bones[bone]), x,y,z,px,py,pz,1, 1, 0, 0, 2, 1);
end
Citizen.Wait(Waiting)
end
end
Citizen.Wait(sleep)
end
end)
Other Works
Wiretap Script - Listen to other player’s phone calls
Phone Records - Allow jobs to access citizen’s phone records
Crime Scene and Fire Tap, 20 Evidence Markers, Body Silhouete
Most advanced whiteboard system - draw on boards
[Open Source] FiveM Pager System with Discord Integration
[Open Source] Dynamic Settings control interface
[Open Source] PMA-Voice Radio List - See who’s on your frequency