Forum

> > CS2D > Scripts > I want to make a roleplay chat.
Forums overviewCS2D overview Scripts overviewLog in to reply

English I want to make a roleplay chat.

9 replies
To the start Previous 1 Next To the start

old I want to make a roleplay chat.

ZaibatsuTEAM
User Off Offline

Quote
Well, since I'm not one of the best scripters in this world, I would like to ask if someone can make a roleplay-like chat for cs2d.

now, what i mean is, for example, If you type normally, you will only be heard by players in range. if you type /y which is yell, you will be heard from longer distances. if you type // which is OOC, everyone can hear you. etc etc..

Can someone help me with this? It would be very appreciated. Thanks

old Re: I want to make a roleplay chat.

Talented Doge
User Off Offline

Quote
I've got this from user _oops:

1
2
3
4
5
6
7
function sv_sound3(file,x,y,radius)
	for _, id in pairs(player(0,"table")) do
		if math.sqrt((x-player(id,"x"))^2 + (y-player(id,"y"))^2) < radius then
			parse("sv_sound2 "..id.." "..file)
		end
	end
end

Take it and extend it to usage for your script.

old uhm

ZaibatsuTEAM
User Off Offline

Quote
@user Talented Doge: Thanks but this is sv_sound2? uhm.. lol i wanted it to be chat. i did try and convert it to chat but didn't work too well.

1
2
3
4
5
6
7
8
addhook("say","chatshit")
function chatshit(txt,x,y,radius)
     for _, id in pairs(player(0,"table")) do
          if math.sqrt((x-player(id,"x"))^2 + (y-player(id,"y"))^2) < radius then
		msg("©255255255"..player(id,"name")..": "..txt)
          end
     end
end

old Re: I want to make a roleplay chat.

Talented Doge
User Off Offline

Quote
For example, normal chat:

1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("say", "_say")

function _say(p, t)
     if t:sub(1, 2) ~= "-y" and t:sub(1, 2) ~= "-w" then msg3(p, t, player(p, "x"), player(p, "y"), 320) return 1 end
end

function msg3(p, t, x, y, radius)
     for _, id in pairs(player(0,"table")) do
          if math.sqrt((x-player(id,"x"))^2 + (y-player(id,"y"))^2) < radius then
               msg2(id, player(p, "name")..": "..t)
          end
     end
end

It should work now.
edited 2×, last 19.08.15 09:40:33 pm

old Re: I want to make a roleplay chat.

Ajmin
User Off Offline

Quote
Learn with ur mistake!
The only error i found is the msg command

1
2
3
4
5
6
7
8
addhook("say","chatshit")
function chatshit(txt,x,y,radius)
     for _, id in pairs(player(0, TABLE")) do
          if math.sqrt((x-player(id,"x"))^2 + (y-player(id,"y"))^2) < radius then
          msg("©255255255"..player(id,"name")..": "..txt) -- this msg command should be changed to msg2 that is : msg2(id,"©255255255"..player(id,"name")..": "..txt)
          end
     end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview