Code: Select all
void CGame::AdminOrder_SetRep(int iClientH, char *pData, DWORD dwMsgSize)
{
char seps[] = "= \t\n";
char * token, cBuff[256];
class CStrTok * pStrTok;
char * rep;
char cNick[20];
char cRep[5];
char notice[100];
int oldrep;
int i;
if (m_pClientList[iClientH] == NULL) return;
if ((dwMsgSize) <= 0) return;
if (m_pClientList[iClientH]->m_iAdminUserLevel <= 8) {
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);
rep = pStrTok->pGet();
if (rep == NULL) {
delete pStrTok;
return;
}
strcpy(cRep, rep);
for (i = 0; i < DEF_MAXCLIENTS; i++) {
if ((m_pClientList[i] != NULL) && (memcmp(m_pClientList[i]->m_cCharName, cNick, strlen(cNick)) == 0)) {
oldrep = m_pClientList[i]->m_iRating;
m_pClientList[i]->m_iRating=atoi(cRep);
wsprintf(notice,"Your Reputation Count has been changed from %d to %d.",oldrep,atoi(cRep));
ShowRepNotice(iClientH,notice);
}
}
delete pStrTok;
}
Code: Select all
if (memcmp(cp, "/setrep ", 7) == 0) {
AdminOrder_SetRep(iClientH, cp, dwMsgSize - 21);
return;
}
Code: Select all
void CGame::ShowRepNotice(int iClientH,char *pMsg)
{
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, pMsg);
}
1.On GM char say "/setrep (playername) (amount)"