@@ -119,3 +119,62 @@ VOID SpecOpsMW2MenuFunctions::ToggleUFO(Menu* pMenu)
119
119
pMenu->SetFeedbackText (" Ufo ^1Off" );
120
120
}
121
121
}
122
+
123
+
124
+ // --------------------------------------------------------------------------------------
125
+ // Name: ToggleSecondPlayerGodMode()
126
+ // Desc: Toggle God Mode for the second player.
127
+ // --------------------------------------------------------------------------------------
128
+ VOID SpecOpsMW2MenuFunctions::ToggleSecondPlayerGodMode (Menu* pMenu)
129
+ {
130
+ // The second client num is always 1
131
+ INT iSecondClientNum = 1 ;
132
+
133
+ // If the player name of the second client is empty, it means there is no second client
134
+ gclient_s* pSecondClient = GetGClient (iSecondClientNum);
135
+ if (!pSecondClient->connected )
136
+ {
137
+ pMenu->SetFeedbackText (" ^1No other player in the game!" );
138
+ return ;
139
+ }
140
+
141
+ playerState_s* playerState = SV_GetPlayerstateForClientNum (iSecondClientNum);
142
+
143
+ if (playerState->otherFlags == 0 )
144
+ {
145
+ playerState->otherFlags = 1 ;
146
+ pMenu->SetFeedbackText (" Second Player God Mode ^2On" );
147
+ }
148
+ else
149
+ {
150
+ playerState->otherFlags = 0 ;
151
+ pMenu->SetFeedbackText (" Second Player God Mode ^1Off" );
152
+ }
153
+ }
154
+
155
+
156
+ // --------------------------------------------------------------------------------------
157
+ // Name: TeleportSecondPlayerToMe()
158
+ // Desc: Teleport the second player in front of the first player.
159
+ // --------------------------------------------------------------------------------------
160
+ VOID SpecOpsMW2MenuFunctions::TeleportSecondPlayerToMe (Menu* pMenu)
161
+ {
162
+ // The second client num is always 1
163
+ INT iSecondClientNum = 1 ;
164
+ INT iFirstClientNum = pMenu->GetClientNum ();
165
+
166
+ gclient_s* pSecondClient = GetGClient (iSecondClientNum);
167
+ if (!pSecondClient->connected )
168
+ {
169
+ pMenu->SetFeedbackText (" ^1No other player in the game!" );
170
+ return ;
171
+ }
172
+
173
+ // Get the first player's current position
174
+ FLOAT fDistance = 100 .0f ;
175
+ vec3 Origin = SV_GetPlayerstateForClientNum (iFirstClientNum)->origin ;
176
+ FLOAT fViewY = SV_GetPlayerstateForClientNum (iFirstClientNum)->viewAngles .y ;
177
+
178
+ // Teleport the second player in front of the first player
179
+ pSecondClient->ps .origin = Math::ToFront (Origin, fViewY , fDistance );
180
+ }
0 commit comments