Skip to content

Commit 4a2f71e

Browse files
committed
Clothes & body functions
1 parent 46dbd61 commit 4a2f71e

File tree

9 files changed

+128
-109
lines changed

9 files changed

+128
-109
lines changed
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/AddClothingModel
2-
shared:
1+
client:
32
name: addClothingModel
43
description: This function adds a new wearable clothing item for CJ.
54
parameters:
@@ -11,15 +10,14 @@ shared:
1110
description: A string determining the clothes model that will be added.
1211
- name: clothesType
1312
type: int
14-
description: A integer representing the clothes slot/type the clothes should be
15-
added to. See the clothes catalog .
13+
description: A integer representing the clothes slot/type the clothes should be added to.
14+
templateList: clothingTypes
1615
examples:
1716
- path: examples/addClothingModel-1.lua
18-
description: ''
19-
side: server
2017
returns:
2118
values:
2219
- type: bool
23-
name: value
20+
name: result
2421
description: Returns true if the clothing was added, and false otherwise.
25-
requires_review: true
22+
version:
23+
added: 1.6.0 r23124
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
function scriptNextClothes ( thePlayer, key, clothesType )
2-
local currentTexture, currentModel = getPedClothes ( thePlayer, clothesType ) -- get the current clothes on this slot
3-
local clothesIndex = -1
4-
if ( currentTexture ) then -- if he had clothes of that type
5-
local tempA, tempB = getTypeIndexFromClothes ( currentTexture, currentModel ) -- get the type and index for these clothes, so we can increase it to get the next set in the list
6-
if ( tempA and tempB ) then -- if we found them
7-
clothesType, clothesIndex = tempA, tempB
1+
function scriptNextClothes(thePlayer, key, clothesType)
2+
local currentTexture, currentModel = getPedClothes(thePlayer, clothesType) -- get the current clothes on this slot
3+
local clothesIndex = -1
4+
if (currentTexture) then -- if he had clothes of that type
5+
local tempA, tempB = getTypeIndexFromClothes(currentTexture, currentModel) -- get the type and index for these clothes, so we can increase it to get the next set in the list
6+
if (tempA and tempB) then -- if we found them
7+
clothesType, clothesIndex = tempA, tempB
8+
end
9+
end
10+
clothesIndex = clothesIndex + 1
11+
local texture, model = getClothesByTypeIndex(clothesType, clothesIndex) -- get the new texture and model
12+
if (not texture) then -- if we've reached the end of the list
13+
removePedClothes(thePlayer, clothesType)
14+
else
15+
addPedClothes(thePlayer, texture, model, clothesType)
816
end
9-
end
10-
clothesIndex = clothesIndex + 1
11-
local texture, model = getClothesByTypeIndex ( clothesType, clothesIndex ) -- get the new texture and model
12-
if ( texture == false ) then -- if we've reached the end of the list
13-
removePedClothes ( thePlayer, clothesType )
14-
else addPedClothes ( thePlayer, texture, model, clothesType )
15-
end
1617
end
17-
addCommandHandler ( "nextClothes", scriptNextClothes )
18+
addCommandHandler("nextClothes", scriptNextClothes)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
function getClothes ( thePlayer, key, clothesType )
2-
local texture, model = getPedClothes ( source, clothesType )
3-
if ( texture and model ) then
4-
outputChatBox ( getPlayerName ( thePlayer ) .. " is wearing " .. texture .. " " .. model .. " on his " .. getClothesTypeName ( clothesType ) )
5-
end
1+
function getClothes(thePlayer, key, clothesType)
2+
local texture, model = getPedClothes(source, clothesType)
3+
if (texture and model) then
4+
outputChatBox(getPlayerName(thePlayer) .. " is wearing " .. texture .. " " .. model .. " on his " ..getClothesTypeName(clothesType))
5+
end
66
end
7-
addCommandHandler ( "clothes", getClothes )
7+
addCommandHandler("clothes", getClothes)
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
function scriptPreviousClothes ( thePlayer, key, clothesType )
2-
local currentTexture, currentModel = getPedClothes ( thePlayer, clothesType ) -- get the current clothes on this slot
3-
local clothesIndex = 1
4-
if ( currentTexture ) then -- if he had clothes of that type
5-
local tempA, tempB = getTypeIndexFromClothes ( currentTexture, currentModel ) -- get the type and index for these clothes, so we can decrease and get the previous in the list
6-
if ( tempA and tempB ) then -- if we found them
7-
clothesType, clothesIndex = tempA, tempB
1+
function scriptPreviousClothes(thePlayer, key, clothesType)
2+
local currentTexture, currentModel = getPedClothes(thePlayer, clothesType) -- get the current clothes on this slot
3+
local clothesIndex = 1
4+
if (currentTexture) then -- if he had clothes of that type
5+
local tempA, tempB = getTypeIndexFromClothes(currentTexture, currentModel) -- get the type and index for these clothes, so we can decrease and get the previous in the list
6+
if (tempA and tempB) then -- if we found them
7+
clothesType, clothesIndex = tempA, tempB
8+
end
9+
end
10+
clothesIndex = clothesIndex - 1
11+
local texture, model = getClothesByTypeIndex(clothesType, clothesIndex) -- get the new texture and model
12+
if (not texture) then -- if we've reached the end of the list
13+
removePedClothes(thePlayer, clothesType)
14+
else
15+
addPedClothes(thePlayer, texture, model, clothesType)
816
end
9-
end
10-
clothesIndex = clothesIndex - 1
11-
local texture, model = getClothesByTypeIndex ( clothesType, clothesIndex ) -- get the new texture and model
12-
if ( texture == false ) then -- if we've reached the end of the list
13-
removePedClothes ( thePlayer, clothesType )
14-
else addPedClothes ( thePlayer, texture, model, clothesType )
15-
end
1617
end
17-
addCommandHandler ( "previousClothes", scriptPreviousClothes )
18+
addCommandHandler("previousClothes", scriptPreviousClothes)
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/GetBodyPartName
2-
shared:
1+
shared: &shared
32
name: getBodyPartName
43
description: This function is used to get the name of a body part on a player.
54
parameters:
65
- name: bodyPartID
76
type: int
8-
description: 'An integer representing the body part ID you wish to retrieve the
9-
name of. 3: Torso 4: Ass 5: Left Arm 6: Right Arm 7: Left Leg 8: Right Leg 9:
10-
Head'
11-
examples:
12-
- path: examples/getBodyPartName-1.lua
13-
description: This example prints the killer and body part to the chat on the wasted/kill
14-
event.
15-
side: server
7+
description: An integer representing the body part ID you wish to retrieve the name of.
8+
templateList: bodyParts
169
returns:
1710
values:
1811
- type: string
19-
name: value
20-
description: This function returns a string containing the body part name if the
21-
ID is valid, false otherwise.
22-
requires_review: true
12+
name: body part name
13+
description: This function returns a string containing the body part name if the ID is valid, false otherwise.
14+
15+
server:
16+
<<: *shared
17+
examples:
18+
- path: examples/getBodyPartName-1.lua
19+
description: This example prints the killer and body part to the chat on the wasted/kill event.
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/GetClothesByTypeIndex
2-
shared:
1+
shared: &shared
32
name: getClothesByTypeIndex
4-
description: 'This function is used to get the texture and model of clothes by the
5-
clothes type and index.
6-
7-
(Scans through the list of clothes for the specific type).'
3+
description: This function is used to get the texture and model of clothes by the clothes type and index. (Scans through the list of clothes for the specific type).
84
parameters:
95
- name: clothesType
106
type: int
117
description: An integer representing the clothes slot/type to scan through.
8+
templateList: clothingTypes
129
- name: clothesIndex
1310
type: int
14-
description: MISSING_PARAM_DESC
15-
examples:
16-
- path: examples/getClothesByTypeIndex-1.lua
17-
description: This example gets the current clothes of a certain type on a player,
18-
then swaps with the next in the clothes list.
19-
side: server
11+
description: An integer representing the index (0 based) set of clothes in the list you wish to retrieve. Each type has a different number of valid indexes.
2012
returns:
2113
values:
22-
- type: string string
23-
name: value
24-
description: This function returns 2 strings, a texture and model respectively,
25-
false if invalid arguments were passed to the function.
26-
requires_review: true
14+
- type: string
15+
name: texture
16+
- type: string
17+
name: model
18+
description: This function returns 2 strings, a texture and model respectively, false if invalid arguments were passed to the function.
19+
20+
server:
21+
<<: *shared
22+
examples:
23+
- path: examples/getClothesByTypeIndex-1.lua
24+
description: This example gets the current clothes of a certain type on a player, then swaps with the next in the clothes list.
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/GetClothesTypeName
2-
shared:
1+
shared: &shared
32
name: getClothesTypeName
43
description: This function is used to get the name of a certain clothes type.
54
parameters:
65
- name: clothesType
76
type: int
8-
description: An integer determining the type of clothes you want to get the clothes
9-
of.
10-
examples:
11-
- path: examples/getClothesTypeName-1.lua
12-
description: This example is used to output in the chatbox what clothes type the
13-
player who uses the 'clothes' command is wearing.
14-
side: server
7+
description: An integer determining the type of clothes you want to get the clothes of.
8+
templateList: clothingTypes
159
returns:
1610
values:
1711
- type: string
18-
name: value
19-
description: This function returns a string (the name of the clothes type) if
20-
found, false otherwise.
21-
requires_review: true
12+
name: name
13+
description: This function returns a string (the name of the clothes type) if found, false otherwise.
14+
15+
server:
16+
<<: *shared
17+
examples:
18+
- path: examples/getClothesTypeName-1.lua
19+
description: This example is used to output in the chatbox what clothes type the player who uses the <code>/clothes</code> command is wearing.
Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/GetTypeIndexFromClothes
2-
shared:
1+
shared: &shared
32
name: getTypeIndexFromClothes
4-
description: 'This function is used to get the clothes type and index from the texture
5-
and model.
6-
7-
(Scans through the list of clothes for the specific type).'
3+
description: This function is used to get the clothes type and index from the texture and model. (Scans through the list of clothes for the specific type).
84
parameters:
95
- name: clothesTexture
106
type: string
11-
description: A string determining the clothes texture that you wish to retrieve
12-
the type and index from. See the clothes catalog .
7+
description: A string determining the clothes texture that you wish to retrieve the type and index from. See the [clothes catalog](/reference/ID_Lists/CJ_Clothes).
138
- name: clothesModel
149
type: string
15-
description: A string determining the corresponding clothes model that you wish
16-
to retrieve the type and index from. See the clothes catalog .
17-
examples:
18-
- path: examples/getTypeIndexFromClothes-1.lua
19-
description: This example gets the current clothes of a certain type on a player,
20-
then swaps with the previous in the clothes list.
21-
side: server
10+
description: A string determining the corresponding clothes model that you wish to retrieve the type and index from. See the [clothes catalog](/reference/ID_Lists/CJ_Clothes).
2211
returns:
2312
values:
24-
- type: int int
25-
name: value
26-
description: This function returns two integers, type and index respectively,
27-
false if invalid arguments were passed to the function.
28-
requires_review: true
13+
- type: int
14+
name: type
15+
- type: int
16+
name: index
17+
description: This function returns two integers, type and index respectively, false if invalid arguments were passed to the function.
18+
19+
server:
20+
<<: *shared
21+
examples:
22+
- path: examples/getTypeIndexFromClothes-1.lua
23+
description: This example gets the current clothes of a certain type on a player, then swaps with the previous in the clothes list.

web/src/components/TemplateList.astro

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,38 @@ const lists: Record<string, { id: number | string; label?: string }[]> = {
146146
{id: 0, label: "Close"},
147147
{id: 1, label: "Middle"},
148148
{id: 2, label: "Far"},
149-
]
149+
],
150+
151+
"bodyParts": [
152+
{id: 3, label: "Torso"},
153+
{id: 4, label: "Ass"},
154+
{id: 5, label: "Left Arm"},
155+
{id: 6, label: "Right Arm"},
156+
{id: 7, label: "Left Leg"},
157+
{id: 8, label: "Right Leg"},
158+
{id: 9, label: "Head"},
159+
],
160+
161+
"clothingTypes": [
162+
{id: 0, label: "SHIRT"},
163+
{id: 1, label: "HEAD"},
164+
{id: 2, label: "TROUSERS"},
165+
{id: 3, label: "SHOES"},
166+
{id: 4, label: "TATTOOS_LEFT_UPPER_ARM"},
167+
{id: 5, label: "TATTOOS_LEFT_LOWER_ARM"},
168+
{id: 6, label: "TATTOOS_RIGHT_UPPER_ARM"},
169+
{id: 7, label: "TATTOOS_RIGHT_LOWER_ARM"},
170+
{id: 8, label: "TATTOOS_BACK"},
171+
{id: 9, label: "TATTOOS_LEFT_CHEST"},
172+
{id: 10, label: "TATTOOS_RIGHT_CHEST"},
173+
{id: 11, label: "TATTOOS_STOMACH"},
174+
{id: 12, label: "TATTOOS_LOWER_BACK"},
175+
{id: 13, label: "NECKLACE"},
176+
{id: 14, label: "WATCH"},
177+
{id: 15, label: "GLASSES"},
178+
{id: 16, label: "HAT"},
179+
{id: 17, label: "EXTRA"},
180+
],
150181
};
151182
152183
const icons: Record<string, string> = {

0 commit comments

Comments
 (0)