Forum

> > CS2D > General > CS2D base LUA question.
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch CS2D base LUA question.

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt CS2D base LUA question.

Marijuana
User Off Offline

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

alt Re: CS2D base LUA question.

HaRe
User Off Offline

Zitieren
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

alt Re: CS2D base LUA question.

Marijuana
User Off Offline

Zitieren
HaRe hat geschrieben
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?

alt Re: CS2D base LUA question.

Loooser
User Off Offline

Zitieren
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

alt Re: CS2D base LUA question.

Marijuana
User Off Offline

Zitieren
loooser hat geschrieben
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

alt Re: CS2D base LUA question.

HaRe
User Off Offline

Zitieren
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

alt Re: CS2D base LUA question.

archmage
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht