OnPlayerProjectileCreation: Difference between revisions
Jump to navigation
Jump to search
Zangomangu (talk | contribs) (Created page with "__NOTOC__ {{Server event}} {{Added feature/item|1.6.1|1.6.0|22293|This event is triggered every time a projectile is created by a player - either through a weapon, a vehicle weapon or createProjectile.}} ==Parameters== <syntaxhighlight lang="lua"> int weaponType, float x, float y, float z, float force, element target, float rotX, float rotY, float rotZ, float velX, float velY, float velZ </syntaxhighlight> *'''weaponType:''' ID, see below {{Projectiles}} *'''x:''...") |
|||
Line 28: | Line 28: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local projectileNames = { | |||
[16]='Grenade', | |||
[17]='Tear Gas Grenade', | |||
[18]='Molotov', | |||
[19]='Rocket (simple)', | |||
[20]='Rocket (heat seeking)', | |||
[21]='Air Bomb', | |||
[39]='Satchel Charge', | |||
[58]='Hydra flare' | |||
} | |||
addEventHandler('onPlayerProjectileCreation', root, | |||
function(weaponType) | |||
cancelEvent() | |||
local weaponName = projectileNames[weaponType] or 'Unknown' | |||
outputServerLog('* '..getPlayerName(source)..' created projectile ('..weaponName..')! most likely he is cheater, event canceled') | |||
end | |||
) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{See also/Server event|Player events}} | {{See also/Server event|Player events}} |
Revision as of 11:55, 19 November 2023
Parameters
int weaponType, float x, float y, float z, float force, element target, float rotX, float rotY, float rotZ, float velX, float velY, float velZ
- weaponType: ID, see below
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 |
- x: X coordinate of where the projectile was created
- y: Y coordinate of where the projectile was created
- z: Z coordinate of where the projectile was created
- force: force of thrown projectile. Valid for ID 16, 17, 18, 39.
- target: element the projectile is targeting. Valid for ID 19, 20.
- rotX: X rotation. Valid for ID 19, 20.
- rotY: Y rotation. Valid for ID 19, 20.
- rotZ: Z rotation. Valid for ID 19, 20.
- velX: X axis velocity. Valid for ID 16, 17, 18, 19, 20, 39.
- velY: Y axis velocity. Valid for ID 16, 17, 18, 19, 20, 39.
- velZ: Z axis velocity. Valid for ID 16, 17, 18, 19, 20, 39.
Source
The source of this event is the player who created the projectile.
Canceling
If this event is canceled, the projectile will not be created for other players on the server.
Example
local projectileNames = { [16]='Grenade', [17]='Tear Gas Grenade', [18]='Molotov', [19]='Rocket (simple)', [20]='Rocket (heat seeking)', [21]='Air Bomb', [39]='Satchel Charge', [58]='Hydra flare' } addEventHandler('onPlayerProjectileCreation', root, function(weaponType) cancelEvent() local weaponName = projectileNames[weaponType] or 'Unknown' outputServerLog('* '..getPlayerName(source)..' created projectile ('..weaponName..')! most likely he is cheater, event canceled') end )
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled