IT/getProjectileCreator: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 15: Line 15:
Restituisce l'elemento che ha creato il proiettile in caso di successo, altrimenti restituisce ''false'' .
Restituisce l'elemento che ha creato il proiettile in caso di successo, altrimenti restituisce ''false'' .


==Example==
==Esempio==
<section name="Client" class="client" show="true">
This example will output a message in the chatbox saying who created
the projectile.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO
addEventHandler("onClientProjectileCreation", root, function(projectile)
    local creator = getProjectileCreator(projectile)
    if (getElementType(creator) == "player") then
        local pName = getPlayerName(creator)
local projectileID = getProjectileType(projectile)
        outputChatBox(pName.." created a projectile! (ID: "..projectileID..")", 255, 200, 0, false)
    end
end)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See also==
==Vedere anche==
{{IT/Client projectile functions}}
{{IT/Client projectile functions}}
[[Category:Needs_Example]]

Latest revision as of 18:54, 18 January 2014

« Torna alla Pagina principale italiana .


Questa funzione restituisce il creatore di uno specifico proiettile.

Sintassi

element getProjectileCreator ( projectile theProjectile )

Argomenti richiesti

  • theProjectile: L'elemento proiettile del creatore che si vuole recuperare.

Valori restituiti

Restituisce l'elemento che ha creato il proiettile in caso di successo, altrimenti restituisce false .

Esempio

Click to collapse [-]
Client

This example will output a message in the chatbox saying who created the projectile.

addEventHandler("onClientProjectileCreation", root, function(projectile)
    local creator = getProjectileCreator(projectile)
    if (getElementType(creator) == "player") then
        local pName = getPlayerName(creator)
	local projectileID = getProjectileType(projectile)
        outputChatBox(pName.." created a projectile! (ID: "..projectileID..")", 255, 200, 0, false)
    end
end)

Vedere anche