GetProjectileType: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added OOP syntax)
 
(4 intermediate revisions by 4 users not shown)
Line 7: Line 7:
int getProjectileType ( projectile theProjectile )
int getProjectileType ( projectile theProjectile )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[projectile]]:getType|type}}


==Required Arguments==
===Required Arguments===
*'''theProjectile:''' The [[projectiles| projectile]] element which type you want to retrieve.
*'''theProjectile:''' The [[Element/Projectile|projectile]] element which type you want to retrieve.


==Returns==
==Returns==
Line 18: Line 19:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function projectileCreation()
function projectileCreation()
local type = getProjectileType(source);
local theType = getProjectileType(source)
outputChatBox("A projectile was created! Its type: "..type);
outputChatBox("A projectile was created! It's type: "..theType)
end
end
addEventHandler("onClientProjectileCreation", getRootElement(), projectileCreation)
addEventHandler("onClientProjectileCreation", getRootElement(), projectileCreation)
Line 26: Line 27:
==See also==
==See also==
{{Client projectile functions}}
{{Client projectile functions}}
[[it:getProjectileType]]

Latest revision as of 17:42, 26 November 2014

This function returns the type of the specified projectile.

Syntax

int getProjectileType ( projectile theProjectile )

OOP Syntax Help! I don't understand this!

Method: projectile:getType(...)
Variable: .type


Required Arguments

  • theProjectile: The projectile element which type you want to retrieve.

Returns

Returns an integer over the type of the projectile or false if invalid arguments were passed.

ID Name/Description
16 Grenade
17 Tear Gas Grenade
18 Molotov
19 Rocket (simple)
20 Rocket (heat seeking)
21 Air Bomb
39 Satchel Charge
58 Hydra flare

Example

function projectileCreation()
	local theType = getProjectileType(source)
	outputChatBox("A projectile was created! It's type: "..theType)
end
addEventHandler("onClientProjectileCreation", getRootElement(), projectileCreation)

See also