![user](img/i_friend.png)
Forum
![>](img/i_next.png)
![>](img/icons/cs2d.png)
![>](img/i_next.png)
![>](img/i_next.png)
![user](img/i_friend.png)
![user](img/i_friend.png)
There is clientsetting hook for event when player changes settings.
https://www.cs2d.com/help.php?hookcat=all&hook=clientsetting#hook
This is managed in n232_clientsettings.
I've just checked, client hook is properly executed.
For some reason player() variables are not updated though.
edited 3×, last 05.05.21 10:33:05 pm
1
2
2
[14:00:32] Player *DEAD* : rank
Which is not ideal, and should be fairly easy to fix.
Edit:
This is undocumented, but definitly should be.
The dedicated server apparently counts as a player (with ID 0), and when the server shuts down, it calls the leave hook with player ID 0, and reason 4 (server shutdown).
Here's the log:
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
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
CS2D 1.0.1.1 Logfile - 10 May 2021, 12:42:50 [12:42:50] ####################################################### [12:42:50] Unreal Software's CS2D Dedicated Server [12:42:50] > visit www.CS2D.com for info and updates < [12:42:50] Game Version: 1.0.1.1 [12:42:50] Server Build for 1.0.1.1: 1.0 [12:42:50] System Time: 10 May 2021 - 12:42:50 [12:42:50] Operating System: Microsoft Windows [12:42:50] ####################################################### [12:42:50] UDP socket initialized using port 36963 [12:42:50] U.S.G.N.: Your game version is up to date! [12:42:50] Starting server... [12:42:50] load map '!!' [12:42:50] ----- Server started ----- [12:42:50] parsing Lua server script (mp_luaserver = 'server.lua') [12:42:50] Lua: Adding function 'leave_hook' to hook 'leave' [12:42:50] U.S.G.N.: Sending serverlist ADD-request... [12:42:51] U.S.G.N.: Server added to serverlist [12:42:59] recv join attempt... (0.0.0.0:00000) [12:42:59] Mami Tomoe clientdata: WIN {abcdefghijklmnopqrstuvwxyzabcdefghijklm} [12:43:00] recv join attempt... (0.0.0.0:00000) [12:43:00] Mami Tomoe clientdata: WIN {abcdefghijklmnopqrstuvwxyzabcdefghijklm} [12:43:00] U.S.G.N.: Mami Tomoe (0.0.0.0) joining with U.S.G.N. ID #99153 - verifying... [12:43:01] U.S.G.N.: 0.0.0.0 is using U.S.G.N. ID #99153 [12:43:01] Mami Tomoe is using IP 0.0.0.0:00000, U.S.G.N. ID #99153 and no Steam [12:43:17] Parse RCon (0.0.0.0:00000): quit [12:43:17] Player #0 is leaving (code: 4).
And the script I used:
1
2
3
4
5
2
3
4
5
function leave_hook(p, reason) 	print('Player #' .. tostring(p) .. ' is leaving (code: ' .. tostring(reason) .. ').') end addhook('leave', 'leave_hook')
I had no other code running, I'm sure anyone can replicate this.
Steps:
![•](img/dot.gif)
![•](img/dot.gif)
![cs2d cmd](img/i_codehelp.png)
![•](img/dot.gif)
![>](img/i_next.png)
This also means player IDs don't get called using reason 4 (server shutdown).
They just time out with "Connection Problems", instead of being notified the server was shutting down.
Logs of players not being notified of server shutdown:
1
2
3
4
5
6
2
3
4
5
6
[12:49:18] Parse RCon (0.0.0.0:00000): bot_add_t [12:49:18] Parse RCon (0.0.0.0:00000): bot_add_ct [12:49:18] Parse RCon (0.0.0.0:00000): bot_add_t [12:49:18] Parse RCon (0.0.0.0:00000): bot_add_ct [12:49:23] Parse RCon (0.0.0.0:00000): quit [12:49:23] Player #0 is leaving (code: 4).
This works fine (most of the times) through the listen server!
Does player ID 0 mean "everyone"?
If so, that's a weird way to do it.
edited 2×, last 10.05.21 11:51:35 am
![user](img/i_friend.png)
Blurry sprays are a known issue. From my experience it can always happen. Even without any transfers or server mods. I still don't know why it happens sometimes.
thats because the resolution, the only resolution that sprays looks normal is 850x480 and the olders with 4:3 aspect ratio.
![user](img/i_friend.png)
thats because the resolution, the only resolution that sprays looks normal is 850x480 and the olders with 4:3 aspect ratio.
I could have swore I had that problem even at those resolutions. Only way I "fixed" it with my sprays is give the bits that are meant to be transparent only like 98% black instead of fully black.
Here's why and how:
When the server STEAM bans a player, it will save them as a STEAM ban internally (similar to temp bans):
![IMG:https://cdn.discordapp.com/attachments/733262868778319942/846146153673654272/unknown.png](https://cdn.discordapp.com/attachments/733262868778319942/846146153673654272/unknown.png)
When the server changes map, the STEAM ban will remain in the cache, but a U.S.G.N. ban (that uses the STEAM ID) will be appended:
![IMG:https://cdn.discordapp.com/attachments/733262868778319942/846146616238669824/unknown.png](https://cdn.discordapp.com/attachments/733262868778319942/846146616238669824/unknown.png)
But when the server closes, and starts again, the STEAM ban will not be loaded, because both bans will now become one and overwrite each other, leading to just having the U.S.G.N. ban:
![IMG:https://cdn.discordapp.com/attachments/733262868778319942/846145493956296704/unknown.png](https://cdn.discordapp.com/attachments/733262868778319942/846145493956296704/unknown.png)
I'm not sure when or how this part happens, but at some point the ban number will overflow and corrupt (as STEAM IDs are of the type
ulongbut U.S.G.N. IDs are of the type
uint).
I hope this will be fixed, otherwise banning STEAM players permanently will not be possible (without the help of Lua scripts).
EDIT:
It appears that CS2D allows a round to end while a round is initialising, it looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- round going on as normal [17:46:31] [!] Round is ending [17:46:36] * Auto Teambalance * [17:46:36] [>] ERROR changed team from Terrorist to Counter Terrorist [17:46:36] [>] Player 3 died to <Custom Kill> on 643|339 [17:46:36] [!] Round is ending [17:46:36] [!] Round is initialising [17:46:36] [!] Round started -- players chatting [17:46:41] [!] Round is initialising [17:46:41] [!] Round started
Can be somewhat simulated using this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function startround_prespawn_hook(_) 	print'startround_prespawn' 	parse('endround') end function startround_hook(_) 	print'startround' end function endround_hook(_) 	print'endround' end addhook('startround_prespawn', 'startround_prespawn_hook') addhook('startround', 'startround_hook') addhook('endround', 'endround_hook')
I don't think you should be able to call
![cs2d cmd](img/i_codehelp.png)
![cs2d lua hook](img/i_codehelp.png)
edited 1×, last 24.05.21 06:10:13 pm
Regarding the other thing:
CS2D in general has basically zero protections against bad/stupid scripts which break things in horrible ways. I won't start adding safeguards because that would be a huge and never ending task. It's up to the script developer to take some care while writing scripts and to prevent stuff from being executed at the wrong time.
I mean.. executing endround in a startround hook is just plain nonsense. There are infinite comparable scenarios. I can't block all of them.
![user](img/i_friend.png)
This can be caused by more than just bad scripts, it can be caused by big scripts that have a lot of logic and timers.
This is just like you can't end a round after it already ended, the difference is, that safeguard doesn't work on the startround prespawn.
edited 1×, last 30.05.21 09:33:57 pm
Therefore I prefer the "it's the user's fault. please don't do nonsense!"-approach. Problem solved.
![√](img/ok.gif)
![user](img/i_friend.png)
It works (to fix the examples I've previously given), but this still happens:
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
[20:29:32] [!] Round is ending [20:29:33] [>] ......................... changed team from Spectator to Counter Terrorist [20:29:38] [>] uns.bshkn died to <Custom Kill> on 686|335 [20:29:38] [!] Round is ending [20:29:38] [!] Round is initialising [20:29:38] [!] Round started [20:29:43] [!] Round is initialising [20:29:43] [!] Round started
It's rare, but it happens.
I don't know what exactly causes it, but it always (?) has the following pattern:
End > End > Init > Start > Init > Start
I don't know if this is related to Lua anymore (which it might be, but I don't know if Lua is to blame, this seems like an internal problem the more I look at it).
In my Lua, there is no way for the
![cs2d cmd](img/i_codehelp.png)
![cs2d lua hook](img/i_codehelp.png)
![cs2d lua hook](img/i_codehelp.png)
Legend:
![•](img/dot.gif)
![cs2d lua hook](img/i_codehelp.png)
![•](img/dot.gif)
![cs2d lua hook](img/i_codehelp.png)
![•](img/dot.gif)
![cs2d lua hook](img/i_codehelp.png)
My diagnosis:
It appears that the player dying causes the round to end again while it's already ending.
Checking the tile position it shows that the tile the player died on, is a deadly tile covered by a dynamic wall of a floor type.
And the order appears to be as follows:
![>](img/i_next.png)
![>](img/i_next.png)
![>](img/i_next.png)
![>](img/i_next.png)
![>](img/i_next.png)
While it should probably be something like this:
![>](img/i_next.png)
![>](img/i_next.png)
This is because the player died to the toxic floor that was being removed by the server, due to it resetting the map entities, and that probably caused the round to end, because that player was probably the last in their team.
[UNTESTED, FROM MEMORY:]
A similar thing also happens with the VIP on assassination maps:
![>](img/i_next.png)
![>](img/i_next.png)
That leads to two round ending calls.
This creates a huge mess in my script, that relies on accurate round ending/starting calls.
All of this can be fixed by a simple boolean check.
But I do recommend changing the order of a round initialisation, so players won't die to dynamic walls getting triggered.
EDIT:
I've already sent this, but you can see it live here (old video, but same effect): Download
You also posted this:
![user](img/i_friend.png)
Execution order when a new round starts:
auto team balance
adjust scores (depending on end of previous round)
free all dynamic objects
reset the map (clear items, reset entities, clear particles, run trigger start, spawn items/npcs/buildings)
run
startround_prespawn
clear old hostages & spawn new hostages
spawn players (and run
spawn for each right after spawning)
run
startround
reset/start bot AI
optionally trigger an automatic map change if conditions are met
And no, that order isn't perfect. It just grew like that and it worked so that's why there is that order.
![•](img/dot.gif)
![•](img/dot.gif)
![•](img/dot.gif)
![•](img/dot.gif)
![•](img/dot.gif)
![cs2d lua hook](img/i_codehelp.png)
![•](img/dot.gif)
![•](img/dot.gif)
![cs2d lua hook](img/i_codehelp.png)
![•](img/dot.gif)
![cs2d lua hook](img/i_codehelp.png)
![•](img/dot.gif)
![•](img/dot.gif)
And no, that order isn't perfect. It just grew like that and it worked so that's why there is that order.
Let me focus on the fact that reset the map happens before spawn players (which I'd suppose, also moves the living players).
This WILL lead to players dying while this process is ongoing, and it was just now, proven to cause issues.
I REALLY hope this will be fixed, I REALLY don't want to have to script something to avoid problems from unreliable hooks.
EDIT:
I created a reproduction map, it's quite easy to reproduce the issue and to see what the issue is: Download
And here's the game-play of the map, in case that's all you need: YouTube
EDIT:
I've been thinking of a clever way to fix this, and I think the best way is to separate moving living players from spawning dead players, just have the stage where you move the living players get executed prior to the map resetting.
This and adding a boolean check for the round logic, should make fix this problem quite easily, I'd say.
I tried to do that using Lua, but the round ending does not have a consistent delay time, so I can't manipulate the game into letting me teleport the players, unless I only let players have 3 seconds and have them stand in a black box for another two, which is not very fun.
EDIT:
Unrelated to all of the above:
The
winrow_tand
winrow_ctparameters for the
![cs2d lua cmd](img/i_codehelp.png)
That is, unless I'm missing something.
If that is a bug, I have a request for that feature, the integer should reset on a Game Commencing or Round Restart event.
Also, on the documentation for that command, it says that numbers are returned as strings, but they're not.
EDIT:
I decided to include most of what I previously reported, as I'm fairly certain these were not fixed, so here are the bugs, again:
![>](img/i_next.png)
®.
Which breaks chat and Lua when attempting to use your name.
![>](img/i_next.png)
-- I don't know if this was fixed:
![>](img/i_next.png)
![>](img/i_next.png)
![>](img/i_next.png)
???.
![>](img/i_next.png)
The chat box should appear on top of the HUD Texts, and possibly fade away any HUD Texts below it by a small amount until the chat box is closed.
![>](img/i_next.png)
![cs2d cmd](img/i_codehelp.png)
![>](img/i_next.png)
When a server sets a priority to two mods for example
1
2
2
[X] Mod #1 [X] Mod #2
The host will retain that priority, but any clients joining the server will have the priority reversed.
Therefore, the bottom is the prioritized, rather than the top.
![>](img/i_next.png)
https://youtu.be/HEa50loXJe0
The MVP would be declared for defusing the bomb regardless of whether they did or not, it will be based on their frags for the round.
![>](img/i_next.png)
![cs2d cmd](img/i_codehelp.png)
ammoinfor items that stack (Snowball, Mine, ETC.), while it should.
Either change that, or add a third parameter "count" for stacked items.
![cs2d cmd](img/i_codehelp.png)
![>](img/i_next.png)
A dedicated server will instead "disappear" and everyone would just timeout.
![>](img/i_next.png)
![cs2d lua hook](img/i_codehelp.png)
![cs2d lua hook](img/i_codehelp.png)
![cs2d lua hook](img/i_codehelp.png)
![>](img/i_next.png)
1
2
2
[14:00:32] Player *DEAD* : rank
![>](img/i_next.png)
1
2
2
[00:00:00] Player changes name to Player (AFK)
EDIT:
I think I found out why assists are sometimes given to the wrong player.
Similar to the way the bomb rewarding works, if the player (assistant) leaves the game, and someone takes their ID, that someone will be eligable for the assist.
EDIT:
![IMG:https://cdn.discordapp.com/attachments/434982221405880320/852654765683114014/unknown.png](https://cdn.discordapp.com/attachments/434982221405880320/852654765683114014/unknown.png)
This sometimes happens when you join servers that use spritesheets.
It has no impact.
edited 17×, last 10.06.21 11:07:26 pm
Sometimes you can see an attempt to enter rcon in the logs.
Sometimes something else is in the logs.
Sometimes the round time on the server changes to a negative number. (We just have unlimited time, but sometimes it changes)
And sometimes a player with an incredibly long nickname and an incomprehensible USGN id "joins".
Also sometimes round "restarts" but localy for random player. Btw, all the things that I listed above do not happen to everyone, but to a random player.
P.S. I added all screenshots but this website told me what i cant post links (to screenshots from discord.) so i will remove them...
![user](img/i_friend.png)
there are screenshots for this post
this one is funny and super weird
edited 1×, last 23.06.21 06:54:24 pm
![cs2d lua cmd](img/i_codehelp.png)
-1, -1in if the player hasn't moved their mouse in a while.
I suggest returning the last known coordinates instead, as returning
-1, -1may cause some scripts to act up, if they weren't designed to counter that.
It would also be possible, as an alternative to that, to document that as a feature.
EDIT:
os.millisecs()will return a negative value if the server had been up for too long (possibly overflow).
I would suggest capping it at a certain count, and having something like
os.millisecscount()which would count the amount of times the cap had been reached.
Though, simply resetting back to 0, can also work.
Or, give us the ability to reset the counter back to 0 ourselves with
os.resetmillisecs().
edited 1×, last 30.06.21 03:22:41 pm
![user](img/i_friend.png)
Don't know if it's intended but the mouse coordinates given by the
player function will be set as
I suggest returning the last known coordinates instead, as returning
It would also be possible, as an alternative to that, to document that as a feature.
![cs2d lua cmd](img/i_codehelp.png)
-1, -1in if the player hasn't moved their mouse in a while.
I suggest returning the last known coordinates instead, as returning
-1, -1may cause some scripts to act up, if they weren't designed to counter that.
It would also be possible, as an alternative to that, to document that as a feature.
Current system gives more information than your suggestion.
This change would also break more existing scripts (including one of mine)
You can make a wrapper that would return last non negative position.
If I remember correctly, spectator mouse can be disabled - that also returns negative values in Lua.
Current behaviour is not a bug and is documented.
Regarding milliseconds..
You can also write a wrapper for what you are asking as well.
That takes just a few lines.
@
![user](img/i_friend.png)
![user](img/i_friend.png)
Could be caused by clock overflow. I haven't seen anything like this though.
bans.lstfile.
I would suggest to save the temporary bans to the file as well, perhaps add
![cs2d cmd](img/i_codehelp.png)
The save should initiate on execution (whenever the entry is added) and on server shutdown (to save however many seconds were left for the ban).
This of course, won't keep track of offline time.
But that is why I suggested
![cs2d cmd](img/i_codehelp.png)
This would be useful for whoever wants to read more than just permanent bans from the file.
EDIT:
1
2
3
4
5
6
2
3
4
5
6
-- Lua: Adding function 'voice_test' to hook 'voice' function voice_test(...) 	print('voice called') 	print(...) end addhook('voice', 'voice_test')
When I use the voice chat, the hook never gets called.
edited 4×, last 23.07.21 01:46:12 pm
![user](img/i_friend.png)
![user](img/i_friend.png)
It does not work for me.
images:
(put links in browser)
EDIT:
Realised this is the wrong place but it's too late to change it now
![](img/smiles/confused.gif)
EDIT:
Even when
![cs2d cmd](img/i_codehelp.png)
edited 2×, last 12.08.21 07:25:24 pm