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 2268 269 270338 339 Next To the start

old Re: Lua Scripts/Questions/Help

SkullFace
User Off Offline

Quote
i need help here ... since i putted this in my script it didnt worked ... i asked my friend hare but no response ...
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
if (x == 38 and y == 9) then
		if (player(id,"money")>2999) then
			parse("setmoney "..id.." "..(player(id,"money") - 3000))
			local c=math.random(1,13)==1 then
			if c==1 then
			parse("drop; drop; drop")
			parse("equip "..id.." 22")
			if c==2 then
			parse("drop; drop; drop")
			parse("equip "..id.." 22")
			if c==3 then
			parse("drop; drop; drop")
			parse("equip "..id.." 20")
			if c==4 then
			parse("drop; drop; drop")
			parse("equip "..id.." 20")
			if c==5 then
			parse("drop; drop; drop")
			parse("equip "..id.." 20")
			if c==6 then
			parse("drop; drop; drop")
			parse("equip "..id.." 10")
			if c==7 then
			parse("drop; drop; drop")
			parse("equip "..id.." 10")
			if c==8 then
			parse("drop; drop; drop")
			parse("equip "..id.." 31")
			if c==9 then
			parse("drop; drop; drop")
			parse("equip "..id.." 31")
			if c==10 then
			parse("drop; drop; drop")
			parse("equip "..id.." 47")
			if c==11 then
			parse("drop; drop; drop")
			parse("equip "..id.." 46")
			if c==12 then
			parse("drop; drop; drop")
			parse("equip "..id.." 40")
			if c==13 then
			parse("drop; drop; drop")
			parse("equip "..id.." 54")
		end
	end

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
I wanted to make something useful for scripting.
I don't know if someone want to use it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function WriteText(file,text)
	local L = ""
	local f = io.open(file,"r")
	if f then
		for line in f:lines() do
			if L ~= "" then
				line = "\n"..line
			end
			L = L .. line
		end
		L = L .. text
		local file_dir = assert(io.open(file,"w"))
		file_dir:write(L)
		file_dir:close()
		return true
	end
	return false
end

If you wanna write a new line in the file, the text is this:
"\nYOURMESSAGEHERE", the "\n" is used to make new lines.

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
can some one help me ?
i need like to send messages only if:
owner(id)=="true"
like i want just owners can hear the msg...
;
also i need like if nightvision turned on can see a img
please help :S
//edit : I Already have the array --' , i need the script that just owners can hear a msg

oh and the night vision thing I want too --'
edited 3×, last 30.09.10 06:16:17 pm

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
you have to use an array for owner
and then just make
if owner[id]==true then
...
end
edited 2×, last 30.09.10 07:29:34 pm

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
RyceR has written
Its possible to make wall hack lua?
if yes, make for me plz


wall hack for what, To shoot and that shit?? well yes it's possible...

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
batlaizys has written
At RyceR : look in cs2d file archive there is wall hack

there isnt wallhack only "scripts" ,
and in cs2d file archive wall hacks are "noclips"

is there how to find player armor id ?
edited 1×, last 30.09.10 06:38:43 pm

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
Hi all

why my computer hangs at this script...

1
2
3
4
5
6
7
8
addhook ("spawn","getteleported")
function getteleported(p)
repeat
local x = math.random(1,map("xsize"))
local y = math.random(1,map("ysize"))
until tile(((x/32)+16),((y/32)+16),"walkable")
parse ("setpos "..p.." "..x.." "..y)
end

pls help

old Re: Lua Scripts/Questions/Help

Blocker
User Off Offline

Quote
your problem on here
1
until tile(((x/32)+16),((y/32)+16),"walkable")
map("xsize") give u tile so not need division

i think u use small map and wall on position (0|0)
lua try to find free area in wall

and math.random not give u random number without randomseed

here fixed code
1
2
3
4
5
6
7
8
9
10
11
12
13
math.randomseed(os.time())

addhook ("spawn","getteleported")
function getteleported(p)
	local x,y = 0,0,0 
	repeat
		x = math.random(1,map("xsize"))
		y = math.random(1,map("ysize"))
	until tile(x,y,"walkable")
	x = x*32
	y = y*32
	parse ("setpos "..p.." "..x.." "..y)
end
edited 2×, last 30.09.10 09:35:18 pm

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
Look now I have this version (works perfect) but I haven't used the math.randomseed

1
2
3
4
5
6
7
8
9
10
11
addhook ("spawn","getteleported")
function getteleported(p)
local x,y = nil,nil
repeat
x = math.random(0,map("xsize"))
y = math.random(0,map("ysize"))
until tile(x,y,"walkable")
x = ((x*32)+16)
y = ((y*32)+16)
parse ("setpos "..p.." "..x.." "..y)
end

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Hello could some1 tell me how to make such thing ?

If player goes to tilex :56 and tiley :56 he gets 150 health and image on him and 30 speed.

Thank you for your help (if there is any)
To the start Previous 1 2268 269 270338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview