-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
63 lines (53 loc) · 1.99 KB
/
client.lua
File metadata and controls
63 lines (53 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--================================--
-- Copy Fit v2 --
-- by JellyJam --
-- License: GNU GPL 3.0 --
--================================--
function notify(string)
SetNotificationTextEntry("STRING")
AddTextComponentString(string)
DrawNotification(true, false)
end
RegisterNetEvent("getOutfit")
AddEventHandler("getOutfit", function(target, diffModels)
local ped = PlayerPedId()
local model = GetEntityModel(ped)
local outfit = {}
local props = {}
for i = 1, 11 do
local drawable = GetPedDrawableVariation(ped, i)
local texture = GetPedTextureVariation(ped, i)
local palette = GetPedPaletteVariation(ped, i)
table.insert(outfit, {drawable = drawable, texture = texture, palette = palette})
end -- Get Ped Drawables
for i = 0, 7 do
local index = GetPedPropIndex(ped, i)
local textureIndex = GetPedPropTextureIndex(ped, i)
table.insert(props, {index = index, textureIndex = textureIndex})
end -- Get Ped Props
TriggerServerEvent("sendToServer", outfit, props, model, target, diffModels)
notify("~g~ID:"..target.." ~w~copied your outfit")
end)
RegisterNetEvent("setPed")
AddEventHandler("setPed", function(outfit, props, model, diffModels)
if diffModels then
RequestModel(model)
while not HasModelLoaded(model) do
Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
end
local ped = PlayerPedId()
for i = 1, 11 do
SetPedComponentVariation(ped, i, outfit[i].drawable, outfit[i].texture, outfit[i].palette)
end-- Set Ped Components
for i = 0, 7 do
if props[i + 1].index ~= -1 then
SetPedPropIndex(ped, i, props[i + 1].index, props[i + 1].textureIndex, false)
else
ClearPedProp(ped, i)
end
end -- Set Ped Props
notify("~b~Outfit successfully copied")
end)