This repository was archived by the owner on Aug 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.lua
More file actions
71 lines (57 loc) · 2.72 KB
/
player.lua
File metadata and controls
71 lines (57 loc) · 2.72 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
64
65
66
67
68
69
70
71
--[[
Script Name: RP2D Player Functions
Script URI: https://github.com/sqpp/RP2D
Author: Marcell (#6943)
Author URI: https://unrealsoftware.de/profile.php?userid=6943
Description: .... modify later
Version: 0.0.0.1
License: GNU General Public License v3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Tags: cs2d, roleplay, player
This script is licensed under the GPL.
(C) 2020 Marcell
]]
function RP2D.ApplySkins(id)
local usgn = player(id, "usgn") -- Get Player USGN ID
local steam = player(id, "steamid") -- Get Player Steam ID
if file_exists("sys/lua/cache/usgn_"..usgn..".dat") then -- if player uses USGN ID
local file = io.open("sys/lua/cache/usgn_"..usgn..".dat", "r")
local jsondata = file:read("*a")
local data = json.decode(jsondata)
playerTable[id].body = image(data['cSkin'], player(id, "x"), player(id, "y"), 200+id)
imagescale(playerTable[id].body, 0.7,0.7)
RP2D.log("console", 1, " custom skin applied for player: "..player(id,"name").."("..usgn..")")
if (data['cHair']) > 0 then -- If player has different hair
playerTable[id].hair = image("gfx/miami/skins/hairs/"..data['cHair']..".png", player(id, "x"), player(id, "y"), 200+id)
imagescale(playerTable[id].hair, 0.7,0.7)
else
return nil end
end
if file_exists("sys/lua/cache/steam_"..steam..".dat") then -- if player uses Steam
local file = io.open("sys/lua/cache/steam_"..steam..".dat", "r")
local jsondata = file:read("*a")
local data = json.decode(jsondata)
playerTable[id].body = image(data['skin']['path'], player(id, "x"), player(id, "y"), 201, id)
imagescale(playerTable[id].body, 0.7,0.7)
else
return false end
end
function RP2D.RemoveSkins(id)
freeimage(playerTable[id].body)
freeimage(playerTable[id].hair)
playerTable[id].body = nil
playerTable[id].hair = nil
RP2D.log("console", 1, " custom skin removed for player: "..player(id,"name").."("..usgn..")")
end
function RP2D.CustomSkinAttack(id)
usgn = player(id, "usgn") -- Get Player USGN ID
steam = player(id, "steamid") -- Get Player Steam ID
if file_exists("sys/lua/cache/usgn_"..usgn..".dat") then -- if player uses USGN ID
file = io.open("sys/lua/cache/usgn_"..usgn..".dat", "r")
jsondata = file:read("*a")
data = json.decode(jsondata)
playerTable[id].attack = image(data['cAttack'], player(id, "x"), player(id, "y"), 200+id)
imagescale(playerTable[id].attack, 0.7,0.7)
else
return false end
end