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 2309 310 311338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Smuckie
User Off Offline

Quote
Does anyone have a football lua like the one in Blocker's old CityLife? I'd really like to add it to my map since I made a football field.

Or can some one please re-make it for me? It is a small game of football where when you throw a snowball at a goal it adds to your team, and you can be either red team or blue team with a glow around you where you pick which team you are using a "use" entity?

old Re: Lua Scripts/Questions/Help

FlooD
GAME BANNED Off Offline

Quote
something to disable dropping:

1
2
3
4
addhook("drop","ondrop")
function ondrop(id,iid)
	parse("removeitem "..iid)
end
this doesn't work

1
2
3
4
addhook("drop","ondrop")
function ondrop(id,iid)
	timer(0,"parse","removeitem "..iid)
end
this works

o.O
i assume this means the timer has a small delay even if u set it at 0

old Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Quote
Fonduta has written
Also, I would like a LUA script that makes it impossible for items/weapons/etc to delete on certain squares or tiles.

(btw I'm boX lol)
This is all in tiles. (duh)
1
2
3
4
5
6
addhook("drop","nofadetiles")
function nofadetiles(id,iid,type,ain,a,mode,x,y)
	if x==yourx and y==youry then
		return 2
	end
end
or for tiletype
1
2
3
4
5
6
addhook("drop","nofadetiles")
function nofadetiles(id,iid,type,ain,a,mode,x,y)
	if (tile(yourx,youry,"frame"))==tile# then
		return 2
	end
end

I probably made an error, but I tried.

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Fonduta has written
Also, I would like a LUA script that makes it impossible for items/weapons/etc to delete on certain squares or tiles.


What you mean? when you drop it?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("drop","dropit") function dropit(id,iid,type)
	if type==50 then
		-- This wont allowed the player to drop the knife
	else
		if game("sv_gamemode") == 3 then
			if type==74 then
				-- This wont allowed the player to drop the wrench in con game mode
			else
				parse("strip "..id.." "..type)
				parse("spawnitem "..type.." "..player(id,"tilex").." "..player(id,"tiley"))
				return 1
			end
		else
			parse("strip "..id.." "..type)
			parse("spawnitem "..type.." "..player(id,"tilex").." "..player(id,"tiley"))
			return 1
		end
	end
end

or else u can just do this simple shit xd

1
2
3
addhook("drop","dropit") function dropit()
	return 2
end

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
why it dont work?
1
2
3
4
5
6
7
8
9
10
11
12
addhook("parse","save_parse")
function save_parse(id,cmd)
	_msg=totable(cmd)
	_t1=tostring(_msg[1])
	if _t1 == "give_exp" then
		_t1=tonumber(_msg[2])
		_t2=tonumber(_msg[3])
		exp[_t2]=exp[_t2]+_t3
		msg2(_t2,"©000255000You get [_t3] exp from admin!")
		msg2(id,"©000255000You give "..player(_t2,"name").." [_t3] exp!")
	end
end

old Re: Lua Scripts/Questions/Help

Banaan
User Off Offline

Quote
byengul has written
1
2
3
4
5
parse("mp_building_limit "Supply" 0")

and

parse("mp_building_limit \"Supply\" 0")

not works


Lua isn't even needed for this. Just open your console and enter the (rcon) command
1
mp_building_limit "supply" 0
cs2d cmd mp_building_limit

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Banaan has written
byengul has written
1
2
3
4
5
parse("mp_building_limit "Supply" 0")

and

parse("mp_building_limit \"Supply\" 0")

not works


Lua isn't even needed for this. Just open your console and enter the (rcon) command
1
mp_building_limit "supply" 0
cs2d cmd mp_building_limit


or to make it for ever then just go to

Cs2dfolder->sys->server.cfg

and put that code banaan wrote

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
RyceR has written
why it dont work?
1
2
3
4
5
6
7
8
9
10
11
12
addhook("parse","save_parse")
function save_parse(id,cmd)
	_msg=totable(cmd)
	_t1=tostring(_msg[1])
	if _t1 == "give_exp" then
		_t1=tonumber(_msg[2])
		_t2=tonumber(_msg[3])
		exp[_t2]=exp[_t2]+_t3
		msg2(_t2,"©000255000You get [_t3] exp from admin!")
		msg2(id,"©000255000You give "..player(_t2,"name").." [_t3] exp!")
	end
end


1
2
3
4
5
6
7
8
9
10
11
12
addhook("parse","save_parse")
function save_parse(id,cmd)
	_msg=totable(cmd)
	_t1=tostring(_msg[1])
	if _t1 == "give_exp" then
		_t1=tonumber(_msg[2])
		_t2=tonumber(_msg[3])
		exp[_t2]=exp[_t2]+_t3
		msg2(_t2,"©000255000You get ".._t3.." exp from admin!")
		msg2(id,"©000255000You give "..player(_t2,"name").." ".._t3.." exp!")
	end
end

old Re: Lua Scripts/Questions/Help

Glix
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
addhook("say","tele")
function tele(id,txt,b)
if txt == "!menu" then
menu(id,"Special Menu,Vip,Vodka")
return 1
end
if string.sub(txt,1,10) == "6sg3losa" then
local bt = string.sub(txt,12)
msg("©000255000"..player(id,"name").."(V.I.P): "..bt.."@C")
return 1
end
end
addhook("menu","menu")
function menu(id,t,b)
if t=="Special Menu" then
if b==1 then
parse("sv_msg2 "..id.." You are now on Vip Room")
parse("setpos "..id.." 2694 2118")
parse("equip "..id.." 88")
parse("equip "..id.." 6")
parse("equip "..id.." 45")
parse("speedmod "..id.." 50")
parse("setmaxhealth "..id.." 150")
elseif b==2 then
parse("sv_msg2 "..id.." You have drinked Vodka")
parse("shake "..id.." 1000")
parse("sethealth "..id.." 80")
elseif b==3 then
msg2(id,"Pls say 6sglosa and then your txt.@C")
end
end
end

help me
help me

old Re: Lua Scripts/Questions/Help

Kurumi
User Off Offline

Quote
Give me those scripts plz:
1) give fiveseven, kevlar n helmet only for ct's.
2)no weapons for t's
3)no buying
4)start msg only for current team

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
kato999 has written
Give me those scripts plz:
1) give fiveseven, kevlar n helmet only for ct's.
2)no weapons for t's
3)no buying
4)start msg only for current team


Well, i could make such script. But i will not.
You could at least try on your own, and then post your errors...

But let me give you some hints:
1, Use the parse("equip "..id.." "..iid) function here. (I think it's the id before iid. Check that in the info.txt file in the Sys/Lua folder for that.)
2, Use the parse("strip "..id.." "..iid) function here.
3, You should make that in the Editor. It's much easier.
4, Look in the Samples folder, in the Sys/Lua folder. There should be a script sending a msg to all players. It shouldn't be that hard to make an if statement and a loop to see if it's a T or a CT.

Ps. Do you even know anything about scripting?
- Anders4000

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Anyone know what's wrong with this? (:

Here is your script Kato!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("startround","OnStartRound")
function OnStartRound()
	for i = 1, game("sv_maxplayers") do
		if player(i,"exists") then				--If the player i exist
			if player(i,"team")==1 then		--If player is T
				parse("strip "..i.." 2")		--Strip Glock
			elseif player(i,"team")==2 then		--If player is CT
				parse("strip "..i.." 1")		--Strip USP
				parse("equip "..i.." 58")		--Equip Kelver and Helmet
				parse("equip "..i.." 6")		--Equip Five-Seven
			end
		end
	end
end

You should open the map that you want to play on your server. Then make the entity called "NoBuying" place in anywhere on the map, save it as Thename2, and then start the new map you created. That's how to make NoBuying.

Go to the "C:\Program Files\Counterstrike2D\sys\lua\server.lua" file and type:
1
dofile("sys/lua/Kato999.lua")
(if the name of the file is Kato999.lua.)
Remember to make that file and save it in the lua folder.

Hope it works (:
- Anders4000
edited 1×, last 16.11.10 09:24:13 pm

old Re: Lua Scripts/Questions/Help

kNedLiik
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("spawn"equip")
function equip(id)
	if (player(id,"team") == 1) then
		parse("strip "..id.." 2")
	elseif (player(id,"team") == 2) then
		parse("strip "..id.." 2")
		parse("equip "..id.." 58")
		parse("equip "..id.." 6")
	end
end

I can help you kato just add me at skype.
To the start Previous 1 2309 310 311338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview