Skip to content

Commit b66d360

Browse files
Add missing events that were not properly listed on wiki
1 parent 6419f08 commit b66d360

File tree

7 files changed

+107
-4
lines changed

7 files changed

+107
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
addEventHandler( "onClientPedChoke", getRootElement( ),
2+
function ( )
3+
cancelEvent( );
4+
end
5+
);

events/Ped/onClientPedChoke.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Scraped from: https://wiki.multitheftauto.com/wiki/OnClientPedChoke
2+
name: onClientPedChoke
3+
type: client
4+
source_element:
5+
type: element
6+
description: The source of this event is the ped who is choking.
7+
description: This event is fired when a ped chokes due to the effect of a weapon such
8+
as tear gas grenades, fire extinguishers and spray cans.
9+
parameters:
10+
- name: weaponID
11+
type: int
12+
description: an int representing the ID of the weapon which caused the choking.
13+
- name: responsiblePed
14+
type: ped
15+
description: the ped responsible for causing the choking, possiblly nil.
16+
examples:
17+
- path: examples/onClientPedChoke-1.lua
18+
description: This example disables choking effects from the tear gas grenades.
19+
side: client
20+
canceling: If this event is canceled, the ped will not be choked.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
function discordJoin(justConnected, key)
2+
local myName = getPlayerName(source)
3+
if justConnected == true then
4+
outputChatBox ( myName .. " been referred here by " .. key )
5+
else
6+
outputChatBox ( myName .. " wanna play with " .. key )
7+
end
8+
9+
local refer = getPlayerFromName(key)
10+
setElementData(refer, "myUsers", getElementData(refer, "myUsers") + 1)
11+
setPlayerDiscordJoinParams(refer, key, key, getElementData(refer, "myUsers"), 5)
12+
end
13+
addEventHandler("onPlayerDiscordJoin", getRootElement(), discordJoin)
14+
15+
function storeDiscordParams()
16+
local myName = getPlayerName(source)
17+
setPlayerDiscordJoinParams(source, myName, myName, 1, 5)
18+
setElementData(source, "myUsers", 1)
19+
end
20+
21+
addEventHandler("onPlayerJoin", getRootElement(), storeDiscordParams)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
addEventHandler("onPlayerWeaponReload", root, function(weapon, ammoInClip, ammo)
2+
outputChatBox(getPlayerName(source) .. " is reloading their weapon: ")
3+
outputChatBox("Weapon: " .. getWeaponNameFromID(weapon))
4+
outputChatBox("AmmoInClip: " .. ammoInClip)
5+
outputChatBox("Ammo: " .. ammo)
6+
end)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Scraped from: https://wiki.multitheftauto.com/wiki/OnPlayerDiscordJoin
2+
name: onPlayerDiscordJoin
3+
type: server
4+
source_element:
5+
type: element
6+
description: The source of this event is the player who is invited to the game/clicked
7+
the "Join" button.
8+
description: This event is triggered when a player accepts game invites from a user
9+
in discord or click on "Join" button from that player.
10+
parameters:
11+
- name: justConnected
12+
type: bool
13+
description: If true, player connected to the server using game invite, otherwise
14+
he's already in the game and not joined the server using discord invite.
15+
- name: key
16+
type: string
17+
description: The key passed by setPlayerDiscordJoinParams to the player who invited
18+
this user.
19+
examples:
20+
- path: examples/onPlayerDiscordJoin-1.lua
21+
description: This example will announce the server that who invited that user from
22+
discord.
23+
side: server

events/Player/onPlayerTeleport.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ type: server
44
source_element:
55
type: element
66
description: The source of this event is the player who triggered the teleport detection.
7-
description: When the player synchronizes data with the server, the server monitors
8-
player positions to detect significant unexpected movements. If a player's position
9-
deviates beyond the established threshold without server functions like [setElementPosition](/wiki/SetElementPosition
10-
"SetElementPosition") being used, this event will be triggered.
7+
description: This event is triggered when a player's position changes significantly
8+
without direct server intervention, such as the use of [setElementPosition](/wiki/SetElementPosition
9+
"SetElementPosition"). When the player synchronizes data with the server, the server
10+
monitors player positions to detect significant unexpected movements. If a player's
11+
position deviates beyond the established threshold without server functions like
12+
[setElementPosition](/wiki/SetElementPosition "SetElementPosition") being used,
13+
this event will be triggered.
1114
parameters:
1215
- name: previousX
1316
type: float
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Scraped from: https://wiki.multitheftauto.com/wiki/OnPlayerWeaponReload
2+
name: onPlayerWeaponReload
3+
type: server
4+
source_element:
5+
type: element
6+
description: The source of this event is the player who's reloading their weapon.
7+
description: This event is triggered when a [player](/wiki/Player "Player") is reloading
8+
their weapon.
9+
parameters:
10+
- name: weapon
11+
type: int
12+
description: an int representing weapon used for firing a shot.
13+
- name: ammoInClip
14+
type: int
15+
description: an int amount of ammo left for this weapon type in clip.
16+
- name: ammo
17+
type: int
18+
description: an int amount of ammo left for this weapon type.
19+
examples:
20+
- path: examples/onPlayerWeaponReload-1.lua
21+
description: This example will output informations when aplayer's weapon is reloading.
22+
side: server
23+
canceling: If this event is canceled, then the players will not be able to reload
24+
their weapon manually by pressing R key. The weapons will still reload when the
25+
ammoInClip reaches zero. Using quickreload will also reload the weapon.

0 commit comments

Comments
 (0)