示例#1
0
bool MySQL::UpdateServerPC(unsigned int id, unsigned int curplayer, unsigned int maxplayer)
{
    LobbyServerInfo Info;
    if(!GetServerInfo(id, &Info))
        return false;

    char query[1024];
    snprintf(query, 1024, "UPDATE `lobby_servers` SET `curplayer` = '%u', `maxplayers` = '%u' WHERE `id` = '%u';", curplayer, maxplayer, id);

    if(!DoQuery(query))
        return false;

    LOG.lprintf("Server %s aktualisiert: Aktuelle Spielerzahl: %u/%u->%u/%u\n", Info.getName().c_str(), Info.getCurPlayers(), Info.getMaxPlayers(), curplayer, maxplayer);
    return true;
}
示例#2
0
bool MySQL::DeleteServer(unsigned int id)
{
    LobbyServerInfo Info;
    if(!GetServerInfo(id, &Info))
        return false;

    char query[1024];
    snprintf(query, 1024, "DELETE FROM `lobby_servers` WHERE `id` = %u LIMIT 1;", id);

    if(!DoQuery(query))
        return false;

    LOG.lprintf("Server %s entfernt\n", Info.getName().c_str());
    return true;
}
/**
 *  aktualisiert den Mapnamen in einem Servereintrag.
 *
 *  @author FloSoft
 */
void LobbyServer::OnNMSLobbyServerUpdateMap(unsigned int id, const std::string& map)
{
    LobbyPlayer& player = players[id];

    if(player.updateHost(map))
    {
        LobbyServerInfo info;
        MYSQLCLIENT.GetServerInfo(player.getServerId(), &info);

        std::stringstream text;
        text << player.getName() << " created the server " << info.getName();
        SendToAll(LobbyMessage_Chat("SYSTEM", text.str()));

        // Spielerliste aktualisieren
        SendServerList(0xFFFFFFFF);
    }
}
示例#4
0
bool MySQL::UpdateServer(unsigned int id, const std::string& map)
{
    LobbyServerInfo Info;
    if(!GetServerInfo(id, &Info))
        return false;

    char map2[256];
    mysql_real_escape_string(m_pMySQL, map2, map.c_str(), (unsigned long)map.length());

    char query[1024];
    snprintf(query, 1024, "UPDATE `lobby_servers` SET `map` = '%s' WHERE `id` = '%u';", map2, id);

    if(!DoQuery(query))
        return false;

    LOG.lprintf("Server %s aktualisiert: Karte: %s->%s\n", Info.getName().c_str(), Info.getMap().c_str(), map.c_str());
    return true;
}