ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 1635

Fix object protection

by carlos_20 - 05-28-2020 - 09:10 PM
#1
I have the protection of objects but I cannot get it to work online objects stick to me and they are not erased

//LOOP//
if (attachobject && AttachPreventionDelay < GAMEPLAY::GET_GAME_TIMER())
{
DeleteNearbyProps(true);
AttachPreventionDelay = GAMEPLAY::GET_GAME_TIMER() + 1000;
}


void DeleteNearbyProps(bool CheckAttached)
{
float Range = 2.0f;
if (!CheckAttached)
Range = 10.0f;

Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), false);
for (int i = 0; i < 132; i++)
{
int obj = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE1(playerPosition.x, playerPosition.y, playerPosition.z, Range, Props[i], false, false, true);

if (ENTITY::DOES_ENTITY_EXIST(obj))
{
bool Contin = true;
if (CheckAttached)
{
if (ENTITY::GET_ENTITY_ATTACHED_TO(obj) != PLAYER::PLAYER_PED_ID())
Contin = false;
}
if (Contin)
{
if (NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(obj) && NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(obj))
{
ENTITY::DETACH_ENTITY(obj, 1, 1);
ENTITY::SET_ENTITY_COORDS(obj, 6000.0, 6000.0, 6000.0, true, false, false, true);
ENTITY::DELETE_ENTITY(&obj);
}
}
}
}
}
Reply
#2
This wont help you
2021 Best Be Better Then 2020
Reply
#3
you sure you do everything the first time
Reply

Users browsing: 2 Guest(s)