Forum

> > CS2D > Scripts > AUTO Add Table When Dropped and Remove Table when
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch AUTO Add Table When Dropped and Remove Table when

10 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt AUTO Add Table When Dropped and Remove Table when

Unknown_Cheater
User Off Offline

Zitieren
FULL TITLE: how to make AUTO Added Table when drop and remove when Collect weapon

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 >


and this full code
Spoiler >


sorry for my bad england

alt Re: AUTO Add Table When Dropped and Remove Table when

Mami Tomoe
User Off Offline

Zitieren
I don't know what it is that you're making, or what it is that you wish for us to help you with.

But I do know that you're probably making this overly complicated, since the code has little to no documentation and seems to do a lot of redundant things.

Please don't use a translator, as it's quite obvious that you are, and it makes us unable to understand you, or what you need.

alt Re: AUTO Add Table When Dropped and Remove Table when

Unknown_Cheater
User Off Offline

Zitieren
my script work fine sir, i only want to know how to add table when player drop and remove the table when player collect
example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
BACKUP_DROP = {}
and player1 drop M4A1 then
BACKUP_DROP = {
	[1] = {32}
}
and then player2 drop USP then
BACKUP_DROP = {
	[1] = {32};
	[2] = {1}
}
and if player1 collect M4A1 that has dropped before then
BACKUP_DROP = {
	[2] = {1}
}
aaaaannnnndddd if player1 collect USP that has dropped by player2 before then
BACKUP_DROP = {}
understand? if still no
what can i do

edit:
Spoiler >
1× editiert, zuletzt 30.11.21 01:05:06

alt Re: AUTO Add Table When Dropped and Remove Table when

Masea
Super User Off Offline

Zitieren
So you want to have a table that simply contains the dropped items as their IDs. In fact, couldn't be easier! Your best friend for this is going to be cs2d lua hook drop where you get the ID of the dropped weapon and insert it to the aforementioned table, then cs2d lua hook collect comes into action! That's where you remove the particular item ID from the table by basically finding its table key.

Although this is how you would make it, make sure to tell us what you are planning to do with it.

alt Re: AUTO Add Table When Dropped and Remove Table when

Bowlinghead
User Off Offline

Zitieren
Mehr >

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- UNTESTED

addhook("drop","drop")
function (id,iid,type,ain, a, mode)

	local temp = {}
	temp.Id = id;
	temp.Iid = iid;
	temp.Type = type;
	temp.Ain = ain;
	temp.A = a;
	temp.Mode = mode;

	table.insert(BACKUP_DROP,temp)
end

https://www.lua.org/pil/19.2.html

alt Re: AUTO Add Table When Dropped and Remove Table when

Mora
User Off Offline

Zitieren
If you having enough experience and patience to read my coffee, you may find in my file archive stalker mood, where I made such system. Free for use and edit everything what your need in there, you can cut and edit needed parts from it
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht