
winmain.cpp
Code: Select all
#define ID_BUTTON 501

we need 2 handles more
Code: Select all
HWND G_hEdt = NULL;
HWND G_hBut = NULL;
Code: Select all
LRESULT CALLBACK WndProc( HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam )
Code: Select all
case WM_COMMAND:
Code: Select all
case WM_COMMAND:
switch(wParam){
case ID_BUTTON:
char cWhat[100];
/*get value*/ GetWindowText(G_hEdt,cWhat,100);
if (cWhat != NULL) {
/*empty edit */ SetWindowText(G_hEdt,NULL);
/* set focus on edit */ SetFocus(G_hEdt);
/*command parser*/ G_pGame->ParseCommand(cWhat);
}
break;
}
break;
search for
Code: Select all
BOOL InitInstance( HINSTANCE hInstance, int nCmdShow )
Code: Select all
GetLocalTime(&SysTime);
Code: Select all
G_hEdt = CreateWindowEx(0, "EDIT", NULL, WS_EX_CLIENTEDGE | WS_CHILD | WS_VISIBLE | WS_BORDER, 5, 5, 520, 21, G_hWnd, NULL, hInstance, NULL);
G_hBut = CreateWindowEx(0, "Button", "OK", WS_CHILD | WS_VISIBLE | WS_BORDER, 530, 5, 75, 21, G_hWnd, (HMENU)ID_BUTTON, hInstance, NULL);
Code: Select all
void RequestResurrectPlayer(int iClientH, bool bResurrect);
Code: Select all
void ParseCommand(char* pMsg);
Code: Select all
void CGame::ParseCommand(char* pMsg) {
char seps[] = "= \t\n";
char * token, * token2;
class CStrTok * pStrTok;
char buff[100];
BOOL bFlag;
if (pMsg == NULL) return;
pStrTok = new class CStrTok(pMsg, seps);
token = pStrTok->pGet();
token2 = pStrTok->pGet();
bFlag = FALSE;
if (memcmp(pMsg,"/ascii ",7) == 0) {
//if (strlen(token) == 1) {
bFlag = TRUE;
char znak[1];
memcpy(znak,token,1);
wsprintf(buff,"AscII%d/%s.txt",znak[0],token);
PutLogList(buff);
}
if (memcmp(pMsg,"/say ",5) == 0) { /* dont laught at this :) */
bFlag=TRUE;
//tLogList(token2);
char ss[100];
ZeroMemory(ss,100);
memcpy(ss,pMsg,strlen(pMsg));
ss[0]=' ';
ss[1]=' ';
ss[2]=' ';
ss[3]=' ';
int i;
char*p=ss;
while(isspace(*p) && (*p))p++;
memmove(ss,p,strlen(p)+1);
wsprintf(ss,"%s",ss);
int do_ilu;
do_ilu=0;
for (i = 1; i < DEF_MAXCLIENTS; i++) {
if (m_pClientList[i] != NULL) {
ShowClientMsg(i,ss);
do_ilu++;
}
}
char buff[100];
wsprintf(buff,"(!) Message '%s' sended to %d players.",ss,do_ilu);
PutLogList(buff);
}
if ((!bFlag) && (pMsg != NULL)) {
wsprintf(buff,"(!!!) %s - invalid command",pMsg);
PutLogList(buff);
}
}
if this dont work, pm me