Jump to content

sound length playback


jaszpol

Recommended Posts

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? ;>
Link to comment
Share on other sites

  • Management

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.

Link to comment
Share on other sites

  • Management

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.

Link to comment
Share on other sites

  • Management

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.

Link to comment
Share on other sites

-- 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?

Link to comment
Share on other sites

  • Management

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...