@@ -29,6 +29,7 @@ void CLuaPlayerDefs::LoadFunctions()
2929 {" getPlayerMoney" , GetPlayerMoney},
3030 {" getPlayerWantedLevel" , GetPlayerWantedLevel},
3131 {" getPlayerScriptDebugLevel" , ArgumentParser<GetPlayerScriptDebugLevel>},
32+ {" isPlayerCrosshairVisible" , ArgumentParser<IsPlayerCrosshairVisible>},
3233
3334 // Player set funcs
3435 {" showPlayerHudComponent" , ShowPlayerHudComponent},
@@ -91,13 +92,15 @@ void CLuaPlayerDefs::AddClass(lua_State* luaVM)
9192 lua_classfunction (luaVM, " getScriptDebugLevel" , " getPlayerScriptDebugLevel" );
9293
9394 lua_classfunction (luaVM, " isNametagShowing" , " isPlayerNametagShowing" );
95+ lua_classfunction (luaVM, " isCrosshairVisible" , " isPlayerCrosshairVisible" );
9496
9597 lua_classvariable (luaVM, " ping" , NULL , " getPlayerPing" );
9698 lua_classvariable (luaVM, " name" , NULL , " getPlayerName" );
9799 lua_classvariable (luaVM, " team" , NULL , " getPlayerTeam" );
98100 lua_classvariable (luaVM, " scriptDebugLevel" , nullptr , " getPlayerScriptDebugLevel" );
99101 lua_classvariable (luaVM, " nametagText" , " setPlayerNametagText" , " getPlayerNametagText" );
100102 lua_classvariable (luaVM, " nametagShowing" , " setPlayerNametagShowing" , " isPlayerNametagShowing" );
103+ lua_classvariable (luaVM, " crosshairVisible" , nullptr , " isPlayerCrosshairVisible" );
101104
102105 lua_registerclass (luaVM, " Player" , " Ped" );
103106}
@@ -636,3 +639,8 @@ unsigned char CLuaPlayerDefs::GetPlayerMapOpacity()
636639 int iMapOpacity = g_pCore->GetCVars ()->GetValue <int >(" mapalpha" );
637640 return static_cast <unsigned char >(Clamp (0 , iMapOpacity, 255 ));
638641}
642+
643+ bool CLuaPlayerDefs::IsPlayerCrosshairVisible ()
644+ {
645+ return g_pGame->GetHud ()->IsCrosshairVisible ();
646+ }
0 commit comments