MedBag Script

Hey all your great scripters could it be possible to make a script where you do like /Medbag and a medbag spawns in your hands ??

Yes, it’s possible.

  1. Use CreateObject to spawn the bag object https://runtime.fivem.net/doc/reference.html#_0x509D5878EB39E842
  2. Use AttachEntityToEntity to attach the object to the player entity https://runtime.fivem.net/doc/reference.html#_0x6B9BBD38AB0796DF

For a list of objects that you can spawn, see https://gist.github.com/leonardosnt/53faac01a38fc94505e9 and search for terms like bag. There are many that could classify as “medbag”

I hope this helps

1 Like

hi i tried making the script but when i try to type /medbag nothing happens
here is the code

resourse.lua

resource_manifest_version ‘77731fab-63ca-442c-a67b-abc70f28dfa5’

client_script “client.lua”
server_script “server.lua”

client.lua

RegisterNetEvent(“medbag”)
AddEventHandler(“medbag”, function()
TriggerEvent(// 0x509D5878EB39E842 0x2F7AA05C
// CreateObject
Object CREATE_OBJECT(Object prop_med_bag_01b, float x, float y, float z, BOOL isNetwork, BOOL thisScriptCheck, BOOL dynamic);
// 0x6B9BBD38AB0796DF 0xEC024237
// AttachEntityToEntity
void ATTACH_ENTITY_TO_ENTITY(Entity entity1, Entity entity2, int boneIndex, float xPos, float yPos, float zPos, float xRot, float yRot, float zRot, BOOL p9, BOOL useSoftPinning, BOOL collision, BOOL isPed, int vertexIndex, BOOL fixedRot);
Attaches entity1 to bone (boneIndex) of entity2.)
end)

server.lua

AddEventHandler(“chatMessage”, function(source, name, message)
cm = stringsplit(message, " ")

if cm[1] == "/medbag" then
	CancelEvent()
	if tablelength(cm) > 1 then
		local tPID = tonumber(cm[2])
		TriggerClientEvent("medbag", tPID)
	end
1 Like

You don’t really need the server.lua. you can use RegisterCommand in the client. It would make it all easier.

I attempt aswell and @Syntasu was able to assist me. It is nowhere complete as I need to fix the prop rotation. I plan to eventually make a full medic menu in the near future.

2 Likes

Did someone done it maybe ? I would appreciate it alot…

@nax0ri think i have it someone gimme a sec

this might work @nax0r

medkitcmd.rar (129.4 KB)

Can’t test it right now - tell me how it goes.

no luck just tried it, the only thing working is the text prompt when you drop it but nothing spawns in or works

ill try and find the one that worked when i get home

2 Likes

ever find it?..

how you spawn the bag ?

You spelt resource wrong^