What's new

Solved JDM Alex - Explosion Pistol Problem

  • Thread starter higuy0900
  • Start date
  • Views 664
higuy0900

higuy0900

Enthusiast
Messages
435
Reaction score
166
Points
115
Sin$
0
This should probably be in the Support section but nobody really gets any views let alone help in there =P

Ok iv tried to compile JDM Alex's Explosion Pistol source to see how certain scripts work. Now I compiled the version completely clean no edits just put it through my compiler and ran it through that program that condenses sco's or what ever it does and put it in a mod slot. Now here is the problem... It wont work... lol. Iv tried putting it in a new mod loader i have tried putting in xbox controls instead of the PS3 ones but no luck... What im thinking is it may be my compiler but its unlikely because i use it to compile everything i do.

Anything iv missed that i could try? Im at a loss. If anybody could help me with that d be willing to pay with PayPal. I really need this to work =P

Thanks guys~

source
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();
}
}

P.S. If its in the code and you can fix it do so and send it to me along with your PayPal credentials in a PM and ill pay you as soon as i get back from work tomorrow.
 
1223323323

12332323

Enthusiast
Modder
Messages
176
Reaction score
84
Points
125
Sin$
0
This should probably be in the Support section but nobody really gets any views let alone help in there =P

Ok iv tried to compile JDM Alex's Explosion Pistol source to see how certain scripts work. Now I compiled the version completely clean no edits just put it through my compiler and ran it through that program that condenses sco's or what ever it does and put it in a mod slot. Now here is the problem... It wont work... lol. Iv tried putting it in a new mod loader i have tried putting in xbox controls instead of the PS3 ones but no luck... What im thinking is it may be my compiler but its unlikely because i use it to compile everything i do.

Anything iv missed that i could try? Im at a loss. If anybody could help me with that d be willing to pay with PayPal. I really need this to work =P

Thanks guys~

source
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();
}
}

P.S. If its in the code and you can fix it do so and send it to me along with your PayPal credentials in a PM and ill pay you as soon as i get back from work tomorrow.
What happens when you load it? Does the menu close? Can you change explosions?
 
Upvote 0
ImStuartB

ImStuartB

Aye so...
Experienced Veteran Forum Addict Hardened Veteran
Messages
2,933
Reaction score
2,138
Points
505
Sin$
0
Your best bet would be to ask the people over at PSX-Scene, Most people on here haven't a clue about coding / scripting, apart from a few and everyone knows who they are :smile:
 
Upvote 0
higuy0900

higuy0900

Enthusiast
Messages
435
Reaction score
166
Points
115
Sin$
0
I'll be back from work in like an hour. I'll see if I could get some help there aswell. I'd much rather get some help on here though =P
 
Upvote 0
Top Bottom
Login
Register