PHP Code:
///****** LEVITATION BY K3R3D0R ******///
////////////
////////////
// Controls:
//
// Mode select = DPad Right
//
// Levitate = xbox-A / ps3-X
//
#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>
#define L2 0x5
#define R2 0x7
#define R1 0x6
#define DPAD_UP 0x8
#define DPAD_RIGHT 0xB
#define X 0x10
#define SQUARE 0xE
Vehicle closestcar, car, pcar;
int netid, pnetid, b;
float x, y, z, px, py, pz, mx, my, mz, distance;
int mode=0;
int button_select=0;
Ped* chararray[16];
bool RequestNet(uint netid)
{
uint i = 0;
while ( !REQUEST_CONTROL_OF_NETWORK_ID(netid) && i < 10 )
{
i++;
WAIT(100);
}
return HAS_CONTROL_OF_NETWORK_ID(netid);
}
void scalevector(float *x, float *y, float *z, float scale)
{
if (*x != 0 || *y != 0 || *z != 0)
{
float Dist = SQRT(POW(*x,2) + POW(*y,2) + POW(*z,2));
*x = (*x / Dist) * scale;
*y = (*y / Dist) * scale;
*z = (*z / Dist) * scale;
}
}
Vehicle GetCurrentPlayerVehicle(void)
{
Vehicle pVehicle;
GET_CAR_CHAR_IS_USING(GetPlayerPed(), &pVehicle);
return pVehicle;
}
void anims(void)
{
REQUEST_ANIMS("missgambetti1");
while(!HAVE_ANIMS_LOADED("missgambetti1")) WAIT(0);
TASK_PLAY_ANIM_WITH_FLAGS(GetPlayerPed(),"handsup","missgambetti1",8.0,0,0);
}
void levitate(void)
{
GET_CHAR_COORDINATES(GetPlayerPed(), &mx, &my, &mz);
closestcar = GET_CLOSEST_CAR(mx, my, mz, 100, 0, 70);
if( DOES_VEHICLE_EXIST(closestcar))
{
GET_NETWORK_ID_FROM_VEHICLE(closestcar, &netid);
if (RequestNet(netid))
{
if(!IS_CAR_STUCK_ON_ROOF(closestcar))
{
APPLY_FORCE_TO_CAR(closestcar, 0.0f, 0.0f, 0.0f, 100.0f , 0.0f,0.0f,0.0f, 0, 1, 1, 1 );
if(IS_BUTTON_PRESSED(0, R2))
{
if(RequestNet(closestcar))
{
if(DOES_VEHICLE_EXIST(closestcar))
{
SET_CAR_CAN_BE_DAMAGED(closestcar, true);
SET_CAR_CAN_BE_VISIBLY_DAMAGED(closestcar, true);
EXPLODE_CAR(closestcar, true, false);
}
}
}
if(IS_BUTTON_PRESSED(0, R1))
{
if(RequestNet(closestcar))
{
if(DOES_VEHICLE_EXIST(closestcar))
{
DELETE_CAR(&closestcar);
}
}
}
}
else
{
SET_CAR_ON_GROUND_PROPERLY(closestcar);
APPLY_FORCE_TO_CAR(closestcar, 0.0f, 0.0f, 0.0f, 100.0f , 0.0f,0.0f,0.0f, 0, 1, 1, 1 );
}
}
}
}
void levitate_peds(void)
{
float x, y, z;
bool searchdelpid = true;
Ped myped = GetPlayerPed();
int leviped, levipedid = -1;
GET_CHAR_COORDINATES(myped, &x, &y, &z);
while (searchdelpid)
{
levipedid++;
if ( levipedid > 10000 )
searchdelpid = false;
GET_PED_FROM_NETWORK_ID(levipedid, &leviped);
if ( DOES_CHAR_EXIST(leviped) )
{
if ( IS_CHAR_IN_AREA_2D(leviped, x+60.0f, y+60.0f, x-60.0f, y-60.0f, false) )
{
if ( myped == leviped )
continue;
if ( RequestNet(levipedid) )
APPLY_FORCE_TO_PED(leviped,true,0.0,0.0,20,0.0,0.0,0.0,true,true,true,true);
}
if(IS_BUTTON_PRESSED(0, R1))
{
GET_CHAR_COORDINATES(leviped, &x, &y, &z);
ADD_EXPLOSION(x, y, z, EXPLOSION_SHIP_DESTROY, 7.50, 1, 0, 0.7);
}
}
}
}
void suck_peds(void)
{
float cx, cy, cz, fx, fy, fz;
bool searchdelpid = true;
Ped myped = GetPlayerPed();
int leviped, levipedid = -1;
while (searchdelpid)
{
levipedid++;
if ( levipedid > 10000 )
searchdelpid = false;
GET_PED_FROM_NETWORK_ID(levipedid, &leviped);
if ( DOES_CHAR_EXIST(leviped) )
{
GET_CHAR_COORDINATES(myped, &x, &y, &z);
if ( IS_CHAR_IN_AREA_2D(leviped, x+60.0f, y+60.0f, x-60.0f, y-60.0f, false) )
{
if ( myped == leviped )
continue;
if ( RequestNet(levipedid) )
{
GET_CHAR_COORDINATES(leviped, &cx, &cy, &cz);
fx = x - cx;
fy = y - cy;
fz = z - cz;
scalevector(&fx, &fy, &fz, 40);
if(!IS_CHAR_IN_ANY_CAR(leviped))
{
APPLY_FORCE_TO_PED(leviped, true, fx, fy, fz, 0, 0, 0, true, false, true, true);
}
}
}
}
}
}
void levitate_all(void)
{
float x, y, z, fx, fy, fz;
bool searchdelid = true;
int pedcar, levicarid = -1;
int mycar = GetCurrentPlayerVehicle();
GET_CHAR_COORDINATES(GetPlayerPed(), &x, &y, &z);
while (searchdelid)
{
levicarid++;
if ( levicarid > 10000 )
searchdelid = false;
GET_VEHICLE_FROM_NETWORK_ID(levicarid, &pedcar);
if ( DOES_VEHICLE_EXIST(pedcar) )
{
if ( IS_CAR_IN_AREA_2D(pedcar, x+60.0f, y+60.0f, x-60.0f, y-60.0f, false) )
{
if ( mycar == pedcar )
continue;
if ( RequestNet(levicarid) )
{
if(!HAS_CONTROL_OF_NETWORK_ID(levicarid)) continue;
{
APPLY_FORCE_TO_CAR(pedcar, true, 0, 0, 8.0f, 0, 0, 0, true, true, true, true);
GET_CAR_COORDINATES(pedcar,&fx, &fy, &fz);
ADD_EXPLOSION(fx , fy , fz, EXPLOSION_MOLOTOV, 7.50, 1, 0, 0);
}
}
}
}
}
}
void mode_select(void)
{
if((mode==0) && (IS_BUTTON_JUST_PRESSED(0, DPAD_RIGHT)))
{
mode = 1;
print("~y~Ped Only Mode Enabled");
WAIT(100);
}
if((mode==1) && (IS_BUTTON_JUST_PRESSED(0, DPAD_RIGHT)))
{
mode = 2;
print("~y~Ped Hoover Mode Enabled");
WAIT(100);
}
if((mode==2) && (IS_BUTTON_JUST_PRESSED(0, DPAD_RIGHT)))
{
mode = 3;
print("~y~Levitation Mode Enabled");
WAIT(100);
}
if((mode==3) && (IS_BUTTON_JUST_PRESSED(0, DPAD_RIGHT)))
{
mode = 0;
print("~y~Car Only Mode Enabled");
WAIT(100);
}
}
void activate_button(void)
{
if(IS_BUTTON_PRESSED(0, X))
{
if(mode==0)
{
levitate();
}
if(mode==1)
{
levitate_peds();
}
if(mode==2)
{
suck_peds();
}
if(mode==3)
{
levitate_all();
if(!IS_CHAR_PLAYING_ANIM(GetPlayerPed(), "missgambetti1", "handsup") )
{
anims();
}
}
}
}
void main(void)
{
THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "~y~LEVITATION ~COL_NET_4~BY ~BLIP_90~ ~BLIP_83~ ~BLIP_27~ ~BLIP_83~ ~BLIP_53~ ~BLIP_52~ ~BLIP_27~", 5000, 1);
while(TRUE)
{
activate_button();
mode_select();
WAIT(0);
}
}