Forum

> > CS2D > Scripts > AUTO Add Table When Dropped and Remove Table when
Forums overviewCS2D overview Scripts overviewLog in to reply

English AUTO Add Table When Dropped and Remove Table when

10 replies
To the start Previous 1 Next To the start

old AUTO Add Table When Dropped and Remove Table when

Unknown_Cheater
User Off Offline

Quote
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

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

Mami Tomoe
User Off Offline

Quote
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.

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

Unknown_Cheater
User Off Offline

Quote
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 >
edited 1×, last 30.11.21 01:05:06 am

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

Masea
Super User Off Offline

Quote
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.

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

Bowlinghead
User Off Offline

Quote
More >

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

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

Mora
User On Online

Quote
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview