Forum
CS2D General CS2D Bug ReportsThere 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:
Start a dedicated server running that Lua script.
Join the server and using Remote Control, parse quit.
Check your latest log file.
Note:
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
DC has written
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.
mrc has written
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):
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:
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:
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 endround before the startround hook was called.
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.
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.
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 endround command to get called between the endround hook and the startround hook, because I added a boolean check, and tested it.
Legend:
Round ending - endround
Round initialising - startround_prespawn
Round started - startround
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:
...
Reset all entities
(I don't know if anything happens here)
Move (living) players to spawn position
...
While it should probably be something like this:
Move (living) players to spawn position
Reset all entities
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:
Round ending due to all Ts dying (CT Win is announced)
VIP dying to anything (T Win announced)
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:
DC has written
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.
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.
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 game command, will always return 0.
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:
It is possible to name yourself as
®.
Which breaks chat and Lua when attempting to use your name.
NPCs aren't always set to the right rotation on round start, don't know what's causing this and if it's on the listen server as well.
-- I don't know if this was fixed:
Fix projectile weapons on dedicated servers, they leave the weapon image behind even when picked and they show above the player.
The rotation doesn't affect hostages because every round start they get a random rotation, add a tick box that will control whether they should be randomly rotated or not.
Player names with only one character will NOT show up in the leader board and will instead appear as
???.
HUD Text elements still appear above the chat text box.
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.
STEAM IDs aren't included in listplayers.
Bug with the Mods in CS2D:
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.
There's a bug with the MVP calculation and rewarding:
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.
spawnitem won't use the
ammoinfor items that stack (Snowball, Mine, ETC.), while it should.
Either change that, or add a third parameter "count" for stacked items.
setammo doesn't care about the said above either, this is quite a problem for me, as I want to equip a given amount of grenades(/ETC.).
When a CS2D listen server shuts down, most of the times, it will send a "server shutting down" signal to all connected players, it's not exactly reliable, but the real issue is that dedicated servers don't do that at all.
A dedicated server will instead "disappear" and everyone would just timeout.
It appears as though when a player fails at joining the server (for a reason such as a different map), the connect and join hooks won't be called, but the leave will.
In the server logs, when a player says "rank" this is the output:
1
2
2
[14:00:32] Player *DEAD* : rank
It's also possible for the above to apply to name changes, and IIRC, player/map voting.
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:
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...
there are screenshots for this post
this one is funny and super weird
edited 1×, last 23.06.21 06:54:24 pm
-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
Mami Tomoe has written
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.
-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.
@ 2Gen: @ leramoros:
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 sv_cache_temp_bans to prevent confusion.
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 sv_cache_temp_bans.
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
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
EDIT:
Even when mp_postspawn is set to 0, players can still spawn about a second or two after the round started.
edited 2×, last 12.08.21 07:25:24 pm