Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2281 282 283338 339 Next To the start

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
maPmaKer has written
@HaRe:

It is working now but how to add the bot immediatly in the spec mode?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
botishere=0
addhook("ms100","hook_ms100_botscript")
function hook_ms100_botscript()
     if (#player(0,"table")>=24) then
          if botishere==1 then
               for i=1,#player(0,"table") do
                    if (player(i,"bot")) then
                         parse("kick "..i)
                         botishere=0
                    end
               end
          end
     elseif #player(0,"table")<24 and botishere~=1 then
          bot = parse("bot_add")
          parse("makespec "..bot)
          botishere=1
     end
end

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
HaRe has written
maPmaKer has written
@HaRe:

It is working now but how to add the bot immediatly in the spec mode?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
botishere=0
addhook("ms100","hook_ms100_botscript")
function hook_ms100_botscript()
     if (#player(0,"table")>=24) then
          if botishere==1 then
               for i=1,#player(0,"table") do
                    if (player(i,"bot")) then
                         parse("kick "..i)
                         botishere=0
                    end
               end
          end
     elseif #player(0,"table")<24 and botishere~=1 then
          bot = parse("bot_add")
          parse("makespec "..bot)
          botishere=1
     end
end


No, something is wrong. I mean I tryed the 24 players lua and it just added and kicked the bot every 100 ms.

Then I tryed the lua with the spec mode included. You won't imagine what happend It just added 23 bots and when I was kicking them it just added another bot to replace the kicked one. Omg please fix it so it can work please.

Thanks a lot

old Re: Lua Scripts/Questions/Help

hyh2
COMMUNITY BANNED Off Offline

Quote
GIVING MY CARMOD SCRIPT AWAY! PM ME.
Only for people who have "brains".

Ohh and who can code jail script?
!jail ID then x==1 y==3

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
hyh2 has written
GIVING MY CARMOD SCRIPT AWAY! PM ME.
Only for people who have "brains".

Ohh and who can code jail script?
!jail ID then x==1 y==3


1
2
3
4
5
6
7
8
9
10
11
12
13
jx = 1
jy = 1

addhook("say","jail") function jail(id,t)
	if (string.sub(t,1,1) == "!") then
		if (string.sub(t,3,4) == "jail") then
			local p = string.sub(t,9)
			if (player(p,"exists")) then
				parse("setpos ".p.." "..jx.." "..jy)
			end
		end
	end
end

old Re: Lua Scripts/Questions/Help

beckerchen
User Off Offline

Quote
TDShuft has written
Is There Possible To Find There Player Who Use The Trigger ?
using Hook : Trigger?

mabe if you check the current positions of all players.
like that:
1
2
3
4
for id = 1,32 do
	if player(id,"exist") then
		if player (id,"tilex") == X and player(id,"tiley") == Y then
.........
X and Y would be the tile-coordinates for the position from where a player can trigger.

The only problem would be that if there is another player which didn't triggered, the script would work for him too.

Sry for my terrible english

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
@beckerchen, you have a problem in that, which is why DC conveniently created the Use Hook and the UseButton Hook.

1
2
3
4
usebutton(id,x,y)					on using a button
-id: player id
-x: button x (tiles)
-y: button y (tiles)


1
2
3
4
5
6
use(id,event,data,x,y)					on use
-id: player id
-event: use event (1 h.follow,2 h.stop,3 defuse, 100 tr._use, 150 dyn obj.)
-data: additonal data
-x: use x (tiles) or hostage id
-y: use y (tiles)

old Re: Lua Scripts/Questions/Help

ysjpn
User Off Offline

Quote
Could anyone make me Warn lua script?
something like CT Players(for roleplay server) do !warn then say like "(Name) was Warned by Admin (Name)"
i tried to do but i cant make lua.

old Re: Lua Scripts/Questions/Help

beckerchen
User Off Offline

Quote
ysjpn has written
Could anyone make me Warn lua script?
something like CT Players(for roleplay server) do !warn then say like "(Name) was Warned by Admin (Name)"
i tried to do but i cant make lua.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("say","allsay")
function allsay(id,txt)
	if txt:sub(1,5)  == "!warn" then
		if player(id,"team") == 2 then
			local warned = tonumber(txt:sub(6,7))
			if player(warned,"exists") and id ~= warned then
				msg("©255255255"..player(warned,"name").." was Warned by "..player(id,"name").."!@C")
			elseif id == warned then
				msg2(id,"©255255255You cant warn yourself")
			else
				msg2(id,"©255255255No player with the ID "..warned.." exists")
			end
		else
			msg2(id,"©255255255You are not allowed to warn")
		end
	return 1
	end
end

old Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Quote
i'm having trouble coming up with a script that chooses a random player on a certain team each round, but won't choose a player that has been already chosen on a previous round until all players on the team have been chosen.

eg player saladface (a ct) gets chosen in a round. now saladface won't be chosen again until all CTs get chosen.

could you help?

old Re: Lua Scripts/Questions/Help

Triple H
User Off Offline

Quote
Hi.
Is there any chance to make script like that: After CT or T win sound starts to play. It's will be very helpful for me cause I saw it at 1.6 and Source but I can't find it in 2d. If someone can do it for me I will be grateful.

old Re: Lua Scripts/Questions/Help

Tajifun
User Off Offline

Quote
eg:
1
2
3
4
addhook("endround","myfunctionname")
function myfunctionname(mode)
	msg("ENDROUND") -- change msg with anything you want to have. (sound)
end
To the start Previous 1 2281 282 283338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview