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 2166 167 168338 339 Next To the start

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Blazzingxx has written
I found some mistakes with strings:
1
2
3
function time_hud(id)
	parse('hudtxt2 '..id..' 1 "©255220000Time:'..tc.mins..' :'..tc.secs..'" 320 240')
end
You should place your hud function in any hook...
Haven't you noticed that you aren't using your hudtxt function?


I don't have any bugs now? ...
I still don't see this hud, let it, i don't want hassle you...

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
C'mon...
Okay, I noticed that you aren't using table index.
Fixed, now you can see at least something on hud.

Spoiler >

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Now i see him thx ...
But how i do this if i want use tcstart and it trigger's this timercounter and if i use tcstop then timercounter will be stopped ...

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
When & how do you wanna trigger it?
Use say command? !counter
On certain tile position or serveraction?

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Blazzingxx has written
When & how do you wanna trigger it?
Use say command? !counter
On certain tile position or serveraction?


On certain tile position(button) x==75 y==79

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Now you can turn off/on it with [F2] button. (first serveraction)
I think you know how to add "if player tile x and y..", that's up to you.
Spoiler >

old Re: Lua Scripts/Questions/Help

LV
BANNED Off Offline

Quote
Some one make for me when only id 1 player can join terorists.. and others can't

Who tell me will get this PowerFull Cookie!cookie
f you eat it you will have Super Powers
edited 2×, last 19.02.10 03:26:39 pm

Admin/mod comment

Deleted that "[b ]" shit. /TheKilledDeath

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
LV has written
Some one make for me when only id 1 player can join terorists.. and others can't

Who tell me will get this PowerFull Cookie!cookie
if you eat it you will have Super Powers


U want it to deathrun?
edited 2×, last 19.02.10 04:49:00 pm

old Re: Lua Scripts/Questions/Help

LV
BANNED Off Offline

Quote
No not on deathrun but on Team Deathmatch.. i make dedicated and bot is id 1 so he be only terorist + he will have super armor and 250 hp hard to kill
edited 2×, last 19.02.10 05:04:41 pm

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
LV has written
No not on deathrun but on Team Deathmatch.. i make dedicated and bot is id 1 so he be only zombie + he will have super armor and 250 hp hard to kill


Sry, i can't help you, here are better scripters, maybe they help you

old Re: Lua Scripts/Questions/Help

- Dark Void -
User Off Offline

Quote
you must say !reset_t to reset when there are no terrorists.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook("team", "t_team")

allow_t=true

function t_team(id, team)
	if ( allow_t ) then
		if ( team == 1 ) then
			allow_t=false
		end
	else
		if ( team == 1 ) then
			parse("make_ct "..id)
		end
	end
end

addhook("say", "t_say")
function t_say(id, txt)
	if ( txt == "!reset_t" ) then
		allow_t=true
	end
end

old Re: Lua Scripts/Questions/Help

Decks
User Off Offline

Quote
i need help with options sv_specmode
can we create a lua scrypt that spectators have sv_specmode 1 but players(terro and CT) when die got sv_specmode 0 and see anything(black screen)?

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Hi. I want to make a script that clears a table if the player changes team.

Here is the code i got for now.
1
2
3
4
5
6
7
8
9
10
savex={}
savey={}

addhook("team","akd_setpos_script_team")
function akd_hud_pp_save_team(id)
	if not (savex[id]=="") or not (savex[id]==nil) or not (savex[id]=={}) then
		savex[id]=nil
		savey[id]=nil
	end
end
The problem is that it gives me the "LUA ERROR: attempt to call a nil value". How do i fix this?

Ps. I only want the script to make the save-x and -y nil if the player switched from T to CT or from CT to T..
team(id, team, look) - What does the "look" function in the team-hook?
And is the "team" the team before the change or after?

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
@Anders4000

I really don't understand what you want to do now, but I fix only a simple table

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

savex = initArray(32)
savey= initArray(32)

addhook("team","akd_setpos_script_team")
function akd_hud_pp_save_team(id)
	if not (savex[id]=="") or not (savex[id]==nil) or not (savex[id]=={}) then
		savex[id]=nil
		savey[id]=nil
	end
end

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Admirdee has written
@Anders4000

I really don't understand what you want to do now, but I fix only a simple table

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

savex = initArray(32)
savey= initArray(32)

addhook("team","akd_setpos_script_team")
function akd_hud_pp_save_team(id)
	if not (savex[id]=="") or not (savex[id]==nil) or not (savex[id]=={}) then
		savex[id]=nil
		savey[id]=nil
	end
end


I'll try it, thanks (;
...I just don't know what the initarray does..

old Hmmmmm

CoolioG
User Off Offline

Quote
This is my current lua. CS2d won't load it. It says "attempt to index field "ut" nil value". I don't understand... what can I change so cs2d will load my lua? *Note: This is not exactly MY lua its just a bunch of diffrent scripts made by diffrent people that i'm going to use in my server.

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
--------------------------------------------------
-- Simple Advertising by Unreal Software        --
-- 22.02.2009 - www.UnrealSoftware.de           --
--------------------------------------------------

if sample==nil then sample={} end
sample.ads={}

--------------------------------------
-- WELCOME MESSAGE ON JOIN          --
--------------------------------------
addhook("join","sample.ads.join")
function sample.ads.join(p,t)
	msg2(p,"Welcome on my Server, "..player(p,"name").."!")
end


--------------------------------------
-- ADVERTISING EVERY MINUTE         --
--------------------------------------
addhook("minute","sample.ads.minute")
function sample.ads.minute()
	msg("This server may close")
	msg("unexpectedly.")
	msg("Listen to admins!")
	msg("Say !help for help.")

end


--------------------------------------
-- Need Help?         --
--------------------------------------
-- Say !help
addhook("say","help")
function help(id,txt)
	if(txt=="!help") then
	msg("Help:")
	msg("!drop 100 -- Drops 100 dollars")
	end
end


-----------------------
-- Fast Build -------
-----------------------
--[[
Made by teh Unrealsoftware.de User "Heavy"
Rule no 1: Do what ever you want with this script. But dont claim this as your own!

» Changelog:
[ADDED] disabling/enabling money
[FIXED] mines didn't work
[FIXED] building sometimes didn't work (if this still doesn't work ,try disabling other buildingluascripts)
[FIXED] you weren't able to see whose building it is/was
[CHANGED] code cleaned up a bit


ENABLE/DISABLE Stuff (Note: 1 means enabled and 0 means disabled ]]
fastbuild=1
unlimitedbuild=1
money=1


-- FastBuild:

addhook("build","fb")
    function fb(id,type,x,y)

		function spawnobject()		
			parse("spawnobject "..type.." "..x.." "..y.." 0 0 "..player(id,"team").." "..id);
		end

		function checkmoney(mmoney)
			if(money==1) then
				parse("setmoney "..id.." "..player(id,"money")-mmoney);
			end
		end

        if (fastbuild==1) then
			if(type==1) and (player(id,"money")>=300) then
				spawnobject()
				checkmoney(300)
			elseif(type==2) and (player(id,"money")>=500) then
				spawnobject()
				checkmoney(500)
			elseif(type==3) and (player(id,"money")>=1000) then
				spawnobject()
				checkmoney(1000)
			elseif(type==4) and (player(id,"money")>=2000) then
				spawnobject()
				checkmoney(2000)
			elseif(type==5) and (player(id,"money")>=3000) then
				spawnobject()
				checkmoney(3000)
			elseif(type==6) and (player(id,"money")>=1500) then
				spawnobject()
				checkmoney(1500)
			elseif(type==7) and (player(id,"money")>=5000) then
				spawnobject()
				checkmoney(5000)
			elseif(type==8) and (player(id,"money")>=5000) then
				spawnobject()
				checkmoney(5000)
			elseif(type==9) and (player(id,"money")>=5000) then
				spawnobject()
				checkmoney(5000)
			elseif(type==13) and (player(id,"money")>=3000) then
				spawnobject()
				checkmoney(3000)
			elseif(type==14) and (player(id,"money")>=3000) then
				spawnobject()
				checkmoney(5000)
			elseif(type==20) then -- Mines...
				spawnobject()
			end
            return 1
		else
			return 0
        end
    end

-- UnlimitedBuild:

if (unlimitedbuild==1) then
    parse('mp_building_limit "Barricade" 10000');
    parse('mp_building_limit "Barbed Wire" 10000');
    parse('mp_building_limit "Wall I" 10000');
    parse('mp_building_limit "Wall II" 10000');
    parse('mp_building_limit "Wall III" 10000');
    parse('mp_building_limit "Gate Field" 10000');
    parse('mp_building_limit "Turret" 10000');
    parse('mp_building_limit "Dispenser" 10000');
    parse('mp_building_limit "Supply" 10000');
    parse('mp_building_limit "Teleporter Entrance" 10000');
    parse('mp_building_limit "Teleporter Exit" 10000');
end


-----------------------
-- Dropping Cash -------
-----------------------
addhook("say","say_drop")
function say_drop(id,txt)
	if (txt=="!dropC") or (txt=="!dropc") then
		if (player(id,"money")>99) then
		parse("spawnitem 66 "..player(id,"tilex").." "..player(id,"tiley").."")
		parse("setmoney "..id.." "..player(id,"money")-100)
		end
	end
	if (txt=="!dropM") or (txt=="!dropm") then
		if (player(id,"money")>499) then
		parse("spawnitem 67 "..player(id,"tilex").." "..player(id,"tiley").."")
		parse("setmoney "..id.." "..player(id,"money")-500)
		end
	end
	if (txt=="!dropG") or (txt=="!dropg") then
		if (player(id,"money")>999) then
		parse("spawnitem 68 "..player(id,"tilex").." "..player(id,"tiley").."")
		parse("setmoney "..id.." "..player(id,"money")-1000)
		end
	end
end
To the start Previous 1 2166 167 168338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview