SA-MP/announce/announce.cpp

58 lines
1.0 KiB
C++
Raw Permalink Normal View History

2023-10-19 08:01:32 +08:00
#ifdef WIN32
2023-10-19 08:01:32 +08:00
#include <windows.h>
#endif
2023-10-25 16:54:54 +08:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "httpclient.h"
#ifdef WIN32
2023-10-19 08:01:32 +08:00
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
if(!strlen(lpszCmdLine) || strlen(lpszCmdLine) > 5) return 0;
CHttpClient* pHttpClient = new CHttpClient(NULL);
2023-10-25 16:54:54 +08:00
//OutputDebugString(lpszCmdLine);
char szURL[1025];
memset(szURL,0,sizeof(szURL));
sprintf(szURL, "server.sa-mp.com/0.3.7/announce/%s",lpszCmdLine);
pHttpClient->ProcessURL(HTTP_GET, szURL, NULL, "Bonus");
delete pHttpClient;
ExitProcess(0);
return 0;
}
#else
int main(int argc, char *argv[])
{
2023-10-25 16:54:54 +08:00
char *szBindAddress = NULL;
if((argc <= 1 || argc > 3) || strlen(argv[1]) > 5) return 0;
if(argc == 3) {
2023-10-25 16:54:54 +08:00
szBindAddress = argv[2];
}
2023-10-25 16:54:54 +08:00
CHttpClient* pHttpClient = new CHttpClient(szBindAddress);
char szURL[255];
sprintf(szURL, "server.sa-mp.com/0.3.7/announce/%s",argv[1]);
2023-10-25 16:54:54 +08:00
pHttpClient->ProcessURL(HTTP_GET, szURL, NULL, "Bonus");
delete pHttpClient;
2023-10-19 08:01:32 +08:00
return 0;
}
#endif