Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // REQUiRMENTS
- Vector3 GetCoordsInfrontOfCam(float distance)
- {
- Vector3 GameplayCamRot = GET_GAMEPLAY_CAM_ROT(2);
- Vector3 GameplayCamCoord = GET_GAMEPLAY_CAM_COORD();
- float tan = Cos(GameplayCamRot.X) * distance);
- float xPlane = Sin(GameplayCamRot.Z * -1.0f) * tan) + GameplayCamCoord.X);
- float yPlane = Cos(GameplayCamRot.Z * -1.0f) * tan) + GameplayCamCoord.Y);
- float zPlane = Sin(GameplayCamRot.X) * distance) + GameplayCamCoord.Z);
- return new Vector3(xPlane, yPlane, zPlane);
- }
- //----------------- Remove targetted Objects -----------------
- //
- // Just enable RemoveObjects Bool and shoot an object to remove it ( Client Sided )
- //
- //-----------------------------------------------------
- RemoveObjectsLoop()
- {
- if ( (RemoveObjects == true) && (IS_CONTROL_PRESSED(2,199) )
- {
- GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(PLAYER_ID(),*E ntityID)
- if (IS_ENTITY_AN_OBJECT(EntityID) == true )
- {
- DELETE_ENTITY(*EntityID)
- }
- }
- }
- //----------------- Gravity gun ( Pickup and launch ) -----------------
- //
- // Just enable GravityGun Bool and shoot an object to pick it up shoot again to launch it
- //
- // When object is picked up it makes it see through and undoes this when launched ( object moves infront of you when picked up )
- // ObjectHash[] can be used to display Hash of picked up object ( usefull for spawning uknown object Best display this in lower left under radar )
- //
- //-----------------------------------------------------
- Bool Pickup = true
- GravityGunLoop()
- {
- if (GravityGun == true)
- {
- if ( (Pickup == true) && (IS_CONTROL_PRESSED(2,199) )
- {
- Pickup = false
- GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(PLAYER_ID(),*E ntityID)
- if (IS_ENTITY_A_PED(EntityID) == true)
- {
- if (IS_PED_IN_ANY_VEHICLE(EntityID,0))
- {
- EntityID = GET_VEHICLE_PED_IS_IN(EntityID,0)
- }
- }
- SET_ENTITY_ALPHA(EntityID,200)
- }
- elseif ( (Pickup == false) && (IS_CONTROL_PRESSED(2,199) )
- {
- Pickup = true
- if (IS_ENTITY_A_PED(EntityID) == true )
- {
- SET_ENTITY_DYNAMIC(EntityID,1)
- Vector3 Rotation = GET_ENTITY_ROTATION(EntityID,2)
- SET_ENTITY_ROTATION(EntityID,GET_GAMEPLAY_CAM_ROT( 2),2,1)
- APPLY_FORCE_TO_ENTITY(EntityID,1,0,150,0,0,0,0,0,1 ,1,1,0,1)
- SET_ENTITY_ROTATION(EntityID,Rotation,2,1)
- SET_ENTITY_ALPHA(EntityID,255)
- }
- }
- else
- {
- if (DOES_ENTITY_EXIST(EntityID)==true)
- {
- Char ObjectHash[] = GET_ENTITY_MODEL(EntityID)
- SET_ENTITY_COORDS(EntityID,GetCoordsInfrontOfCam(1 0),1,0,0,1)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement