Forum
CS2D Scripts Lua Scripts/Questions/HelpThe thing is - I want to save data for this USGN number in a separate file. I use io.open with parameter "w", and then with "r", but even when I choose to read numbers only, it still doesn't want to read it. What do I do? Or is there any tutorial for this?
1
2
3
4
5
6
2
3
4
5
6
a = io.open("file.txt","w") a:write("asd") a:close() a = io.open("file.txt","r") text = a:read("l") if text=="asd" then print("success")
EDIT:
1
2
3
4
5
6
2
3
4
5
6
a = io.open("sys/lua/data/file.txt","w") a:write("asd") a:close() a = io.open("file.txt","r") text = a:read("l") variable[id]=text
1
2
3
4
5
6
2
3
4
5
6
file = io.open("5.txt","w") file:write(player(5,"money")) file:close() file = io.open("5.txt","r") -- Reopen the file for reading parse("setmoney 5 " .. (file:read("*n")) )--Read the number file:close()
CAN ANYBODY SHOW ME A SCRIPT LIKE THIS PLS PLS??
I am repeating me but there is no answer
PLS answer me and help
ty if you know and tell it me
1
2
3
4
2
3
4
addhook("hit", "hit_") function hit_ (id,source,weapon,hpdmg,apdmg) 	parse("spawnplayer "..id.." 2160 784") end
1
2
3
4
5
6
2
3
4
5
6
addhook("hit","tele") function tele(id,source,weapon) 	if (weapon==3) then 		parse("spawnplayer "..id.." 2160 784") 	end end
1
2
3
4
5
6
2
3
4
5
6
addhook("kill","NoWhereToRun") function NoWhereToRun(killer,victim,weapon,x,y)	 if (weapon==3) then parse("spawnplayer "..victim.." "..x.." "..y) end end
And the forum doesn't trim your tabs and blanks. Did you tab them well in here?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
array = {} addhook("kill","NoWhereToRun") addhook("move", "m") function NoWhereToRun(killer,victim,weapon,x,y) if (weapon==3) then parse("spawnplayer "..victim.." 2160 784") array[victim] = 1 end end function m (id) 	if ( array[id] ~= nil and array[id] == 1 ) then 		parse("spawnplayer "..victim.." 2160 784") 	elseif ( array[id] = nil ) then 		array[id] = 0 	end end
my console says :Lua Error: sys/lua/1.lua:14:')' expected near '='
I am a noob in scripting
so I need a full script
1
2
2
elseif ( array[id] == nil ) then ...
put this to line 14
in IF,ELSEIF
=
==
yeah very
read sys/lua/info.txt and look to sys/lua/samples/...
martis67 has written
i think thats a stupid question but how create lua script?
Create a text file, then Save as... Name.lua
Name can be anything you want. You also have to learn scripting, DRoNe already said where to look.