Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google Log In with Steam Sign In
  • Create Account
Photo

sound length playback

sound length playback

  • Please log in to reply
10 replies to this topic

#1
OFFLINE   jaszpol

jaszpol

    Member

  • Members
  • PipPip
  • 45 posts
2
A step in the right direction
Hi,
I would like to know whether it can be set to not flying two sounds at once on the server. Currently, he sits a few players on the server, and each player has to let go of it soudnpacka all overlap each other. Is it possible to make so that when you turn on the second musician to stop the first one to go? ;>


#2
OFFLINE   TheSilencerPL

TheSilencerPL

    Advanced Member

  • Management
  • PipPipPipPip
  • 3099 posts
216
On the road to fame
  • LocationPoland

jaszpol is asking whether it is possible to not allow to play V-sounds at the same time.



#3
OFFLINE   TheSilencerPL

TheSilencerPL

    Advanced Member

  • Management
  • PipPipPipPip
  • 3099 posts
216
On the road to fame
  • LocationPoland

There is no such setting at the moment.

However what comes to my mind is something like this:

 

  • we could make a cvar to enable time interval between certain type of sounds
  • we could create/add the keyword to mark sounds with it in the .voice or .sounds files, e.g. nonparallel or something easier to spell :)
  • if sound marked like this would be played it would be played only if the defined interval was ended.

 

This would require admins to modify the sound files again, but would allow them to have this restriction only for certain type of sounds, for example music.

 

 

Or we could use already existing keywords. Usually new sounds added in the soundpacks by admins don't have any keywords attached to the sound definition, while original voice chat messages have them, for example: "voice" keyword.

So we could apply the interval restriction only to the sounds that do not have the "voice" keyword defined.



#4
OFFLINE   JvIasterMind

JvIasterMind

    Regular Member

  • Members
  • PipPipPip
  • 116 posts
8
A step in the right direction

This sounds like an interesting idea!

 

I don't know much about those .voice and .sound files. I think it would be best to keep the configuration for server admins as simple as possible, which means to use the keywords that are already defined or setting a cvar like most other settings.



#5
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

Limiting vsay spamming is also possible with Lua scripting.

 

-- List of vsays that are limited
vsaylist = {
	[0] = "hi",
	[1] = "bye",
	-- insert new values here in lower case, edit nil element index too
	[2] = nil
	}

-- The time when the previous vsay was execed
exectimes = {}

-- Minimum interval in milliseconds
mininterval = 10000

function et_InitGame(levelTime, randomSeed, restart)
	et.RegisterModname("vsay spam limit script")
end

function VsayLimits(vsay)
	local levelTime = et.trap_Milliseconds()

	vsay = vsay:lower() -- all comparisons in lower case or players start circumventing
	local i = 0
	while vsaylist[i] do
		if vsaylist[i] == vsay then
			if exectimes[i] and exectimes[i] > (levelTime - mininterval) then
				return 1
			end
			exectimes[i] = levelTime
			return 0
		end
		i = i + 1
	end
	
	return 0
end

-- Returns 1 if the command is intercepted. Note, do not use true or false.
function et_ClientCommand( clientNum, cmd )
    cmd = cmd:lower() -- lower case or players start circumventing
    if cmd == "vsay" then
        return VsayLimits(et.trap_Argv(1))
    end
    return 0
end

 

That is just an example how to intercept vsays. It is not exactly what was asked in the topic. This script instead limits each vsay separately. So that 10 seconds must pass before it can be played next time. However, it is simple to change the exectimes table of integer values to a single integer value. A better script would read the vsay list from some external file.



#6
OFFLINE   jaszpol

jaszpol

    Member

  • Members
  • PipPip
  • 45 posts
2
A step in the right direction

The script works after testing it on the server, but for sure you can not do it in order to block global vsay not only for one user?



#7
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

I'm not sure if I understood the question. If you mean one person can vsay certain vsays only with specific interval? That is possible too. The et_ClientCommand has the client number as a parameter that can be used as the index to the exectimes instead of the i.



#8
OFFLINE   jaszpol

jaszpol

    Member

  • Members
  • PipPip
  • 45 posts
2
A step in the right direction

I'm sorry that I do not understand but this wine translate. I meant to get around the server could not let go of any vsay twice. So one person lets go bye vsay this one may not exceed 10 seconds release the vsay hi or bye vsay.



#9
OFFLINE   jaszpol

jaszpol

    Member

  • Members
  • PipPip
  • 45 posts
2
A step in the right direction
-- List of vsays that are limited
vsaylist = {
[0] = "kill_camper",
[1] = "oh_camper",
[2] = "scripts_camper",
[3] = "cheater",
[4] = "gameover",
[5] = "gej",
[6] = "Indi",
[7] = "jesus",
[8] = "narwhals",
[9] = "pierdol",
[10] = "poczekaj",
[11] = "spac",
[12] = "welcome2",
[13] = "callpondem",
[14] = "canttouchme",
[15] = "girl",
[16] = "godisadj",
[17] = "gumis",
[18] = "hwdP",
[19] = "kochamcie",
[20] = "manamana",
[21] = "power",
[22] = "1osiem",
[23] = "sexy",
[24] = "Skill",
[25] = "techap",
[26] = "tomsnare",
[27] = "YMCA",
[28] = "ahmed",
[29] = "alestozjebal",
[30] = "cisza",
[31] = "donna",
[32] = "doscwojny",
[33] = "flaszke",
[34] = "glupia",
[35] = "haha4",
[36] = "haha8",
[37] = "jaspierdalam",
[38] = "laugh3",
[39] = "morgensonnenschein",
[40] = "notgay",
[41] = "przeklenstw",
[42] = "reka",
[43] = "shutup1",
[44] = "umiecgrac",
[45] = "uruguay",
[46] = "wimiezasad",
[47] = "wtf",
[48] = "celantano",
[49] = "destenation",
[50] = "feel_this_moment",
[51] = "gangnam",
[52] = "hey_shorty",
[53] = "milion_voices",
[54] = "mykonos",
[55] = "last_christmas",
[56] = "pipi",
[57] = "scream_shout",

-- insert new values here in lower case, edit nil element index too
[57] = nil
}

-- The time when the previous vsay was execed
exectimes = {}

-- Minimum interval in milliseconds
mininterval = 10000

function et_InitGame(levelTime, randomSeed, restart)
et.RegisterModname("vsay spam limit script")
end

function VsayLimits(vsay)
local levelTime = et.trap_Milliseconds()

vsay = vsay:lower() -- all comparisons in lower case or players start circumventing
local i = 0
while vsaylist[i] do
if vsaylist[i] == vsay then
if exectimes[i] and exectimes[i] > (levelTime - mininterval) then
return 1
end
exectimes[i] = levelTime
return 0
end
i = i + 1
end

return 0
end

-- Returns 1 if the command is intercepted. Note, do not use true or false.
function et_ClientCommand( clientNum, cmd, i )
cmd = cmd:lower() -- lower case or players start circumventing
if cmd == "vsay" then
return VsayLimits(et.trap_Argv(1))
end
return 0
end

What do I have to block the change globally?



#10
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

I'm still not sure. But here is 2 different alternate examples.

 

This limits all the listed vsays with one time variable.

-- List of vsays that are limited
vsaylist = {
	[0] = "hi",
	[1] = "bye",
	-- insert newvalues here in lower case
	[2] = nil
	}

-- The time when the previous vsay was execed
exectime = 0

-- Minimum interval in milliseconds
mininterval = 10000

function et_InitGame(levelTime, randomSeed, restart)
	et.RegisterModname("vsay spam limit script")
end

function VsayLimits(vsay)
	vsay = vsay:lower() -- all comparisons in lower case or the players start circumventing
	local i = 0
	while vsaylist[i] do
		if vsaylist[i] == vsay then
			local levelTime = et.trap_Milliseconds()

			if exectime > (levelTime - mininterval) then
				return 1
			end
			exectime = levelTime
			return 0
		end
		i = i + 1
	end
	
	return 0
end

-- Returns 1 if the command is intercepted. Note, do not use true or false.
function et_ClientCommand( clientNum, cmd )
	cmd = cmd:lower() -- lower case or players start circumventing
	if cmd == "vsay" then
		return VsayLimits(et.trap_Argv(1))
	end
	return 0
end

 

This limits personal spam per client

-- List of vsays that are limited
vsaylist = {
	[0] = "hi",
	[1] = "bye",
	-- insert newvalues here in lower case
	[2] = nil
	}

-- The time when the previous vsay was execed, per player
exectimes = {}

-- Minimum interval in milliseconds
mininterval = 10000

function et_InitGame(levelTime, randomSeed, restart)
	et.RegisterModname("vsay spam limit script")
end

function VsayLimits(clientNum, vsay)
	vsay = vsay:lower() -- all comparisons in lower case or the players start circumventing
	local i = 0
	while vsaylist[i] do
		if vsaylist[i] == vsay then
			local levelTime = et.trap_Milliseconds()
			if exectimes[clientNum] and exectimes[clientNum] > (levelTime - mininterval) then
				return 1
			end
			exectimes[clientNum] = levelTime
			return 0
		end
		i = i + 1
	end
	
	return 0
end

-- Returns 1 if the command is intercepted. Note, do not use true or false.
function et_ClientCommand( clientNum, cmd )
	cmd = cmd:lower() -- lower case or players start circumventing
	if cmd == "vsay" then
		return VsayLimits(clientNum, et.trap_Argv(1))
	end
	return 0
end

 

I also moved the et.trap_Milliseconds() to inside the matching condition, but it doesn't change the functionality in any way.



#11
OFFLINE   jaszpol

jaszpol

    Member

  • Members
  • PipPip
  • 45 posts
2
A step in the right direction

ok, if it works first. Not exactly as I wanted but thank you very much for your help :)







Also tagged with one or more of these keywords: sound, length, playback

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users