OnClientProjectileCreation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Client event}} This event is triggered when a projectile is created. ==Parameters== <syntaxhighlight lang="lua"> element creator </syntaxhighlight> ==Source== The [[event system#Event source|sour...)
 
Line 17: Line 17:
end
end
addEventHandler("onClientProjectileCreation", getRootElement(), projectileCreation)
addEventHandler("onClientProjectileCreation", getRootElement(), projectileCreation)
</syntaxhighlight>
<syntaxhighlight lang="lua">
function punishSatchelUsersz ( creator )
local zeType = getProjectileType( source )
if zeType == 17 then
local zePlayerName = getPlayerName ( creator )
outputChatBox ( zePlayerName.." is a noob teargas user! But he got punished for it don't worry." )
local x, y, z = getElementPosition ( source ) --Getting the position from the projectile creator
setTimer ( setElementPosition, 50, 250, source, x, y, z-0.5 )
setTimer ( setElementPosition, 50, 250, creator, x, y, z-0.5 )
end
end
addEventHandler( "onClientProjectileCreation", getRootElement(), punishSatchelUsersz )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 14:00, 27 April 2012

This event is triggered when a projectile is created.

Parameters

element creator

Source

The source of this event is the projectile that was created.

Example

function projectileCreation()
	outputChatBox("A projectile was created!")
end
addEventHandler("onClientProjectileCreation", getRootElement(), projectileCreation)
function punishSatchelUsersz ( creator )
local zeType = getProjectileType( source )
if zeType == 17 then
local zePlayerName = getPlayerName ( creator )
outputChatBox ( zePlayerName.." is a noob teargas user! But he got punished for it don't worry." )
local x, y, z = getElementPosition ( source ) --Getting the position from the projectile creator
setTimer ( setElementPosition, 50, 250, source, x, y, z-0.5 )
setTimer ( setElementPosition, 50, 250, creator, x, y, z-0.5 )
end
end
addEventHandler( "onClientProjectileCreation", getRootElement(), punishSatchelUsersz )

See Also

Client projectile events