Autor Wiadomość
Nigga
PostWysłany: Wto 14:38, 18 Mar 2008    Temat postu: [CODE] Give Experience

Kod:
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 == 4) { 
  SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_ADMINUSERLEVELLOW, NULL, NULL, NULL, NULL);
  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[i] != NULL) && (memcmp(m_pClientList[i]->m_cCharName, cNick, strlen(cNick)) == 0)) {
oldExp = m_pClientList[i]->m_iExp;
newExp = m_pClientList[i]->m_iExp+atoi(cExp);
      m_pClientList[i]->newExp;
      SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_RATINGPLAYER, NULL, NULL, NULL, NULL);
wsprintf(notice,"Experiencia fue agregada al jugador %s departe de %d para %d.",m_pClientList[iClientH]->m_cCharName,oldExp,newExp);
ShowNotice(iClientH,notice);
    }
  }
  delete pStrTok;
}





SHOW NOTICE :

Code:
Kod:

void CGame::ShowNotice(int iClientH,char *pMsg) { SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, pMsg); }








USAGE :

Code:

Kod:
if (memcmp(cp, "/giveexp ", 8) == 0) { AdminOrder_GivePlayerExp(iClientH, cp, dwMsgSize - 21); return; }


Powered by phpBB © 2001,2002 phpBB Group