void AccountManager::exitServer(int ingameid)
{
	auto acc = accounts.find(ingameid);
	if (acc == accounts.end())
	{
		return;
	}
	SendClientMessageToAll(0xFFFFFFFF, STR(acc->second->getLogName() << UID(acc->second) << "离开服务器.").c_str());
	accounts.erase(acc);
}
std::shared_ptr<Account> AccountManager::enterServer(int ingameid)
{
	AccountInfo info;
	info.ingameid = ingameid;
	info.session = clock();
	info.logname = getPlayerNameFixed(info.ingameid);

	auto r = accounts.insert(std::make_pair(ingameid, std::make_shared<Account>(info, datasource)));
	if (r.first == accounts.end())
	{
		std::cout << "[AccountManager] Warning: enterServer failed.\n";
		return findAccount(-1);
	}

	SendClientMessageToAll(0xFFFFFFFF, STR(r.first->second->getLogName() << UID(r.first->second) << "进入服务器.").c_str());

	return r.first->second;
}
Ejemplo n.º 3
0
static void SAMPGDK_CALL MoneyGrubScoreUpdate(int timerid, void *param)
{
  int CashScore;
  char name[MAX_PLAYER_NAME];
  char string[128];
  for(int i=0; i<MAX_PLAYERS; i++)
  {
    if (IsPlayerConnected(i))
    {
      GetPlayerName(i, name, MAX_PLAYER_NAME);
         CashScore = GetPlayerMoney(i);
      SetPlayerScore(i, CashScore);
      if (CashScore > CashScoreOld)
      {
        CashScoreOld = CashScore;
        sprintf(string, "$$$ %s is now in the lead $$$", name);
        SendClientMessageToAll(COLOR_YELLOW, string);
      }
    }
  }
}