OnPlayerWeaponShot: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Event|Server & Client|1.0}} | {{Info|Event|Server & Client|1.0}} | ||
{{FuncDescription|Called when a player has shot their weapon and the hit was authorized by the server but not yet processed its impact. You can call | {{FuncDescription|Called when a player has shot their weapon and the hit was authorized by the server but not yet processed its impact. You can call return '''false'' in this event to prevent this hit from further processing. (Server only)}} | ||
{{FuncSyntax|OnPlayerWeaponShot(player, weapon, hittype, hitid, hitX, hitY, hitZ, startX, startY, normalX, normalY, normalZ)}} | {{FuncSyntax|OnPlayerWeaponShot(player, weapon, hittype, hitid, hitX, hitY, hitZ, startX, startY, normalX, normalY, normalZ)}} |
Revision as of 19:14, 6 October 2019
Description
Called when a player has shot their weapon and the hit was authorized by the server but not yet processed its impact. You can call return 'false in this event to prevent this hit from further processing. (Server only)
Syntax
OnPlayerWeaponShot(player, weapon, hittype, hitid, hitX, hitY, hitZ, startX, startY, normalX, normalY, normalZ)
Parameters
- player
The player that has shot the weapon. - player
Weapon model id. - hittype
The type of entity which was hit. - hitid
The identifier of the entity which was hit. - hitX
The X coordinate of this hit. - hitY
The Y coordinate of this hit. - hitZ
The Z coordinate of this hit. - startX
The X coordinate of where this short started from. - startY
The Y coordinate of where this short started from. - startY
The Z coordinate of where this short started from. - normalX
Impact normal X of the hit. - normalY
Impact normal Y of the hit. - normalZ
Impact normal Z of the hit.
Example
function OnPlayerWeaponShot(player, weapon, hittype, hitid, hitx, hity, hitz, startx, starty, startz, normalx, normaly, normalz)
local action = {
"in the air",
"at player",
"at vehicle",
"an NPC",
"at object",
"on ground",
"in water"
}
print(GetPlayerName(player).."("..player..") shot "..action[hittype].." (ID "..hitid..") using weapon ("..weapon..")")
if (hittype == HIT_NPC) then
AddPlayerChat(player, "Hey you, don't shoot at NPCs!")
end
end
AddEvent("OnPlayerWeaponShot", OnPlayerWeaponShot)
See also
Player
- OnPlayerServerAuth
- OnPlayerSteamAuth
- OnPlayerDownloadFile
- OnPlayerStreamIn
- OnPlayerStreamOut
- OnPlayerPickupHit
- OnPlayerJoin
- OnPlayerQuit
- OnPlayerSpawn
- OnPlayerDeath
- OnPlayerWeaponShot
- OnPlayerDamage
- OnPlayerChat
- OnPlayerChatCommand
- OnPlayerInteractDoor
- OnPlayerChangeDimension
Vehicle
- OnPlayerEnterVehicle
- OnPlayerLeaveVehicle
- OnPlayerStateChange
- OnVehicleRespawn
- OnVehicleStreamIn
- OnVehicleStreamOut
- OnVehicleDamage
- OnVehicleChangeDimension
- OnVehicleCreated
- OnVehicleDestroyed
Game
Package
NPC
- OnNPCReachTarget
- OnNPCDamage
- OnNPCSpawn
- OnNPCDeath
- OnNPCStreamIn
- OnNPCStreamOut
- OnNPCChangeDimension
- OnNPCCreated
- OnNPCDestroyed
Object
- OnObjectStopMoving
- OnObjectChangeDimension
- OnObjectCreated
- OnObjectDestroyed
- OnObjectStreamIn
- OnObjectStreamOut