
No Posts which offend/provoke/insult other people or groups
Show good behavior and simply don't be a stupid asshole
The forum is NOT a chat room! Behave accordingly! No unsubstantial/very short posts!
If someone needs a script or your a script can't work, We can write it for you.
¦==========
oxytamine ==========¦Problem: I need a dynamic variable to be written to the file. Everytime value changes file should be rewritten. So I need to find something like "onchange" hook.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
onchange = function(txt)
	local filename = 'save.txt'
	local file = io.open('sys/lua/'..filename,'w')
	file:write(txt..'\n')
	file:close()
end
var = false
variable = 'lol :D'
addhook('second','_second')
function _second()
	if variable ~= var then
		onchange(variable)
	end
	var = variable
end
¦==========
HedShot ==========¦Problem: I want to create this script, but it doesn't work!
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
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
cd = {
	admins = {116544,108942}
}
cd.ToTable = function(t,match)
	local cmd = {};
	if not match then match = '[^%s]+' end
	for word in string.gmatch(t,match) do
		table.insert(cmd,word)
	end
	return cmd
end
cd.bug = function(id,txt)
	msg2(id,c..'200000000Unknown command: '..c..'000255255'..txt)
end
cd.noadm = function(id)
	msg2(id,c..'200000000You don't have enough level to do this!')
end
cd.isAdmin = function(id)
	for _, i in pairs(cd.admins) do
		if player(id,'usgn') == i then
			return true
		end
	end
	return false
end
addhook('say','cd.say')
cd.say = function(id,txt)
	local p = cd.ToTable(txt)
	local cmd = string.lower(p[1])
	if txt:sub(1,1) == '!' and txt ~= 'rank' then
		if cmd == '!explosion' then
			if cd.isAdmin(id) then
				local range = tonumber(p[2])
				if range ~= nil then
					parse('explosion '..player(id,'x')..' '..player(id,'y')..' '..range)
				else
					msg2(id,c..'200000000Correct syntax: !explosion <range>')
				end
			else
				cd.noadm(id)
			end
		else
			cd.bug(id,txt)
		end
		return 1
	end
end
edited 8×, last 29.03.13 08:53:34 am
Script support
1 
Offline