Forum

> > CS2D > Scripts > lua request
Forums overviewCS2D overview Scripts overviewLog in to reply

English lua request

28 replies
Page
To the start Previous 1 2 Next To the start

old lua request

loldlold123
User Off Offline

Quote
i wanted to make that but couldnt find how to,lemme show you what im trying to make

(i just dont know how im gonna call that threat so i wrote lua request to title)

Player wrote something
his writing > goes to table or etc i cant know how you gonna do that>txt file>lua which reads what is in txt file >it shows up his writings 1 sec later

just dont tell me that why you want that meaningless thing,if i can get lua which is something like that im gonna make something...

old Re: lua request

Avo
User Off Offline

Quote
Dafuq? I think you used translator...

Thing of you are talking about is useless.

old Re: lua request

loldlold123
User Off Offline

Quote
ok ok i already knew you guys would think this is useless but i'll tell you what im gonna do,im gonna make general chat for 5 servers... so i'll need that piece of code that will write Players writings to txt and other server's piece of code that will read it and show up in that server get it?

old Re: lua request

Yates
Reviewer Off Offline

Quote
We never said it was useless, I was already planning to make this. Problem is, I do not know how the Lua will open a file in a completely different CS2D folder.

old Re: lua request

Avo
User Off Offline

Quote
If you want it you need all 5 servers on the same machine (easiest method). BTW, it's quite easy.

@user Yates: Did you read "ReadMe.txt" file?

ReadMe >

-sys PATH (Use alternative "sys"-folder for settings)
-path PATH (Use alternative working directory)**
edited 1×, last 05.07.12 01:09:59 pm

old Re: lua request

Jynxxx
User Off Offline

Quote
So when a player says something in the server it saves it to a text file?

old Re: lua request

loldlold123
User Off Offline

Quote
just can anyone write code that will write player's writings to txt file and the other code which shows up his writings?

old Re: lua request

Yates
Reviewer Off Offline

Quote
user Avo has written
@user Yates: Did you read "ReadMe.txt" file?

Do you read the "Terms of use" when you agree to something? - I don't think so ;P

Thanks, this should help.

old Re: lua request

Jynxxx
User Off Offline

Quote
user loldlold123 has written
just can anyone write code that will write player's writings to txt file and the other code which shows up his writings?


Still not understanding what your saying, use proper english.
edited 1×, last 05.07.12 01:25:01 pm

old Re: lua request

Yates
Reviewer Off Offline

Quote
user loldlold123 has written
and im still loooking for code

I will try and make one for the both of us, you can edit if it even gets completed

user loldlold123 has written
btw @user Yates: why your mode is idiot?

Well, it would make more sense to call the mode "Asshole" instead as only me and eXploits have it. But I posted in a random thread "Inb4 anyone cares" and got this mode.

user Jynxxx has written
'Sill not understanding what your saying, use proper english.

When a player says something it gets written down in a text file and then it gets read so it can be used in the chat on many servers.

Correct me if I'm wrong, HeaDHunTeR.

old Re: lua request

loldlold123
User Off Offline

Quote
@user Jynxxx:
look i'll tell you step by step
Player joined to game
Player wrote something
LUA:save what he written to asd.txt
Lua:load what he written to asd.txt
Lua:shows up what he written to asd.txt


@user Yates: totally right...

btw would it make server laggy?,but fu** it we would see that when script is done...
edited 2×, last 05.07.12 01:29:51 pm

old Re: lua request

Avo
User Off Offline

Quote
@user loldlold123: It's easy, 'cause he's an idiot, but it doesn't mean he's an idiot in real life. I want to meet user Yates .
Wait, I'm working with script for you. Easiest way is to run all 5 servers from the same directory. (same pc/server)

old Re: lua request

Jynxxx
User Off Offline

Quote
So let me get this straight, he wants a lua that saves the text in which the player says in the server to a .txt file then opens it up into another server?
Example:

Player: Hello.
Saving to servertxt.txt file.
Opening text file in all servers.
Player from Server #1 says: Hello.

Something like this?

old Re: lua request

EngiN33R
Moderator Off Offline

Quote
You most likely want to make a shared chat between different servers, as user Jynxxx said.

Receiving module:
1
2
3
4
5
6
7
8
9
10
11
addhook("say","savetext")
function savetext(id,t)
	local f=assert(io.open("/root/cs2d/chat.txt","r")) --change the address, just a placeholder
	local txt=f:read()
	f:close()
	f=assert(io.open("/root/cs2d/chat.txt","w"))
	f:write("["..game("sv_name").."] "..player(id,"name")..": "..t.."\n"..txt)
	f:close()
	f=nil
	txt=nil
end

Writing module:
1
2
3
4
5
6
7
8
9
10
11
lastline=""

addhook("second","parsemessages")
function parsemessages()
	local f=assert(io.open("/root/cs2d/chat.txt"))
	local txt=f:read("*line")
	if txt~=lastline then
		msg(txt)
		lastline=txt
	end
end

I can't really come up with a better solution at the moment, if someone can - please do share.

old Re: lua request

Alistaire
User Off Offline

Quote
He wants multi-server chat. Just don't read OP's post, THIS is his real question.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview