EngineGetModelPhysicalPropertiesGroup: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
(One intermediate revision by the same user not shown)
Line 11: Line 11:
Returns '''id''' of physical properties group that requested model uses, in range of ''0-159'', if the object doesn't have a group assigned, ''-1'' is returned. If passed arguments were wrong, error is triggered.
Returns '''id''' of physical properties group that requested model uses, in range of ''0-159'', if the object doesn't have a group assigned, ''-1'' is returned. If passed arguments were wrong, error is triggered.


==Example==  
==Example==
<section name="Client" class="client" show="true">
<section name="Check if object model is dynamic" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function checkID(_, id)
function checkDynamicID(player, modelID)
     outputConsole(engineGetModelPhysicalPropertiesGroup(tonumber(id)))
     modelID = tonumber(modelID)
    local isDynamicModel = engineGetModelPhysicalPropertiesGroup(modelID) ~= -1
    outputChatBox("Model ID " .. modelID .. " is ".. (isDynamicModel and "dynamic" or "static") .. ".", player)
end
end
addCommandHandler ( "checkID", checkID )
addCommandHandler("checkdyn", checkDynamicID)
</syntaxhighlight>
</section>
 
<section name="Obtain a model's physical properties group" class="client" show="true">
<syntaxhighlight lang="lua">
function checkID(player, id)
    id = tonumber(id)
    local group = engineGetModelPhysicalPropertiesGroup(id)
    outputChatBox("Model ID " .. id .. "'s group is: " .. tostring(group))
end
addCommandHandler("checkID", checkID)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 14:59, 22 October 2024

This function gets physical properties group id used by given model.

Syntax

int engineGetModelPhysicalPropertiesGroup ( int modelID )

Required Arguments

  • modelID: the id of model which you wish to get physical properties group of.

Returns

Returns id of physical properties group that requested model uses, in range of 0-159, if the object doesn't have a group assigned, -1 is returned. If passed arguments were wrong, error is triggered.

Example

Click to collapse [-]
Check if object model is dynamic
function checkDynamicID(player, modelID)
    modelID = tonumber(modelID)
    local isDynamicModel = engineGetModelPhysicalPropertiesGroup(modelID) ~= -1
    outputChatBox("Model ID " .. modelID .. " is ".. (isDynamicModel and "dynamic" or "static") .. ".", player)
end
addCommandHandler("checkdyn", checkDynamicID)
Click to collapse [-]
Obtain a model's physical properties group
function checkID(player, id)
    id = tonumber(id)
    local group = engineGetModelPhysicalPropertiesGroup(id)
    outputChatBox("Model ID " .. id .. "'s group is: " .. tostring(group))
end
addCommandHandler("checkID", checkID)

Requirements

This template will be deleted.

See Also