MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / ExecuteRConCommand

Method ExecuteRConCommand

CryNetwork/RConSystem.cpp:287–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void CRConSystem::ExecuteRConCommand( const char *inszCommand )
288{
289 // get parameters
290
291 IConsole *pConsole=m_pSystem->GetIConsole(); assert(pConsole);
292
293 ICVar *pVar1 = pConsole->GetCVar("cl_rcon_serverip"); assert(pVar1);
294 string serverip = pVar1->GetString();
295
296 ICVar *pVar2 = pConsole->GetCVar("cl_rcon_port"); assert(pVar2);
297 WORD wPort = pVar2->GetIVal();
298
299 ICVar *pVar3 = pConsole->GetCVar("cl_rcon_password"); assert(pVar3);
300 string sPasswd = pVar3->GetString();
301
302 // send packet
303 CQPRConCommand cqpRConCommand;
304 CStream stmPacket;
305 CIPAddress ip(wPort,serverip.c_str());
306
307 // If server ip not specified use, current server.
308 if (serverip.empty())
309 {
310 ip.Set( m_ipServer );
311 }
312
313 unsigned int nClientCode[4];
314 GetPassCode( sPasswd.c_str(),nClientCode );
315 memcpy( cqpRConCommand.m_nRConPasswordCode,nClientCode,sizeof(nClientCode) );
316
317 char tempCmd[256];
318 strncpy(tempCmd,inszCommand,sizeof(tempCmd)-1);
319 tempCmd[sizeof(tempCmd)-1] = 0;
320 cqpRConCommand.m_sRConCommand = tempCmd;
321
322 cqpRConCommand.Save(stmPacket);
323 m_sSocket.Send(stmPacket.GetPtr(),BITS2BYTES(stmPacket.GetSize()),&ip);
324
325 // prinout
326 CryLogAlways("$5RCon (%s:%d)'%s'",serverip.c_str(),(int)wPort,tempCmd );
327}

Callers

nothing calls this directly

Calls 13

memcpyFunction · 0.85
CryLogAlwaysFunction · 0.85
GetIConsoleMethod · 0.80
GetCVarMethod · 0.80
GetIValMethod · 0.80
GetStringMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45
SetMethod · 0.45
SaveMethod · 0.45
SendMethod · 0.45
GetPtrMethod · 0.45

Tested by

no test coverage detected