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 2240 241 242338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Evool
User Off Offline

Quote
Fehuziom has written
@Evool:

1
2
3
4
5
6
7
8
9
addhook("usebutton","use")
function use(id,x,y)

	if (x==X POSITION) and (y==Y POSITION) then
		if player(id,"usgn")==USGN PLAYER then
			parse("trigger DOOR NAME")
		end
	end
end

I dont test this you must write only x and y position , usgn , and door name...


It doesnt work What is bad? I tried all. Please help me, that script is very important for me and my clan.

old Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

Quote
Evool has written
Fehuziom has written
@Evool:

1
2
3
4
5
6
7
8
9
addhook("usebutton","use")
function use(id,x,y)

	if (x==X POSITION) and (y==Y POSITION) then
		if player(id,"usgn")==USGN PLAYER then
			parse("trigger DOOR NAME")
		end
	end
end

I dont test this you must write only x and y position , usgn , and door name...


It doesnt work What is bad? I tried all. Please help me, that script is very important for me and my clan.

show me error, i in phone already...

old Re: Lua Scripts/Questions/Help

Tenaika
User Off Offline

Quote
Alright, got a new problem...
"attempt to index global 'agility' (a number value)".

Part of the code:
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
if sample==nil then sample={} end
sample.sur={}

function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

agility=initArray(1000)
health=initArray(1000)
crafting=initArray(1000)
agility = 0
health = 0
crafting = 0

addhook("serveraction","actions")
addhook("menu", "menus")
function actions(id,sact)
	if(sact == 2) then
		menu(id, "Skills Menu, +1 ROFLPWN, +1 Agility, +1 Health, +1 Crafting")
	end
end

function menus(id, title, button)
	if (title=="Skills Menu") then
		if(button==1) then
		end
		if(button==2) then
			if (points[id]>=1) then
				agility[id]=agility[id]+1
				points[id]=points[id]-1
			else
			msg2(id,"You don't have enough Skill Points!")
			end
		end
		if(button==3) then
		end
		if(button==4) then
		end
	end
end

addhook("join","updatehud")
function updatehud(id)
	for id=1,32 do
		if player(id,"exists") then
			parse('hudtxt2 '..id..' 1 "©255255255Skills Points:  '..points[id]..'" 17 210')
		end
	end
end

addhook("spawn","start")
function start(id)
	for id=1,32 do
		if player(id,"exists") then
			points[id]=points[id]+3
			updatehud(id)
		end
	end
end

Please note that I am novice at Lua.
Thanks for the help in advance!

old Re: Lua Scripts/Questions/Help

Evool
User Off Offline

Quote
Fehuziom, sorry, script work! Its my bug...

Admin/mod comment

pl removed. english and german only please. other languages are not tolerated in any way! /DC

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
ok.
Dynwall name: bosskilled
npc name: bosscreate, don't spawn in the start

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("trigger","npccreated")
addhook("objectkill","npckilled")

function npccreated(name)
	local ot
	if name=="bosscreate" then
		ot=object(0,"table")
		bossid=#ot
	end
end

function npckilled(id)
	if id==bossid then
		parse("trigger \"bosskilled\"")
	end
end

old Re: Lua Scripts/Questions/Help

murilogc
User Off Offline

Quote
@beckerchen has written:
so you want that the player (if hes a medic / hotelowner ) gets telepotet to a point medics/hotelowners?
Then i need the xtile and the ytyle for the special places. MEDIC 456 346 HOTEL 784 235.


@beckerchen has written:
You Don't want a command !goshop ??


no , because have 6 shops , but shop owners , win 5k and one weapon if 5 , 5 min , and msg YOU WIN ONE WEAPON and shopowners , can drop armors , if txt !droparmor .




@beckerchen as written:
how long should a day go? ~5minutes?

YES

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
hey there, I got a problem with this code, somehow it's not working, I can't understand it...

1
2
3
4
5
6
7
8
addhook("say","say_commands")
function say_commands(id,txt)
          if(!kick==string.sub(txt,1,5))then
          tt=tonumber(string.sub(txt,6,7))
               parse("kick "tt)
          end
     end
end

Would be great if someone could help me.

In fact, the Error is at line 3 - he doesn't expect "!"...
edited 1×, last 27.08.10 12:52:50 pm
To the start Previous 1 2240 241 242338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview