Venox
Moderator
- Messages
- 93
- Reaction score
- 73
- Points
- 808
The purpose of this thread is sharing functions.
I hope you can learn from it .
most of it is done by me.
Kick All Players From your Lobby
Clone Lobby
SuperRun (Button Bind)
Spawn WheelChair
Give other player 3Stars
I hope you can learn from it .
most of it is done by me.
Kick All Players From your Lobby
Code:
for (int i = 0; i < 16; i++)
{
int id = PLAYER::GET_PLAYER_PED(i);
if (id > 0 && id != PLAYER::PLAYER_PED_ID())
{
NETWORK_REQUEST_CONTROL_OF_ENTITY(GET_PLAYER_PED(i));
NETWORK_SESSION_KICK_PLAYER(GET_PLAYER_PED(i));
}
requestLobbyKick = false;
}
Clone Lobby
Code:
void CloneLobby()
{
for(int i = 0; i < PlayerCount(); i++)
{
if (i >= 0 && i != PlayerSelf())
{
Ped lclone_ = CLONE_PED(GET_PLAYER_PED(i), GET_ENTITY_HEADING(GET_PLAYER_PED(i)), 1, 1);
Ped* lclone = &lclone_;
SET_ENTITY_AS_NO_LONGER_NEEDED(lclone);
}
}
}
SuperRun (Button Bind)
Code:
void super_run()
{
if (CONTROLS::IS_CONTROL_JUST_PRESSED(0, Button_X))
{
ENTITY::APPLY_FORCE_TO_ENTITY(PLAYER::PLAYER_PED_ID(), true, 0, 60, 0, 0, 0, 0, true, true, true, true, false, true);
}
}
Spawn WheelChair
Code:
bool doWheelchair = false;
bool spawnWheelchair()
{
uint Handle = PLAYER::PLAYER_PED_ID();
Vector3 MyCoords = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
Vector3 null; null.x = 0, null.y = 0; null.z = 0;
Vector3 a; a.x = -0.27, a.y = -0.24, a.z = 0.13f;
Vector3 b; b.x = 0, b.y = 0, b.z = 180;
int hash = GAMEPLAY::GET_HASH_KEY("bati");
int hash2 = GAMEPLAY::GET_HASH_KEY("prop_wheelchair_01");
STREAMING::REQUEST_MODEL(hash);
STREAMING::REQUEST_MODEL(hash2);
if (STREAMING::HAS_MODEL_LOADED(hash) && STREAMING::HAS_MODEL_LOADED(hash2))
{
int Object = OBJECT::CREATE_OBJECT(hash2, null.x, null.y, null.z, 1, 0, 1);
if (ENTITY::DOES_ENTITY_EXIST(Object))
{
int Vehicle = VEHICLE::CREATE_VEHICLE(hash, MyCoords.x, MyCoords.y, MyCoords.z, ENTITY::GET_ENTITY_HEADING(Handle), 1, 0);
if (ENTITY::DOES_ENTITY_EXIST(Vehicle))
{
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), Vehicle, -1);
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
ENTITY::SET_ENTITY_VISIBLE(Vehicle, false);
UNK::ATTACH_ENTITY_TO_ENTITY(Object, Vehicle, 0, a.x, a.y, a.z, b.x, b.y, b.z, 0, 1, 0, 0, 2, 1);
ENTITY::SET_ENTITY_VISIBLE(Handle, true);
return true;
}
return false;
}
return false;
}
return false;
}
Give other player 3Stars
Code:
void vOnline3Stars(Entity eEntity)
{
if (ENTITY::DOES_ENTITY_EXIST(eEntity))
{
const int iPeds = 40;
Ped pPed[iPeds];
Vector3 Coordinates = ENTITY::GET_ENTITY_COORDS(eEntity, 0);
for (int i = 0; i < iPeds; i++)
{
pPed[i] = PED::CLONE_PED(eEntity, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()), 1, 1);
ENTITY::SET_ENTITY_COORDS(pPed[i], Coordinates.x, Coordinates.y, Coordinates.z + 25, 0, 0, 0, 1);
PED::SET_PED_AS_COP(pPed[i], true);
Wait(20);
Vector3 pPedCoordinates = ENTITY::GET_ENTITY_COORDS(pPed[i], 0);
FIRE::ADD_OWNED_EXPLOSION(eEntity, pPedCoordinates.x, pPedCoordinates.y, pPedCoordinates.z, 9, 5.0f, 0, 1, 0.0f);
PED::DELETE_PED(&pPed[i]);
}
}
}