- 157
- 69
По названию темы думаю все понятно.
Админ даёт вам поджопник - Вас не подбрасывает.
Залезаете на крышу кара с водилой - вас не тпшит обратно на землю.
Команды:
/AntiSlap - анти поджопник
/RoofCar - езда на крыше авто
Админ даёт вам поджопник - Вас не подбрасывает.
Залезаете на крышу кара с водилой - вас не тпшит обратно на землю.
Команды:
/AntiSlap - анти поджопник
/RoofCar - езда на крыше авто
C++:
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include <windows.h>
#include <string>
#include <assert.h>
#include <process.h>
#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"
#include "ini_file.h"
SAMPFUNCS *SF = new SAMPFUNCS();
bool ActivateRoofCar, AntiSlap, StatusRoofCar;
void CALLBACK AntiSlapCMD(std::string)
{
AntiSlap ^= true;
if (AntiSlap)
{
SF->getSAMP()->getChat()->AddChatMessage(0xff03ae53, "<AntiSlap> {ffffff}on");
set_int_to_ini("SAMPFUNCS\\PosSettings.ini", "Settings", "AntiSlap", 1);
}
else if (!AntiSlap)
{
SF->getSAMP()->getChat()->AddChatMessage(0xffff0000, "<AntiSlap> {ffffff}off");
set_int_to_ini("SAMPFUNCS\\PosSettings.ini", "Settings", "AntiSlap", 0);
}
}
void CALLBACK roofcarCMD(std::string)
{
ActivateRoofCar ^= true;
if (ActivateRoofCar)
{
SF->getSAMP()->getChat()->AddChatMessage(0xff03ae53, "<RoofingCar> {ffffff}on");
set_int_to_ini("SAMPFUNCS\\PosSettings.ini", "Settings", "RoofingCar", 1);
}
else if (!ActivateRoofCar)
{
SF->getSAMP()->getChat()->AddChatMessage(0xffff0000, "<RoofingCar> {ffffff}off");
set_int_to_ini("SAMPFUNCS\\PosSettings.ini", "Settings", "RoofingCar", 0);
}
}
bool CALLBACK RPC(stRakNetHookParams *params)
{
if (params->packetId == ScriptRPCEnumeration::RPC_ScrSetPlayerPos)
{
float SetPlayerPos[3], MyPos[3], diff;
params->bitStream->ResetReadPointer();
params->bitStream->Read(SetPlayerPos);
stOnFootData *pPlayer = SF->getSAMP()->getPlayers()->GetOnFootData(SF->getSAMP()->getPlayers()->sLocalPlayerID);
MyPos[0] = pPlayer->fPosition[0];
MyPos[1] = pPlayer->fPosition[1];
MyPos[2] = pPlayer->fPosition[2];
diff = SetPlayerPos[2] - MyPos[2];
if (AntiSlap && diff >= 4.9 && diff <= 5.1) return false;
if (ActivateRoofCar && StatusRoofCar)
{
float SummaMyPos = MyPos[0] + MyPos[1] + MyPos[2], SummaIncPos = SetPlayerPos[0] + SetPlayerPos[1] + SetPlayerPos[2], dif;
dif = SummaMyPos - SummaIncPos;
if (dif < 300.0 || dif > -300.0) return false;
}
}
if (params->packetId == ScriptRPCEnumeration::RPC_ScrSetCameraBehindPlayer && StatusRoofCar) return false;
return true;
}
bool CALLBACK out_packet(stRakNetHookParams *params)
{
if (params->packetId == PacketEnumeration::ID_PLAYER_SYNC && ActivateRoofCar)
{
stOnFootData data;
memset(&data, 0, sizeof(stOnFootData));
params->bitStream->ResetReadPointer();
params->bitStream->IgnoreBits(8);
params->bitStream->Read((PCHAR)&data, sizeof(stOnFootData));
int idvehsurf = data.sSurfingVehicleID;
if (idvehsurf != 0) StatusRoofCar = true;
else StatusRoofCar = false;
}
return true;
}
void CALLBACK mainloop()
{
static bool init = false;
if (!init)
{
if (GAME == nullptr)
return;
if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
return;
if (!SF->getSAMP()->IsInitialized())
return;
init = true;
SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC, RPC);
SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_OUTCOMING_PACKET, out_packet);
SF->getSAMP()->registerChatCommand("roofcar", roofcarCMD);
SF->getSAMP()->registerChatCommand("antislap", AntiSlapCMD);
SF->getSAMP()->getChat()->AddChatMessage(-1, "Езда на крыше автомобиля && AntiSlap by {01fcff}Jenek Bueno. {ffffff}CMD: /antislap /roofcar");
if (!ini_file_exist("SAMPFUNCS\\PosSettings.ini"))
{
create_ini_file("SAMPFUNCS\\PosSettings.ini");
set_int_to_ini("SAMPFUNCS\\PosSettings.ini", "Settings", "RoofingCar", 0);
set_int_to_ini("SAMPFUNCS\\PosSettings.ini", "Settings", "AntiSlap", 0);
}
int a = get_int_from_ini("SAMPFUNCS\\PosSettings.ini", "Settings", "RoofingCar");
int b = get_int_from_ini("SAMPFUNCS\\PosSettings.ini", "Settings", "AntiSlap");
if (a == 1) ActivateRoofCar = true;
else ActivateRoofCar = false;
if (b == 1) AntiSlap = true;
else AntiSlap = false;
}
}
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;
}
Вложения
Последнее редактирование: