so i want make table that can Backup all of this {weapon id, tile x, tile y, WEAPON[player id][weapon id][5]} for all dropped weapon
this example i make this only Backup {weapon id, tile x, tile y, WEAPON[player id][weapon id][5]} for 1 weapon
Spoiler
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
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
function array(SIZE, VALUE) local array = {} for PID = 1, SIZE or 32 do array[PID] = VALUE or 0 end return array end WEAPON = array(32, {}) BULLET = array(32, {}) for PID = 1, 32 do BULLET[PID] = { ["Pistol"] = 14; ["SG"] = 0; ["SMG"] = 0; ["Rifle"] = 900; ["Sniper"] = 0; ["MG"] = 0; } WEAPON[PID] = {--Name, {Damage}, MaxAmmo, BulletType, AmmoInside [1] = {"USP", {22, 0, 0}, 12, "Pistol", 0}; [32] = {"M4A1", {20, 0, 0}, 300, "Rifle", 300}; } end DROP_BACKUP = {--WeaponID, TileX, TileY, AmmoInside, Skin [1] = {0, 0, 0, 0, ""}; } addhook("drop", "drop_") function drop_(PID) local WID = player(PID, "weapon") local PTX, PTY = player(PID, "tilex"), player(PID, "tiley") if WEAPON[PID][WID] then DROP_BACKUP[1] = {WID, PTX, PTY, WEAPON[PID][WID][5], ""}; WEAPON[PID][WID][5] = 0 end end addhook("collect", "collect_") function collect_(PID) local WID = player(PID, "weapon") local PTX, PTY = player(PID, "tilex"), player(PID, "tiley") if PTX == DROP_BACKUP[1][2] and PTY == DROP_BACKUP[1][3] then local WDID = DROP_BACKUP[1][1] WEAPON[PID][WDID][5] = DROP_BACKUP[1][4] DROP_BACKUP[1] = {0, 0, 0, 0, ""}; end end
and this full code
Spoiler
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
function array(SIZE, VALUE) local array = {} for PID = 1, SIZE or 32 do array[PID] = VALUE or 0 end return array end WEAPON = array(32, {}) BULLET = array(32, {}) for PID = 1, 32 do BULLET[PID] = { ["Pistol"] = 14; ["SG"] = 0; ["SMG"] = 0; ["Rifle"] = 900; ["Sniper"] = 0; ["MG"] = 0; } WEAPON[PID] = {--Name, {Damage}, MaxAmmo, BulletType, AmmoInside [1] = {"USP", {22, 0, 0}, 12, "Pistol", 0}; [32] = {"M4A1", {20, 0, 0}, 300, "Rifle", 300}; } end DROP_BACKUP = {--WeaponID, TileX, TileY, AmmoInside, Skin [1] = {0, 0, 0, 0, ""}; } addhook("drop", "drop_") function drop_(PID) local WID = player(PID, "weapon") local PTX, PTY = player(PID, "tilex"), player(PID, "tiley") if WEAPON[PID][WID] then DROP_BACKUP[1] = {WID, PTX, PTY, WEAPON[PID][WID][5], ""}; WEAPON[PID][WID][5] = 0 end end addhook("collect", "collect_") function collect_(PID) local WID = player(PID, "weapon") local PTX, PTY = player(PID, "tilex"), player(PID, "tiley") if PTX == DROP_BACKUP[1][2] and PTY == DROP_BACKUP[1][3] then local WDID = DROP_BACKUP[1][1] WEAPON[PID][WDID][5] = DROP_BACKUP[1][4] DROP_BACKUP[1] = {0, 0, 0, 0, ""}; end end addhook("always", "always_") function always_() for _, PID in pairs(player(0, "tableliving")) do parse('hudtxt2 '..PID..' 1 "Weapon Dropped ID: '..DROP_BACKUP[1][1]..'|Tile X: '..DROP_BACKUP[1][2]..'|Tile Y: '..DROP_BACKUP[1][3]..'|AmmoIn: '..DROP_BACKUP[1][4]..'" 300 300') local WID = player(PID, "weapon") if WEAPON[PID][WID] then local BTYPE = WEAPON[PID][WID][4] if WEAPON[PID][WID][5] <= 0 and BULLET[PID][BTYPE] <= 0 then parse("setammo "..PID.." "..WID.." 0 0") elseif WEAPON[PID][WID][5] > 0 and BULLET[PID][BTYPE] <= 0 then parse("setammo "..PID.." "..WID.." 6 0") elseif WEAPON[PID][WID][5] <= 0 and BULLET[PID][BTYPE] > 0 then parse("setammo "..PID.." "..WID.." 0 1") elseif WEAPON[PID][WID][5] > 0 and BULLET[PID][BTYPE] > 0 then parse("setammo "..PID.." "..WID.." 6 1") end if WEAPON[PID][WID][5] == WEAPON[PID][WID][3] then parse("setammo "..PID.." "..WID.." 400 0") end parse('hudtxt2 '..PID..' 2 "'..WEAPON[PID][WID][1]..'| '..WEAPON[PID][WID][5]..'| '..BULLET[PID][BTYPE]..'" 400 400') else parse('hudtxt2 '..PID..' 2 "" 400 400') end end end addhook("attack", "attack_") function attack_(PID) local WID = player(PID, "weapon") if WEAPON[PID][WID] then WEAPON[PID][WID][5] = WEAPON[PID][WID][5] - 1 end end addhook("reload", "reload_") function reload_(PID, RMODE) local WID = player(PID, "weapon") if WEAPON[PID][WID] then local BTYPE = WEAPON[PID][WID][4] if RMODE == 2 then if BULLET[PID][BTYPE] >= WEAPON[PID][WID][3] then if WEAPON[PID][WID][5] > 0 and WEAPON[PID][WID][5] < WEAPON[PID][WID][3] then BULLET[PID][BTYPE] = BULLET[PID][BTYPE] - WEAPON[PID][WID][3] + WEAPON[PID][WID][5] WEAPON[PID][WID][5] = WEAPON[PID][WID][5] + WEAPON[PID][WID][3] - WEAPON[PID][WID][5] else BULLET[PID][BTYPE] = BULLET[PID][BTYPE] - WEAPON[PID][WID][3] - WEAPON[PID][WID][5] WEAPON[PID][WID][5] = WEAPON[PID][WID][3] end else if WEAPON[PID][WID][5] > 0 and WEAPON[PID][WID][5] < WEAPON[PID][WID][3] then BULLET[PID][BTYPE] = BULLET[PID][BTYPE] - WEAPON[PID][WID][3] + WEAPON[PID][WID][5] WEAPON[PID][WID][5] = WEAPON[PID][WID][5] + WEAPON[PID][WID][3] - WEAPON[PID][WID][5] else WEAPON[PID][WID][5] = BULLET[PID][BTYPE] --WEAPON[PID][WID][3] BULLET[PID][BTYPE] = BULLET[PID][BTYPE] - BULLET[PID][BTYPE] end end end end end
sorry for my bad england