mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Set login name as default username
This commit is contained in:
parent
50fda97164
commit
a65a3eef1f
@ -37,6 +37,15 @@ namespace patches
|
|||||||
return sv_kick_client_num_hook.invoke<void>(client_num, reason);
|
return sv_kick_client_num_hook.invoke<void>(client_num, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string get_login_username()
|
||||||
|
{
|
||||||
|
char username[UNLEN + 1];
|
||||||
|
DWORD username_len = UNLEN + 1;
|
||||||
|
GetUserNameA(username, &username_len);
|
||||||
|
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
utils::hook::detour com_register_dvars_hook;
|
utils::hook::detour com_register_dvars_hook;
|
||||||
|
|
||||||
void com_register_dvars_stub()
|
void com_register_dvars_stub()
|
||||||
@ -44,7 +53,7 @@ namespace patches
|
|||||||
if (game::environment::is_mp())
|
if (game::environment::is_mp())
|
||||||
{
|
{
|
||||||
// Make name save
|
// Make name save
|
||||||
game::Dvar_RegisterString("name", "Unknown Soldier", game::DVAR_FLAG_SAVED, "Player name.");
|
game::Dvar_RegisterString("name", get_login_username().data(), game::DVAR_FLAG_SAVED, "Player name.");
|
||||||
|
|
||||||
// Disable data validation error popup
|
// Disable data validation error popup
|
||||||
game::Dvar_RegisterInt("data_validation_allow_drop", 0, 0, 0, 0, "");
|
game::Dvar_RegisterInt("data_validation_allow_drop", 0, 0, 0, 0, "");
|
||||||
|
Loading…
Reference in New Issue
Block a user