决战私服 客户端下载 家族排行 发布决战 发布家族 玩家排行 开区一条龙 【耍决战私服网】唯一联系QQ:597584555
↓ 决战私服相关文章内容浏览 ↓
头顶排行
编辑:看决战 来源:看决战 Www.kanjuezhan.Com
BOOL COM::GetUserPaiMing()//获取玩家排名
{
int i;
SQLHSTMT hstmt;
SQLRETURN retcode;
TCHAR szSQL[2048];
CString sql = _T("");
sql.Format("SELECT TOP 50 strUserID, sLevel FROM gameuser WHERE tIsOP = 0 ORDER BY sLevel DESC");
::ZeroMemory(szSQL, sizeof(szSQL));
wsprintf(szSQL,TEXT(sql));
SQLCHAR strUserSortName[CHAR_NAME_LENGTH + 1];
SQLSMALLINT uLevel;
SQLINTEGER sInd;

::ZeroMemory(strUserSortName, sizeof(strUserSortName));
uLevel = 0;

int db_index = 0;
CDatabase* pDB = g_DB[AUTOMATA_THREAD].GetDB( db_index );
if( !pDB ) return FALSE;

retcode = SQLAllocHandle( (SQLSMALLINT)SQL_HANDLE_STMT, pDB->m_hdbc, &hstmt );
if( retcode != SQL_SUCCESS )
{
TRACE("Fail To Load UserSort Data !!\n");
AfxMessageBox(_T("SELECT GAMEUSER Table Open Fail!"));
//g_DB[AUTOMATA_THREAD].ReleaseDB(db_index);
return FALSE;
}
retcode = SQLExecDirect( hstmt, (unsigned char*)szSQL, SQL_NTS);
if( retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO )
{
int cixu = 0;
while(TRUE)
{
retcode = SQLFetch(hstmt);

if(retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
cixu++;
i = 1;
SQLGetData( hstmt, i++, SQL_C_CHAR,   &strUserSortName, sizeof(strUserSortName), &sInd );
SQLGetData( hstmt, i++, SQL_C_SSHORT, &uLevel, sizeof(uLevel), &sInd );
USER *pUser = GetUser((CHAR*)strUserSortName);
if(cixu <= 0 || cixu > 50) continue;
if(pUser != NULL && pUser->m_state == STATE_GAMESTARTED)
{
pUser->m_dwCKMiMa = cixu;
CString str = _T("");
str.Format("%s",pUser->m_strLoveName);
int pos = str.Find("]");
if(pos > 0)
{
str = str.Mid(pos + 1,str.GetLength());
}
::ZeroMemory(pUser->m_strLoveName,sizeof(pUser->m_strLoveName));
sprintf(pUser->m_strLoveName,"@9第[%d]%s名",pUser->m_dwCKMiMa,str);
CBufferEx TempBuf;
TempBuf.Add(LOVE_NAME);
TempBuf.Add(pUser->m_uid + USER_BAND);
TempBuf.AddString(pUser->m_strLoveName);
pUser->SendExactScreen(TempBuf, TempBuf.GetLength());
}
SetUserTop((CHAR*)strUserSortName,cixu);
}
else break;
}
}
else if (retcode == SQL_NO_DATA)
{
g_DB[AUTOMATA_THREAD].ReleaseDB(db_index);
return FALSE;
}
else
{
retcode = SQLFreeHandle( (SQLSMALLINT)SQL_HANDLE_STMT, hstmt);
g_DB[AUTOMATA_THREAD].ReleaseDB(db_index);
return FALSE;
}
retcode = SQLFreeHandle( (SQLSMALLINT)SQL_HANDLE_STMT, hstmt);
g_DB[AUTOMATA_THREAD].ReleaseDB(db_index);

return TRUE;
}
最新文章
推广礼包...
礼包...
选择...
经典语句-中英对照...
机械属性代码...
物品属性...
物品全部代码...
添加数据...
人物到游戏界面...
在线泡时间...
会员时间到期删除...
宠物击杀玩家给予标志...
宠物贩卖...
合成装备增加日志...
网站视频...
登录器自动练级...
脱机断线重连...
检测脚本窗口...
锁定怪物...
恭喜发财功能...
 
Copyright © 2008 -2017 决战私服网(www.shuajuezhan.com) All Rights Reserved.
本站所有游戏的版权归游戏主业所有,如无意侵犯您的权益,请联系我们,本站将会根据实际情况删除相关信息!
本站开区信息均来自互联网!游戏运营与本站无关! 苏ICP备13039161号