Forum: GTA IV Mod Releases / W.I.P.s


The above video goes away if you are a member and logged in, so log in now!




 
Would you like to get all the new info from
PSX-Scene in your email each day?




Want to learn more about the team keeping you up to date with the latest scene news?

Read about them now!

Check out our Developer bios, too!

 


User Tag List

Like Tree7Likes

Thread: [release] Explosive Pistol (credits to jumper for his hard work)
  

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 26
  1. #1 [release] Explosive Pistol (credits to jumper for his hard work) 
    JDMAlex's Avatar
    JDMAlex is offline & developer
    Join Date
    Nov 2010
    Posts
    723
    Downloads
    5
    Uploads
    1
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    190
    Likes Received
    442
    --- read me

    just modified jumpers object launcher code a bit to blow up at a certain distance its by far perfect but I will build on it.

    jumpers object launcher: http://psx-scene.com/forums/f276/gta...tml#post995535

    ----------



    New version .. select pistol and shoot , r1 to choose explosion type.. added ship destroy explosion and set check collision on object so now it explodes on impact not distance creds to zorg93 for the idea

    download sco here: http://www.mediafire.com/?5ccxd0fljc88t5n

    enjoy

    Code:
    #include <natives.h>
    #include <common.h>
    #include <strings.h>
    #include <types.h>
    #include <consts.h>
    
    
    
    #define L1         0x4
    #define L2         0x5
    #define R1         0x6
    #define R2         0x7
    #define DPAD_UP    0x8
    #define DPAD_DOWN  0x9
    #define DPAD_LEFT  0xA
    #define DPAD_RIGHT 0xB
    #define START      0xC
    #define SELECT     0xD
    #define SQUARE     0xE
    #define TRIANGLE   0xF
    #define X          0x10
    #define CIRCLE     0x11
    #define STICK_L    0x12  // L3
    #define STICK_R    0x13  // R3
    
    
    
    int justshot = 0;
    int wep;
    Object ObjectProjectile;
    int wepCheck;
    float prjX, prjY, prjZ, prjT, gcX, gcY, gcZ, gcrotX, gcrotY, gcrotZ, objrotX, objrotZ;
    Camera game_cam;
    float charX, charY, charZ , Object_X, Object_Y, Object_Z , dist;
    float expx,expy,expz;
    bool ChangeExpType=2; //Sets to rocket first
    bool exp=0;
    
    
    void Print(char *string,uint Time)
    {
    	PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", string, Time, 1);
    }
    void MainLoop()
    {
    	
    	GET_CURRENT_CHAR_WEAPON(GetPlayerPed(), &wepCheck);
    	if(wep == WEAPON_PISTOL)
    	{
    	//SET_TEXT_DROPSHADOW(1, 0, 0, 0, 255);
    	//SET_TEXT_SCALE(0.2f, 0.2f);
    	//DISPLAY_TEXT_WITH_STRING(0.832f, 0.069f, "STRING", "SPECAL");
    	
    	GET_GAME_CAM(&game_cam);
    	if (IS_CAM_ACTIVE(game_cam))
    	{
    		GET_CAM_ROT(game_cam, &gcrotX, &gcrotY, &gcrotZ);// used for setting the object rotation and for some weird trig stuff below
    		GET_CAM_POS(game_cam, &gcX, &gcY, &gcZ);// used for the spawn point of the object, because the player is offset while aiming
    		if (gcrotX < 0.0)// the range for cam rot is -180 to 180, to set object rot we need 0 to 360
    		{
    			objrotX = gcrotX + 360.0;
    		}
    		else
    		{
    			objrotX = gcrotX;
    		}
    		if (gcrotZ < 0.0)
    		{
    			objrotZ = gcrotZ + 360.0;
    		}
    		else
    		{
    			objrotZ = gcrotZ;
    		}
    		/*  the trig stuff below could possibly be replaced with vectors, I have no idea how to do that though.  *
    		*   I apologize if this is confusing, but if you want to change the distance from the game_cam that the  *
    		*   object is spawned, adjust "3.0" to your preference on the first and fourth lines.  Also prjT is the  *
    		*   adjacent side from the pitch calculation, its purpose is to be the tangent in the following 2 lines */
    		prjT = (3.0 * COS(gcrotX));       // adj side calculation to be used as a tangent below
    		prjX = gcX - (prjT * SIN(gcrotZ));// calculates how far to spawn the object from the game_cam on the X plane
    		prjY = gcY + (prjT * COS(gcrotZ));// calculates how far to spawn the object from the game_cam on the Y plane
    		prjZ = gcZ + (3.0 * SIN(gcrotX)); // calculates how far to spawn the object from the game_cam on the Z plane
    	}
    	}
    }
    
    void Actions()
    {
    	GET_CURRENT_CHAR_WEAPON(GetPlayerPed(), &wep);
    	if((wep == WEAPON_PISTOL) && (IS_CHAR_SHOOTING(GetPlayerPed())))
    	{
    		
    		REQUEST_MODEL(0x8F2A7EB3);
    		while(!HAS_MODEL_LOADED(0x8F2A7EB3))
    		{
    			WAIT(0);
    		}
    		
    		CREATE_OBJECT(0x8F2A7EB3, prjX, prjY, prjZ, &ObjectProjectile, 1);
    		SET_OBJECT_VISIBLE(ObjectProjectile, 0);
    		MARK_MODEL_AS_NO_LONGER_NEEDED(0x8F2A7EB3);
    		if(DOES_OBJECT_EXIST(ObjectProjectile))
    		{
    			SET_OBJECT_AS_STEALABLE(ObjectProjectile, 1);
    			SET_OBJECT_ROTATION(ObjectProjectile, objrotX, 0.0, objrotZ);
    			SET_OBJECT_RECORDS_COLLISIONS(ObjectProjectile, true);
    			SET_OBJECT_DYNAMIC(ObjectProjectile, 1);
    			APPLY_FORCE_TO_OBJECT(ObjectProjectile, 1, 0.0, 90.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 1, 1);
    			WAIT(100);
    			justshot = 1;
    
    		}
    	}
    	
    }
    
    void ExplosionSelec(void)
    {
    	if(wep == WEAPON_PISTOL)
    	{
    		if((exp==0)&& (IS_BUTTON_JUST_PRESSED(0,R1))) { ChangeExpType=1; exp=1; Print("EXPLOSION_MOLOTOV" , 200);}
    		else if((exp==1)&& (IS_BUTTON_JUST_PRESSED(0,R1))) { ChangeExpType=2; exp=2; Print("EXPLOSION_ROCKET" , 200);}
    		else if((exp==2)&& (IS_BUTTON_JUST_PRESSED(0,R1))) { ChangeExpType=3; exp=3; Print("EXPLOSION_HI_OCTANE" , 200); }
    		else if((exp==3)&& (IS_BUTTON_JUST_PRESSED(0,R1))) { ChangeExpType=4; exp=4; Print("EXPLOSION_PETROL_PUMP" , 200);}
    		else if((exp==4)&& (IS_BUTTON_JUST_PRESSED(0,R1))) { ChangeExpType=5; exp=0; Print("EXPLOSION_SHIP_DESTROY" , 200);}
    		
    	}
    }
    void blowupobject()
    {
    	if(justshot==1)
    	{
    		if (HAS_OBJECT_COLLIDED_WITH_ANYTHING(ObjectProjectile ))	
    		{	
    			WAIT(200);
    			GET_OBJECT_COORDINATES(ObjectProjectile, &expx,&expy,&expz);
    			// press r1 to select explosives 
    			if(ChangeExpType==1){ ADD_EXPLOSION(expx,expy,expz, EXPLOSION_MOLOTOV, 7.50, 1, 0, 0.7);   }
    			else if(ChangeExpType==2){ ADD_EXPLOSION(expx,expy,expz, EXPLOSION_ROCKET, 7.50, 1, 0, 0.7); }
    			else if(ChangeExpType==3){ ADD_EXPLOSION(expx,expy,expz, EXPLOSION_HI_OCTANE, 7.50, 1, 0, 0.7);}
    			else if(ChangeExpType==4){ ADD_EXPLOSION(expx,expy,expz, EXPLOSION_PETROL_PUMP, 7.50, 1, 0, 0.7); }
    			else if(ChangeExpType==5){ ADD_EXPLOSION(expx,expy,expz, EXPLOSION_SHIP_DESTROY, 7.50, 1, 0, 0.7); }
    			//cleanup object
    			if(DOES_OBJECT_EXIST(ObjectProjectile)) { DELETE_OBJECT(&ObjectProjectile);}
    			justshot = 0;		
    		}
    		
    	}
    }
    void main(void)
    {
    	THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
    	while(true)
    	{
    		WAIT(0);
    		MainLoop();
    		Actions();
    		ExplosionSelec();
    		blowupobject();
    	}
    }






    first version:


    select the pistol , hold L2 to aim and R2 to fire (just the same as firing a gun aiming) ... to select different explosive type press R1 while on pistol

    - download http://www.mediafire.com/?8nnd9a532o6s95m

    ps: you can add this to EvilB's trainer in one of the modslots. also if you hold R2 slightly you can fire without firing the pistol




    Spoiler

    Last edited by JDMAlex; 09-10-2012 at 09:39 PM.
    Reply With Quote  

  2. #2  
    Join Date
    May 2012
    Location
    Etats-Unis
    Posts
    50
    Downloads
    2
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    29
    Likes Received
    8
    Good man
    Reply With Quote  

  3. #3  
    almog123z is offline Member
    Join Date
    May 2012
    Posts
    17
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    3
    Likes Received
    0
    amazing love u man thanks for this
    good work
    Reply With Quote  

  4. #4  
    zorg93's Avatar
    zorg93 is online now Developer
    Join Date
    Jun 2012
    Posts
    256
    Downloads
    0
    Uploads
    0
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    50
    Likes Received
    142
    you know you could just get the offsets from your right hand using GET_PED_BONE_POSITION or attach an object to your hand and get its coordinates, then set an object to go in that direction and get the aiming that way
    Reply With Quote  

  5. #5  
    JDMAlex's Avatar
    JDMAlex is offline & developer
    Join Date
    Nov 2010
    Posts
    723
    Downloads
    5
    Uploads
    1
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    190
    Likes Received
    442
    didn't know but thanks for sharing ..do you have an example?
    Reply With Quote  

  6. #6  
    almog123z is offline Member
    Join Date
    May 2012
    Posts
    17
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    3
    Likes Received
    0
    alex do u have skype i need ur help with my codes that i was working on
    Reply With Quote  

  7. #7  
    almog123z is offline Member
    Join Date
    May 2012
    Posts
    17
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    3
    Likes Received
    0
    Quote Originally Posted by JDMAlex View Post
    didn't know but thanks for sharing ..do you have an example?
    hiii alex will u can add me on skype becuse i need abit off help with my codes if u dont mind thanks
    skype: almog123z
    Reply With Quote  

  8. #8  
    JDMAlex's Avatar
    JDMAlex is offline & developer
    Join Date
    Nov 2010
    Posts
    723
    Downloads
    5
    Uploads
    1
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    190
    Likes Received
    442
    sorry no I don't.
    Reply With Quote  

  9. #9  
    almog123z is offline Member
    Join Date
    May 2012
    Posts
    17
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    3
    Likes Received
    0
    Quote Originally Posted by JDMAlex View Post
    sorry no I don't.
    why? soo will u can help me on here
    in a pm
    Reply With Quote  

  10. #10  
    jumper's Avatar
    jumper is online now Developer
    Join Date
    Jul 2005
    Posts
    288
    Downloads
    3
    Uploads
    0
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    74
    Likes Received
    207
    Looks pretty cool. I really wish I could figure out how this was done, it would make stuff like this SO much easier.

    And the ped bone thing is a good idea, but I don't know how accurate that would be, and I don't know if you can attach objects to ped bones either.
    Reply With Quote  

Page 1 of 3 1 2 3 LastLast
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •