{"hash":"0x2F7AA05C","ns":"CFX","name":"CREATE_OBJECT","slug":"CREATE_OBJECT","official":true,"named":true,"luaName":"CreateObject","game":"cfx","apiset":"server","returnType":"Entity","params":[{"name":"modelHash","type":"Hash","description":"The model to spawn."},{"name":"x","type":"float","description":"Spawn coordinate X component."},{"name":"y","type":"float","description":"Spawn coordinate Y component."},{"name":"z","type":"float","description":"Spawn coordinate Z component, 'ground level'."},{"name":"isNetwork","type":"BOOL","description":"Whether to create a network object for the object. If false, the object exists only locally."},{"name":"netMissionEntity","type":"BOOL","description":"Whether to register the object as pinned to the script host in the R\\* network model."},{"name":"doorFlag","type":"BOOL","description":"False to create a door archetype (archetype flag bit 26 set) as a door. Required to be set to true to create door models in network mode."}],"returnsDescription":"A script handle (fwScriptGuid index) for the object, or `0` if the object failed to be created.","summary":"Creates an object (prop) with the specified model at the specified position, offset on the Z axis by the radius of the object's model.","descriptions":[{"source":"cfx","format":"md","body":"Creates an object (prop) with the specified model at the specified position, offset on the Z axis by the radius of the object's model.\nThis object will initially be owned by the creating script as a mission entity, and the model should be loaded already (e.g. using REQUEST_MODEL).\n\n**This is the server-side RPC native equivalent of the client native [CREATE_OBJECT](?\\_0x509D5878EB39E842).**"}],"examples":[],"aliases":[],"enums":[],"related":[],"sources":["cfx"],"doc":2,"url":"https://natives.borderlinerp.com/natives/CFX/CREATE_OBJECT","markdownUrl":"https://natives.borderlinerp.com/natives/CFX/CREATE_OBJECT.md","snippets":{"lua":"local retval = CreateObject(modelHash, x, y, z, isNetwork, netMissionEntity, doorFlag)","luaInvoke":"local retval = Citizen.InvokeNative(0x2f7aa05c, modelHash, x, y, z, isNetwork, netMissionEntity, doorFlag, Citizen.ResultAsInteger())","js":"const retval = CreateObject(modelHash, x, y, z, isNetwork, netMissionEntity, doorFlag);","jsInvoke":"const retval = Citizen.invokeNative('0x2f7aa05c', modelHash, x + 0.0000001, y + 0.0000001, z + 0.0000001, isNetwork, netMissionEntity, doorFlag, Citizen.returnResultAnyway(), Citizen.resultAsInteger());","csharp":"int retval = Function.Call<int>((Hash)0x2f7aa05c, modelHash, x, y, z, isNetwork, netMissionEntity, doorFlag);","notes":["Hash parameters: the named function also accepts a string and hashes it for you; `Citizen.InvokeNative` needs the number — pass `joaat(\"name\")` or a backtick literal like `` `name` ``.","Float parameters: Lua integers (`10`, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write `10.0` or `value + 0.0`. The generated JS wrappers add `0.0000001` to non-zero floats for the same reason."]}}