SF API | SENDRATE SOURCE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <windows.h>
#include <string>
#include <assert.h>
#include "CSAMPFUNCS.h"
CSAMPFUNCS *SF = new CSAMPFUNCS();
int SRType;
int SRValue;
void CALLBACK cmd_sendrate(std::string param)
{
if (param.empty()) return;
sscanf(param.c_str(), "%d %d", &SRType, &SRValue);
if (SRType == 1)
{
SF->getSAMP()->setSendRate(ONFOOTSENDRATE, SRValue);
SF->getSAMP()->getChat()->AddChatMessage(0xFFCC00, "[BLASTHACK | SENDRATE] {EAEAEA}Новое значение OnFoot SendRate установлено.");
}
else if (SRType == 2)
{
SF->getSAMP()->setSendRate(INCARSENDRATE, SRValue);
SF->getSAMP()->getChat()->AddChatMessage(0xFFCC00, "[BLASTHACK | SENDRATE] {EAEAEA}Новое значение InCar SendRate установлено.");
}
else if (SRType == 3)
{
SF->getSAMP()->setSendRate(AIMSENDRATE, SRValue);
SF->getSAMP()->getChat()->AddChatMessage(0xFFCC00, "[BLASTHACK | SENDRATE] {EAEAEA}Новое значение Aim SendRate установлено.");
}
else
{
SF->getSAMP()->getChat()->AddChatMessage(0xFFCC00, "[BLASTHACK | SENDRATE] {EAEAEA}Недопустимый параметр. 1 - OnFoot, 2 - InCar, 3 - AIM.");
}
};
void CALLBACK mainloop( void )
{
static bool init = false;
if( !init )
{
if( !SF->getSAMP()->IsInitialized() )
return;
SF->getSAMP()->registerChatCommand("sendrate", cmd_sendrate);
SF->getSAMP()->getChat()->AddChatMessage(0xFFCC00, "[BLASTHACK | SENDRATE] {EAEAEA}SendRate plugin by hnnssy loaded.");
init = true;
}
}
BOOL APIENTRY DllMain( HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved )
{
switch ( dwReasonForCall )
{
case DLL_PROCESS_ATTACH:
SF->initPlugin( mainloop, hModule );
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}