Forum

> > CS2D > Scripts > LUA SCRIPT- for competitive mode
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch LUA SCRIPT- for competitive mode

30 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Re: LUA SCRIPT- for competitive mode

Rainoth
Moderator Off Offline

Zitieren
• On round start for 15 seconds request client data
• check if a person is on the tile you're aiming at
• if there's a person, display his name and money

Can be written in a few minutes but I'm afraid I don't have them right now.

alt Re: LUA SCRIPT- for competitive mode

Yates
Reviewer Off Offline

Zitieren
Let's lag some competitive servers! Because that is what you are going to do.

I suggest you not request client data to eventually end up only asking for player information. If you really want that on hover thing, I suggest you trigger the requiring of the data with E or something else. Otherwise client data will be requested every millisecond or second, which lags.

alt Re: LUA SCRIPT- for competitive mode

Yates
Reviewer Off Offline

Zitieren
Requesting client data will always cause lag when requesting every 100th millisecond or second for each alive player. You can only limit the requests which will help, but can not simply be requested on the hover over a player. To make this work how the OP wants it it would require at most the request of data each time the ms100 hook is triggered to make it look smooth, but then you are requesting client data 10 times every second per player and you don't always use it because you are not hovering over the player every 100th millisecond, and this player can also be on the enemy team. So basically you are wasting data resources for no reason.

There is no other way around this problem to make it work as smooth as the OP obviously wants it. Unless you have a magical way to request player data with serious refined mechanisms without using the cs2d lua cmd reqcld (which is the only current way to get the mouse position) then go ahead and show us all.

You also have to take into account that you cannot use the second hook, as players move. So if you hover over the person and that person moves and you do not follow him with your mouse you are also wasting resources.

All I can say is go ahead and prove me wrong, but until that happens I seriously suggest the requesting of data be triggered with another hook for example cs2d lua hook use or cs2d lua hook serveraction
2× editiert, zuletzt 17.11.15 13:43:35

alt Re: LUA SCRIPT- for competitive mode

Bowlinghead
User Off Offline

Zitieren
You dont have to use reqcld all the time.
You can use player(id,"rot") to check in which direction a player aims at.
If a player aims at the direction where another player stands then you have to request client data.

alt Re: LUA SCRIPT- for competitive mode

Gaios
Reviewer Off Offline

Zitieren
No lags, no mad.
This only works when freeze timer is set to minimum: 2.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
------------------------------------------
-- Show Money for PCS by Gajos (#18271) --
------------------------------------------

gajos = {}
gajos.huds = {}
for i = 1,32 do
	gajos.huds[i] = {}
end
addhook('startround','gajos.startround',42)
function gajos.startround()
	local freezeTime = tonumber(game('mp_freezetime')) or 0
	if freezeTime > 1 then
		gajos.tableLiving = player(0,'tableliving')
		for _, id in pairs(gajos.tableLiving) do
			for _, pl in pairs(gajos.tableLiving) do
				if player(id,'health') > 0 and player(pl,'health') and player(id,'team') == player(pl,'team') and id ~= pl then
					updateHudtxt(id,pl,x,y)
					table.insert(gajos.huds[id],pl)
				end
			end
		end
		addhook('buy','gajos.buy',42)
		timer((freezeTime - 1) * 1000,'removeHudtxts')
	end
end

function gajos.buy(pl)
	for _, id in pairs(gajos.tableLiving) do
		if player(id,'team') == player(pl,'team') and id ~= pl then
			timer(50,'parse','lua updateHudtxt('..id..','..pl..')')
		end
	end
end

function updateHudtxt(id,pl)
	local x, y = player(pl,'x') - player(id,'x') + 320, player(pl,'y') - player(id,'y') + 200
	parse('hudtxt2 '..id..' '..pl..' "©000255000$'..player(pl,'money')..'" '..x..' '..y..' 1')
end

function removeHudtxts()
	freehook('buy','gajos.buy')
	for _, id in pairs(gajos.tableLiving) do
		for k, i in pairs(gajos.huds[id]) do
			parse('hudtxtalphafade '..id..' '..i..' 1000 0')
		end
		gajos.huds[id] = {}
	end
	gajos.tableLiving = nil
end
IMG:https://i.imgur.com/mEnIfEk.jpg

alt Re: LUA SCRIPT- for competitive mode

Yates
Reviewer Off Offline

Zitieren
Uh, obviously your ignorance to read can be seen here. The OP wanted an "on hover show that player's money."

I mean dude, it's the only actual sentence he has in his first post which isn't even a line long:
Zitat
:Aim a teammate at the start of the round, and you will see his money




Less talk, more read.

alt Re: LUA SCRIPT- for competitive mode

Yates
Reviewer Off Offline

Zitieren
I only said it would lag with the cs2d lua cmd reqcld when used as an "on hover" state over a player.

You have basically proven nothing. Way to go, Gajos.

Zitat
I knew that, but I wouldn't do that.

With this attitude you are going nowhere. A client want what a client wants. You cannot do this in a business environment.

alt Re: LUA SCRIPT- for competitive mode

Milriko
User Off Offline

Zitieren
Actually what Gajos did here is much better and easier for team communication. Now we don't have to use longer freezetime period to hove on everyone and see the money. Freezetime can remain the same as it was (5 or 7 seconds) and the decission about full/eco can be declared after 1/2 seconds, allowing us to have also some tactic seconds or to take notes for rounds etc.
Thanks Gajos, i think it will be used in next tournament (atleast i hope so).

That would be awesome to detect sfx for hits, because that's one of the few things our AC can't detect (well it can, but not always) and hitsounds can be a big advantage for cheaters (for competetive gaming using hitsounds is cheating already :P).

I actually never thought of such lua that Gajos did here in probably few minutes, so simple, clever and useful.

alt Re: LUA SCRIPT- for competitive mode

Andrez
User Off Offline

Zitieren
Or maybe it would be easier to just detect modifications in the single file that comes in the cs2d.com version, it would just tell me, with my admin panel that the players has hitsounds, the idea is probably to bust them before they even notice

For example, moss uses this

D:\2d\sfx\player\hit1.wav md5: 1ff855e59dc1d55fbdd899b3734bf65747078f41738b7ebdb1e6fdda54298e6b
D:\2d\sfx\player\hit2.wav md5: bb2b7393b580220df80966a5d4ed89c1f4eaa7e0d4690f27221e9dc021c4d9f2
D:\2d\sfx\player\hit3.wav md5: ebabd453fd91ef46f4067720bedf2ff51140e1d0f9f5cafd29c530c29bfddd4a


Those are the values for the cs2d.com version of the hitsounds
1× editiert, zuletzt 18.11.15 20:36:58

alt Re: LUA SCRIPT- for competitive mode

Gaios
Reviewer Off Offline

Zitieren
I don't know MOSS and can't comment on that. Maybe what you said is good, but I don't know. Lua Simply can't detect the sounds.

If you have any ideas to improve my script, say.
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht