void CGame::AdminOrder_GivePlayerExp(int iClientH, char *pData, DWORD dwMsgSize)
{
char seps[] = "= \t\n";
char * token, cBuff[256];
class CStrTok * pStrTok;
char * Exp;
char cNick[20];
char cExp[5];
char notice[100];
int oldExp;
int newExp;
int i;
if (m_pClientList[iClientH] == NULL) return;
if ((dwMsgSize) <= 0) return;
if (m_pClientList[iClientH]->m_iAdminUserLevel == 0) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_ADMINUSERLEVELLOW, NULL, NULL, NULL, NULL); //if user is not enuf admin lvl
return;
}
ZeroMemory(cBuff, sizeof(cBuff));
memcpy(cBuff, pData, dwMsgSize);
pStrTok = new class CStrTok(cBuff, seps);
token = pStrTok->pGet();
token = pStrTok->pGet();
if (token == NULL) {
delete pStrTok;
return;
}
strcpy(cNick, token);
exp = pStrTok->pGet();
if (exp == NULL) {
delete pStrTok;
return;
}
strcpy(cExp, exp);
for (i = 0; i < DEF_MAXCLIENTS; i++) {
if ((m_pClientList != NULL) && (memcmp(m_pClientList->m_cCharName, cNick, strlen(cNick)) == 0)) {
oldExp = m_pClientList->m_iExp;
newExp = m_pClientList->m_iExp+atoi(cExp);
m_pClientList->newExp;
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_RATINGPLAYER, NULL, NULL, NULL, NULL);
wsprintf(notice,"Exp Count has been increased for player %s from %d to %d.",m_pClientList[iClientH]->m_cCharName,oldExp,newExp);
ShowNotice(iClientH,notice);
}
}
delete pStrTok;
}
void CGame::ShowNotice(int iClientH,char *pMsg)
{
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, pMsg);
}
if (memcmp(cp, "/giveExp ",== 0) {
AdminOrder_GivePlayerExp(iClientH, cp, dwMsgSize - 21);
return;
}
let gm reward players with exp. was in school when i wrote this, try it see if it works.
