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 2264 265 266338 339 Next To the start

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Snake_Eater has written
yes


1
2
3
4
5
addhook("say","openfile") function openfile(id,t)
	io.open("sys/lua/dayspeakfile.txt","w")
	io.write(player(id,"name").." said: "..t)
	io.close()
end

hope that helped you enough

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
this just saves 1 thing thats said and just the last 1 dont know how to make that it doesnt overwrite the old ones...

1
2
3
4
5
6
addhook([[say]],[[writesay]])
function writesay(id,txt)
	file = assert(io.open("sys/lua/chat/dayspeak.txt","w"))
	file:write(player(id,"name").." said : "..txt)
	file:close()
end

oops HaRe was faster

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
1
2
3
4
5
6
addhook([[say]],[[writesay]])
function writesay(id,txt)
	file = assert(io.open("sys/lua/chat/dayspeak.txt","a"))
	file:write(player(id,"name").." said : "..txt.."		")
	file:close()
end

now it should work but i cant make sth for the next line,just some sppaces...

old Re: Lua Scripts/Questions/Help

Todesengel
User Off Offline

Quote
1
2
3
4
5
6
addhook([[say]],[[writesay]])
function writesay(id,txt)
     file = assert(io.open("sys/lua/chat/dayspeak.txt","a"))
     file:write(player(id,"name").." said : "..txt.."\n")
     file:close()
end

old Re: Lua Scripts/Questions/Help

sixpack
User Off Offline

Quote
tiiger87 has written
how do you want to modify it? tell me.


I want to make some things like:
!note
When someone types
!note Hi!
It send:
msg("©255255000"..player(id, "name")..": "..text.."@C")
or with more fields...
!note 255255255 Hi!
msg("©"..color.."..player(id, "name")..": "..text.."@C")

etc

Tell me how to make it have
2 fields (one for !command and one to set a variable)
3 fields (one for !command, one for something and one for something else,
4 field
5 fields

Thanks for helping in advance!

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
DaKnOb has written
tiiger87 has written
how do you want to modify it? tell me.


I want to make some things like:
!note
When someone types
!note Hi!
It send:
msg("©255255000"..player(id, "name")..": "..text.."@C")
or with more fields...
!note 255255255 Hi!
msg("©"..color.."..player(id, "name")..": "..text.."@C")

etc

Tell me how to make it have
2 fields (one for !command and one to set a variable)
3 fields (one for !command, one for something and one for something else,
4 field
5 fields

Thanks for helping in advance!


1
2
3
4
5
6
7
8
9
10
11
addhook("say","tsay") function tsay(id,txt)
	if (string.sub(txt,1,5) == "!note") then
		local t1 = string.sub(txt,7,9)
		if t1>0 and t1<9 then
			t2 = string.sub(txt,11)
			msg("©'..t1..'"..player(id,"name")..": "..t2.."@C")
		else
			msg2(id,"Wrong, You need to write !note and 9 numbers. And after that the text")
		end
	end
end

i hope that works

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
how to make it:
1
2
3
4
5
6
addhook("kill","write_kill")
function write_kill(id,victim,wpn)
file = assert(io.open("sys/lua/SERVER.txt","a"))
file:write(player(id,"name").." has killed "..player(victim,"name").." by "..wpn.."\n")
file:close()
end
but with wpn names, no numbers?

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
I need to know. Which is faster?
Both use the next code
1
2
3
function math.factorial (n)
	return n == 0 and 1 or n * factorial(n-1)
end

#1
1
2
3
function sine (x)
	return x - x^3/math.factorial(3) + x^5/math.factorial(5) - x^7/math.factorial(7) + x^9/math.factorial(9) - x^11/math.factorial(11) + x^13/math.factorial(13) - x^15/math.factorial(15) + x^17/math.factorial(17) - x^19/math.factorial(19)
end

#2
1
2
3
4
5
6
7
8
9
function sine (x)
	local x2,sub = x,true
	for i = 3, 19, 2 do
		if ( sub ) then x2 = x2 - x^i/math.factorial(i)
		else x2 = x2 + x^i/math.factorial(i) end
		sub = not sub
	end
	return x2
end

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
Some 1 Help With Tibia RPG
In the houses Config , how i make a house only for me and my friends ?
{pos1 = {155,175}, pos2 = {170,183}, ent = {154,178}, door = {155,179}, price = 100000000000, owner = 22068, endtime = nil, allow = {22588,25280,19571}, doors = {[1] = {22588,25280,19571}}},

isnt workin teh ENDTIME how i make it infinite , like it never end
To the start Previous 1 2264 265 266338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview