- 2
- 0
Hey guys, I'd like to asking for help that something about this code. VS doesn't show any error or something but plugin makes game crash when I logged in to spawn. The problem could be getting packet
C++:
bool CALLBACK IncomingRPC(stRakNetHookParams *params)
{
if (params->packetId == ScriptRPCEnumeration::RPC_ScrSetPlayerMapIcon)
{
BYTE iconid;
BYTE type;
int color;
params->bitStream->ResetReadPointer();
params->bitStream->Read(iconid);
params->bitStream->Read(pos[0]);
params->bitStream->Read(pos[1]);
params->bitStream->Read(pos[2]);
params->bitStream->Read(type);
params->bitStream->Read(color);
if (type == 0)
{
if (color == 0xA50000ff)
{
int car = SF->getSAMP()->getVehicles()->GetCarHandleFromSAMPCarID(SF->getSAMP()->getPlayers()->pLocalPlayer->sCurrentVehicleID);
char _text[100];
if (_cp == false)
{
sprintf(_text, "02D3: %d %f %f %f", car, pos[0], pos[1], pos[2]);
SF->getCLEO()->callOpcode(_text);
SF->getSAMP()->getChat()->AddChatMessage(-1, "1");
_cp = true;
}
else
{
sprintf(_text, "02D3: %d ", car);
SF->getCLEO()->callOpcode(_text);
SF->getSAMP()->getChat()->AddChatMessage(-1, "Middle");
}
}
else if (color == 0x366B2CFF)
{
if (_cp == false) _cp = true;
int car = SF->getSAMP()->getVehicles()->GetCarHandleFromSAMPCarID(SF->getSAMP()->getPlayers()->pLocalPlayer->sCurrentVehicleID);
char _text[100];
sprintf(_text, "02D3: %d %f %f %f", car, pos[0], pos[1], pos[2]);
SF->getCLEO()->callOpcode(_text);
SF->getSAMP()->getChat()->AddChatMessage(-1, "1");
}
}
char _text[100];
sprintf(_text, "%d %f %f %f %d %s", iconid, pos[0], pos[1], pos[2], type, color);
SF->getSAMP()->getChat()->AddChatMessage(-1, _text);
return true;
}
return true;
}
Последнее редактирование: