Forum

> > CS2D > General > CS2D base LUA question.
Forums overviewCS2D overviewGeneral overviewLog in to reply

English CS2D base LUA question.

7 replies
To the start Previous 1 Next To the start

old CS2D base LUA question.

Marijuana
User Off Offline

Quote
I've taken a look at the "info.txt" file in the LUA folder and I've noticed that there is a flagcapture and flagetake hook.

I'm just wondering if there is a flagreturn hook or something similar.

Also, is there a "on teamkill" hook?

If not, will they be included in future versions of CS2D?
Thanks.

old Re: CS2D base LUA question.

HaRe
User Off Offline

Quote
The hooks you see in the info.txt are the only ones also you can use
1
if (player(id,"teamkills") == HOWMANY) then

and i think that you can use the "drop" hook for the flag return

old Re: CS2D base LUA question.

Marijuana
User Off Offline

Quote
HaRe has written
The hooks you see in the info.txt are the only ones also you can use
1
if (player(id,"teamkills") == HOWMANY) then

and i think that you can use the "drop" hook for the flag return


Thanks for the quick response.

Do you know if there is a "on teamkill" hook, rather than, the amount of team kills?

old Re: CS2D base LUA question.

Loooser
User Off Offline

Quote
yes but i dont know the flag id
write :
1
2
3
4
5
6
addhook("drop","dropfunc")
function dropfunc(id,iid)
if iid=="flageblauid" or iid=="flagerotid" then
	--was auch immer du willst
end
end

old Re: CS2D base LUA question.

Marijuana
User Off Offline

Quote
loooser has written
yes but i dont know the flag id
write :
1
2
3
4
5
6
addhook("drop","dropfunc")
function dropfunc(id,iid)
if iid=="flageblauid" or iid=="flagerotid" then
	--was auch immer du willst
end
end


That looks like part of what I'm looking for, but do you think it's possible to make an alternative to returning the flag?

So, if you're on team 1 (Terrorist), and you pick up item 70 (red flag), would that be considered as flag return?

Terrorist Equivalent
1
2
if team==1 and iid==70 then
...

Counter-Terrorist Equivalent
1
2
if team==2 and iid==71 then
...

So would that mean:

1
2
3
4
5
6
7
8
9
addhook("walkover","flagreturn")
function flagreturn(team,id,iid)
		if team==1 and iid==70 then
.......
	end
		if team==2 and iid==71 then
.......
	end
end

old Re: CS2D base LUA question.

HaRe
User Off Offline

Quote
both are wrong

the real one is

1
2
3
4
5
6
7
8
addhook("drop","dropfunc")
function dropfunc(id,iid,type,ain,a,mode,x,y)
	if (player(id,"team") == 2) and type==70 then
		msg(player(id,"name").." has returnd the RED flag")
	elseif (player(id,"team") == 1) and type==71 then
		msg(player(id,"name").." has returnd the BLUE flag")
	end
end

old Re: CS2D base LUA question.

archmage
User Off Offline

Quote
The teamkill hook.
1
2
3
4
5
6
7
addhook("kill", "teamkill")

function teamkill (k, v)
	if ( player(k, "team") == player(v, "team") ) then
		...
	end
end
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview