Jump to content
Gunny-e174dd68292a73e3

Detect if player is new or respawn

Recommended Posts

On 1/7/2023 at 8:58 PM, Gunny-e174dd68292a73e3 said:

Is there a way in an override of missionServer.c -> OnClientNewEvent to identify if the player is new to the server or if its a new player?

/Jens G

I'm sorry for long answer but you may override with that method:

override PlayerBase OnClientNewEvent (PlayerIndentity identity, vector pos, ParamsReadContext ctx)

{

//Blah blah blah

super.OnClientNewEvent(identity,pos,ctx);

}

Share this post


Link to post
Share on other sites

登录时根据玩家的 steamid来做个json配置.  有对应ID配置文件的就是老用户. 没有的就是新用户.

Share this post


Link to post
Share on other sites
2 hours ago, DcrClub said:

登录时根据玩家的 steamid来做个json配置.  有对应ID配置文件的就是老用户. 没有的就是新用户.

Please use English in the future, as this is primarily an English-speaking forum. Thank you.

Share this post


Link to post
Share on other sites
3 hours ago, DcrClub said:

登录时根据玩家的 steamid来做个json配置.  有对应ID配置文件的就是老用户. 没有的就是新用户.

Idea at the base is right but you had missed one important point.

Here we talking not about user account, but about the user character.

So whad did you missed? When character respawns the SteamID64/GUID is not changing at all. The way how it can be solved by overriding Server-sedi function CharacterKill amd after that you can make such trick woth SteamIDs json file.

If new player connected, and called On Player Setup (called for freshly spawned non loaded out characters you can create the new. JSON on server-side, in overeide function KillCharacter you can get information about died character such as his Identity and perform the removing JSON file, for recreation of it, also place the information when file was created.

That action can resolve the question in the base. 🙂

Share this post


Link to post
Share on other sites
Posted (edited)

emmm ok, Then there is no need for json files to record

missionserver.c 

override void OnEvent(EventType eventTypeId, Param params)

case ClientNewEventTypeID:

case ClientRespawnEventTypeID:

 

However, this method has a disadvantage, which depends on your specific needs.

If the player dies, exit the game directly. Then when he logs in again, he will follow the logic of the new role.

 

Edited by DcrClub

Share this post


Link to post
Share on other sites
21 hours ago, DcrClub said:

登录时根据玩家的 steamid来做个json配置.  有对应ID配置文件的就是老用户. 没有的就是新用户.

okokok

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×