EngineGetSurfaceProperties: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
This function get properties of various surfaces.
{{New feature/item|3.0157|1.5.6|16365|This function retrieves the value of a surface property.}}
}}


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
mixed engineGetSurfaceProperties( int surfaceID, string property )
mixed engineGetSurfaceProperties ( int surfaceID, string property )
</syntaxhighlight>  
</syntaxhighlight>  
===Required Arguments===  
===Required Arguments===  
*'''surfaceID:''' ID from 0 to 178 [[Material IDs|GTASA material ID]]
*'''surfaceID:''' [[Material IDs|Material ID]] from 0 to 178
*'''property:''' Property name.
*'''property:''' Property name


===Returns===
===Returns===
Returns current mixed value of property.
Returns the current property value. See the table below for possible values.


== Properties ==
== Properties ==
Line 19: Line 18:


==Example==  
==Example==  
In this example, we retrieve the surface property value for a material with ID 5 and the property name “audio.” If successful, it displays the value; otherwise, it indicates an invalid input
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO
local surfaceID = 5 -- the material ID
local property = "audio" -- the property name
local propertyValue = engineGetSurfaceProperties(surfaceID, property)
if propertyValue then
    outputChatBox("Surface property '" .. property .. "' value: " .. tostring(propertyValue))
-- returns : Surface property 'audio' value: concrete
else
    outputChatBox("Invalid surface ID or property name.")
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Engine_functions}}
{{Engine_functions}}

Latest revision as of 20:15, 12 December 2023

This function retrieves the value of a surface property.

Syntax

mixed engineGetSurfaceProperties ( int surfaceID, string property )

Required Arguments

  • surfaceID: Material ID from 0 to 178
  • property: Property name

Returns

Returns the current property value. See the table below for possible values.

Properties

Materials, surfaces properties

Property Accepted values Effect Picture
glass true, false Unknown -
stairs true, false Unknown -
stepwatersplash true, false Water effect on step -
softlanding true, false Probably makes landing cause less damage -
steepslope true, false Makes climbing up impossible -
footeffect true, false Create footprints on the surface -
seethrough true, false Connected with processLineOfSight function -
shootthrough true, false Same as seethrough, but toggles ability to shoot through surfaces, objects.
Some fences have this ability.
-
audio "concrete", "grass", "sand", "gravel", "wood",
"water", "metal"
Noise when walking -
bulleteffect "metal", "concrete", "sand", "wood", "disabled" Effect when hit by a bullet -
tyregrip 0–255 Change tyre grip -
wetgrip 0–255 Change tyre grip when raining -
canclimb true, false Whether can be grabbed/climbed over -
adhesiongroup "rubber", "hard", "road", "loose", "sand", "wet" Change tyre grip between various surfaces.
If both surfaces (vehicle tyre and ground) are set to rubber,
makes vehicle rarely create skid marks and vehicle won't slip.
-
roughness 0–3 Unknown -
fractioneffect 0–7 Unknown, probably makes wheels vibrate on rail track -
wheeleffect "grass", "gravel", "mud", "sand", "dust",
"disabled"
Particle effect while driving -
skidmarktype "asphalt", "dirt", "dust", "disabled" Skid mark type -

Example

In this example, we retrieve the surface property value for a material with ID 5 and the property name “audio.” If successful, it displays the value; otherwise, it indicates an invalid input

local surfaceID = 5 -- the material ID
local property = "audio" -- the property name
local propertyValue = engineGetSurfaceProperties(surfaceID, property)
if propertyValue then
    outputChatBox("Surface property '" .. property .. "' value: " .. tostring(propertyValue))
	-- returns : Surface property 'audio' value: concrete
else
    outputChatBox("Invalid surface ID or property name.")
end

See Also