-
-
Notifications
You must be signed in to change notification settings - Fork 479
Fix client/server ped dead-state inconsistency #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix client/server ped dead-state inconsistency #140
Conversation
Isn't the player ped actually not spawned on connect, and hence should be classed as dead? |
On connect, the player manager creates the CPlayer instance and waits until the player finishes starting his game. In this state, the player element shouldn't be accessable in any script, because the element is not attached to the root element, thus not visible to the element tree (getPlayerFromName needs a patch, because it doesn't account for The client creates the local player in |
Should we perhaps "prekill" the player in In my mind the player should be considered dead until the first |
Killing the player after the game started might cause unforeseen side-effects. |
Seems fine in my opinion. |
So calling addEventHandler( "onPlayerConnect", root, function ( playerNick )
local p1 = getPlayerFromName( playerNick )
-- p1 should equal false here ?
end) I'm 50/50 about that, I would expect to get a valid player element, but also, I can't see a scenario where one would want a player element in |
The getPlayerFromName issue has been resolved by allowing it. Using any "player-data modifying" function (e.g. setElementData) will show a warning, if used with a non-joined player. |
@Citizen01 There is an issue open which to me sounds fair enough. I think adding the ability to have soft "reserved slots" would be nice. |
@patrikjuvonen This PR won't resolve the issue you linked. Or am I missing something ? |
@Citizen01 Yes, it won't, but that was related to your comment:
Sorry for being unclear. |
Ah yeah ok I see, but even that scenario doesn't require the player element connecting as you already can use its nickname and/or serial. |
Ah, you're right! Completely forgot that. That issue should probably be closed then. |
Hmmm no ? The issue is for the even |
My argument is that after a player dies you need to use spawnPlayer, and so when you join you should be classed as "dead" because you have to use spawnPlayer. |
mtasa-blue/Server/mods/deathmatch/logic/CGame.cpp Lines 3920 to 3921 in b061dfd
|
If that comment is correct and the player is already spawned when connected, there shouldn't be a requirement to use spawnPlayer |
Hmm, I thought spawnPlayer's documentation said you do need to. But setElementPosition seems to imply you only need spawnPlayer after the player is killed |
btw if that is the case (you don't need spawnPlayer when you first join) then all my comments here are wrong, and this PR can be merged |
(an excellent 2 year misunderstanding, lol) |
Description
Fixes #487
This tiny pull request fixes the inconsistency between client and server code to match the current 'dead' state of a ped.
Issue: #9496: Client 'isPedDead' returns 'false' when not yet spawned
Client: mods/deathmatch/logic/CClientPed.cpp
Notes
Your player ped is spawned and not dead after the initial connect, but the server code doesn't represent this state pre-PR. (see here)