void CCheatMgr::BootPlayer(CParsedMsg &cMsg) { if (!IsMultiplayerGame()) return; CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr(); if (!pCIMgr) return; if( cMsg.GetArgCount() < 2 ) return; // The full name of the player might be split between several // arguments of the message so build the name from all arguments // except the name of the actual cheat (Arg 1). char szPlayerName[MAX_PLAYER_NAME] = {0}; cMsg.ReCreateMsg( szPlayerName, sizeof( szPlayerName ), 1 ); CLIENT_INFO* pInfo = pCIMgr->GetFirstClient(); while (pInfo && stricmp(pInfo->sName.c_str(),szPlayerName) != 0) pInfo = pInfo->pNext; if (pInfo) { // Tell the server SendCheatMessage( CHEAT_BOOT, pInfo->nID ); } }
bool Group::OnTrigger(HOBJECT hSender, const CParsedMsg &cMsg) { // Put the message back in a string char aMsgBuff[256]; cMsg.ReCreateMsg(aMsgBuff, sizeof(aMsgBuff), 0); const char* pName; for (uint32 i=0; i < m_nNumTargets; i++) { if (m_hstrObjectNames[i]) { pName = g_pLTServer->GetStringData(m_hstrObjectNames[i]); if (pName && pName[0]) { SendTriggerMsgToObjects(this, pName, aMsgBuff); } } } return true; }
void Group::HandleAllMsgs( HOBJECT hSender, const CParsedMsg &crParsedMsg ) { char szMsgArgs[256]; crParsedMsg.ReCreateMsg( szMsgArgs, ARRAY_LEN(szMsgArgs), 0 ); if( !szMsgArgs[0] ) return; for( StringArray::iterator iter = m_saObjectNames.begin(); iter != m_saObjectNames.end(); ++iter ) { if( !(*iter).empty() ) { const char* pszObjectName = iter->c_str(); // This needs to be format string characters + // LTARRAYSIZE(szMsgArgs) + MaxObjectName characters long. char szMsg[10 + LTARRAYSIZE(szMsgArgs) + MAX_CS_FILENAME_LEN]; LTSNPrintF(szMsg, LTARRAYSIZE(szMsg), "msg %s (%s);", pszObjectName, szMsgArgs ); g_pCmdMgr->QueueCommand( szMsg, hSender, NULL ); } } }
void CCheatMgr::GimmeGun( CParsedMsg &cMsg ) { if( !g_pWeaponMgr || cMsg.GetArgCount() < 2 ) return; // The full name of the weapon might be split between several // arguments of the message so build the name from all arguments // except the name of the actual cheat (Arg 1). char szWeaponName[WMGR_MAX_NAME_LENGTH] = {0}; cMsg.ReCreateMsg( szWeaponName, sizeof( szWeaponName ), 1 ); const WEAPON *pWeapon = LTNULL; if( (szWeaponName[0] >= '0' && szWeaponName[0] <= '9') && strlen(szWeaponName) < 4 ) { pWeapon = g_pWeaponMgr->GetWeapon( atoi( szWeaponName )); } else { pWeapon = g_pWeaponMgr->GetWeapon( szWeaponName ); } char szMessage[256] = {0}; if( pWeapon ) { SendCheatMessage( CHEAT_GIMMEGUN, pWeapon->nId ); sprintf( szMessage, "Giving weapon '%s' ID: %i", pWeapon->szName, pWeapon->nId ); g_pChatMsgs->AddMessage( szMessage, kMsgCheatConfirm ); } else { sprintf( szMessage, "Weapon '%s' does not exist!", szWeaponName ); g_pChatMsgs->AddMessage( szMessage, kMsgCheatConfirm ); } }
void Controller::ShowTriggerError(const CParsedMsg &cMsg) { char aTempBuffer[256]; cMsg.ReCreateMsg(aTempBuffer, sizeof(aTempBuffer), 0); g_pLTServer->CPrint("Controller: Invalid msg: %s", aTempBuffer); }