Quantcast

Jump to content

» «
Photo

Miscellaneous SCO Scripts

31 replies to this topic
Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#1

Posted 16 June 2012 - 05:04 AM Edited by Skorpro, 16 July 2013 - 03:00 AM.

S C O S c r i p t s


Hi folks,

I've decided to make a new topic for misc SCO scripts. So feel free to post your ideas and codes... biggrin.gif

Required tools:
Alexander Blade's SCOCL
OpenIV

Info:
How to use SCOCL



My "contribution" wink.gif (This are conversions of my own mods!)


Check my Top-Down-View biggrin.gif (used in many XBOX trainers...)


Bomb Mod (key: Num5)

-> on foot
user posted image

-> in heli
user posted image


Traffic Control (key: F5)

-> full traffic
user posted image

-> no traffic
user posted image


Small Speedo (in any vehicle)
user posted image


CODE

/****************************************************
*   SCOCL project by Alexander Blade (c) 2011     *
* This mod was created by Skorpro (c) 2008-2012   *
****************************************************/

#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>


//Bomb Mod
bool EB = 0;
int HOCH, BREIT;
Car helibomber;
Object BOMB;
float x, y, z, zground;
float a, b, c, cground;
float repeat, counter;
uint heliBomb = 0x3E3783A1;
uint onFootBomb = 0x7E339194;
//Traffic Control
int CHANGETRAFFIC = 1;
float TCX, TCY, TCZ;
//Speedo
Car veh_speed;
float fSpeed;
int iSpeed;
bool rep_speed = 0;


void SkorproTrafficControl(void)
{
if (CHANGETRAFFIC == 1)
{
 GET_CHAR_COORDINATES(GetPlayerPed(), &TCX, &TCY, &TCZ);
 CLEAR_AREA_OF_CARS(TCX, TCY, TCZ, 400.0);
 CLEAR_AREA_OF_CHARS(TCX, TCY, TCZ, 400.0);
 CLEAR_AREA_OF_COPS(TCX, TCY, TCZ, 400.0);
 CHANGETRAFFIC = 2;
 PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","No Traffic",3000,1);
 SET_CAR_DENSITY_MULTIPLIER(0.0);
 SET_PED_DENSITY_MULTIPLIER(0.0);
 SWITCH_GARBAGE_TRUCKS(0);
 SET_RANDOM_CAR_DENSITY_MULTIPLIER(0.0);
 SET_PARKED_CAR_DENSITY_MULTIPLIER(2.25);
 ALLOW_EMERGENCY_SERVICES(0);
}
else if (CHANGETRAFFIC == 2)
{
 CHANGETRAFFIC = 3;
 PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","Low Traffic",3000,1);
 SET_CAR_DENSITY_MULTIPLIER(0.25);
 SET_PED_DENSITY_MULTIPLIER(0.50);
 SWITCH_GARBAGE_TRUCKS(1);
 SET_RANDOM_CAR_DENSITY_MULTIPLIER(0.25);
 SET_PARKED_CAR_DENSITY_MULTIPLIER(2.25);
 ALLOW_EMERGENCY_SERVICES(1);
}
else if (CHANGETRAFFIC == 3)
{
 CHANGETRAFFIC = 4;
 PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","Standard",3000,1);
 SET_CAR_DENSITY_MULTIPLIER(1.25);
 SET_PED_DENSITY_MULTIPLIER(1.50);
 SWITCH_GARBAGE_TRUCKS(1);
 SET_RANDOM_CAR_DENSITY_MULTIPLIER(1.25);
 SET_PARKED_CAR_DENSITY_MULTIPLIER(2.25);
 ALLOW_EMERGENCY_SERVICES(1);
}
else if (CHANGETRAFFIC == 4)
{
 CHANGETRAFFIC = 5;
 PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","High Traffic",3000,1);
 SET_CAR_DENSITY_MULTIPLIER(3.25);
 SET_PED_DENSITY_MULTIPLIER(3.50);
 SWITCH_GARBAGE_TRUCKS(1);
 SET_RANDOM_CAR_DENSITY_MULTIPLIER(3.25);
 SET_PARKED_CAR_DENSITY_MULTIPLIER(2.25);
 ALLOW_EMERGENCY_SERVICES(1);
}
else if (CHANGETRAFFIC == 5)
{
 CHANGETRAFFIC = 1;
 PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","Full Traffic",3000,1);
 SET_CAR_DENSITY_MULTIPLIER(7.25);
 SET_PED_DENSITY_MULTIPLIER(7.50);
 SWITCH_GARBAGE_TRUCKS(1);
 SET_RANDOM_CAR_DENSITY_MULTIPLIER(7.25);
 SET_PARKED_CAR_DENSITY_MULTIPLIER(2.25);
 ALLOW_EMERGENCY_SERVICES(1);
}
}


void BombType(float xc, float yc, float zc, int breit_var, int hoch_var, int abstand)
{
hoch_var = hoch_var * abstand;
breit_var = breit_var * abstand;
for (HOCH = 0; HOCH <= hoch_var; HOCH += abstand)
{
 // start position
 zc = zc + HOCH;
 ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
 WAIT(20);
    // start position end
 for (BREIT = 4; BREIT <= breit_var; BREIT += 4)
 {
  xc = xc - BREIT;
  WAIT(20);
  ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
  yc = yc + BREIT;
  WAIT(20);
  ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
  xc = xc + BREIT;
  WAIT(20);
  ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
  xc = xc + BREIT;
  WAIT(20);
  ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
  yc = yc - BREIT;
  WAIT(20);
  ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
  yc = yc - BREIT;
  WAIT(20);
  ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
  xc = xc - BREIT;
  WAIT(20);
  ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
  xc = xc - BREIT;
  WAIT(20);
  ADD_EXPLOSION(xc, yc, zc, 4, 7.50, 1, 0, 1.01);
  WAIT(20);
  yc = yc + BREIT;
  xc = xc + BREIT;
  WAIT(20);
 }
}
WAIT(20);
}


void SpawnBomb(void)
{
 if (IS_CHAR_IN_ANY_HELI(GetPlayerPed()))
 {
  GET_CAR_CHAR_IS_USING(GetPlayerPed(), &helibomber);

  // HELI_BOMB
  REQUEST_MODEL(heliBomb);
  while (!HAS_MODEL_LOADED(heliBomb)) { WAIT(10); }
  GET_CHAR_COORDINATES(GetPlayerPed(), &x, &y, &z);
     GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS(GetPlayerPed(), 0.5, -2.1, -2.1, &x, &y, &z);
  CREATE_OBJECT(heliBomb, x, y, z, &BOMB, 1);
     SET_OBJECT_HEALTH(BOMB, 100.0);
     SET_OBJECT_ROTATION(BOMB, 90.0, 0.0, 0.0);
 
  GET_GROUND_Z_FOR_3D_COORD(x, y, z, &zground);
  repeat = z - zground;

  //repeat
  for (counter = 1; counter <= repeat; counter++)
  {
   WAIT(27);
   SLIDE_OBJECT(BOMB, x, y, zground, 0.0, 0.0, 1.3, 0);
  }
  // repeat end!
  WAIT(100);

    //---------------- In Heli
    // BombType(X, Y, Z, width, highness, spacing)
    BombType(x, y, zground, 7, 2, 2);
    DELETE_OBJECT(&BOMB);
    MARK_MODEL_AS_NO_LONGER_NEEDED(heliBomb);
    //----------------
 }
 else if (EB == 0)
 {
  // ON_FOOT_BOMB
  REQUEST_MODEL(onFootBomb);
  while (!HAS_MODEL_LOADED(onFootBomb)) { WAIT(10); }
  GET_CHAR_COORDINATES(GetPlayerPed(), &a, &b, &c);
  GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS(GetPlayerPed(), 0.0, 0.9, 0.0, &a, &b, &c);
     GET_GROUND_Z_FOR_3D_COORD(a, b, c, &cground);
     CREATE_OBJECT(onFootBomb, a, b, cground, &BOMB, 1);
     SET_OBJECT_HEALTH(BOMB, 1000.0);
  SET_OBJECT_ONLY_DAMAGED_BY_PLAYER(BOMB, 1);
  FREEZE_OBJECT_POSITION(BOMB, 1);
  PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Press  Num5 (default)  for detonation!", 2000, 1);
  WAIT(500);
     EB = 1;
 }
 else if (EB == 1)
 {

  //---------------- On Foot
     // BombType(X, Y, Z, width, highness, spacing)
     BombType(a, b, cground, 4, 2, 2);
  DELETE_OBJECT(&BOMB);
  MARK_MODEL_AS_NO_LONGER_NEEDED(onFootBomb);
  //----------------
     EB = 0;
 }
WAIT(100);
}


void SkorproTextAndInt(float x1, float y1, int red1, int green1, int blue1, int num, float x2, float y2, int red2, int green2, int blue2)
{
// TEXT
SET_TEXT_FONT(1); // TEXTFONT_LED
SET_TEXT_BACKGROUND(0);
SET_TEXT_SCALE(0.22, 0.27);
SET_TEXT_COLOUR(red1, green1, blue1, 255);
SET_TEXT_RIGHT_JUSTIFY(0);
SET_TEXT_DROPSHADOW(0, 255, 255, 255, 255);
DISPLAY_TEXT_WITH_LITERAL_STRING(x1, y1, "STRING", "Speed : ");

// NUM
SET_TEXT_FONT(1); // TEXTFONT_LED
SET_TEXT_BACKGROUND(0);
SET_TEXT_SCALE(0.22, 0.27);
SET_TEXT_COLOUR(red2, green2, blue2, 255);
SET_TEXT_RIGHT_JUSTIFY(0);
SET_TEXT_DROPSHADOW(0, 255, 255, 255, 255);
DISPLAY_TEXT_WITH_NUMBER(x2, y2, "NUMBER", num);
}



// ############################### MAIN ####################################

void main(void)
{
FORCE_LOADING_SCREEN(TRUE);
THIS_SCRIPT_SHOULD_BE_SAVED();
SET_CAR_DENSITY_MULTIPLIER(1.0);
SET_MAX_WANTED_LEVEL(6);
SET_PLAYER_CONTROL(GetPlayerIndex(), TRUE);
LOAD_SCENE(-420.245, 1137.605, 12.530);
SET_CHAR_COORDINATES_NO_OFFSET(GetPlayerPed(), -420.245, 1137.605, 12.530);
SET_CHAR_HEADING(GetPlayerPed(), 360.0);
FORCE_TIME_OF_DAY(9, 21);
RELEASE_TIME_OF_DAY();
RELEASE_WEATHER();
SET_CAM_BEHIND_PED(GetPlayerPed());
WAIT(2000);
FORCE_LOADING_SCREEN(FALSE);
DO_SCREEN_FADE_IN_UNHACKED(4000);

WAIT(2000);
PRINT_STRING_WITH_LITERAL_STRING_NOW("string", "Scocl test!", 3000, 1);



while (TRUE)
{
 // Traffic Control
 if (IS_GAME_KEYBOARD_KEY_PRESSED(63)) // 63 =  F5
 {
  SkorproTrafficControl();
  WAIT(500);
 }
 
 // Bomb Mod
 if (IS_GAME_KEYBOARD_KEY_PRESSED(76)) // 76 = Num 5
 {
  SpawnBomb();
  WAIT(500);
 }
 
 // Speedo
 if (IS_CHAR_IN_ANY_CAR(GetPlayerPed())) { rep_speed = 1; }
 else { rep_speed = 0; }

 if (rep_speed == 1) // LOOP start
 {
  if (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))
  {
   rep_speed = 0; // LOOP end
  }
  GET_CAR_CHAR_IS_USING(GetPlayerPed(), &veh_speed);
  GET_CAR_SPEED(veh_speed, &fSpeed);
  fSpeed = fSpeed * 3.61; // MaxSpeed (Default: 3.61)!
  iSpeed = (int) fSpeed; // float to int
  SkorproTextAndInt(0.01, 0.97, 0, 255, 0, iSpeed, 0.07, 0.97, 255, 0, 0);
 }
   
 // PAUSE
 WAIT(0);
}
}


Maybe it's useful - maybe not?!? Anyway - have fun wink.gif

Frank.s
  • Frank.s

  • Members
  • Joined: 15 Apr 2008

#2

Posted 16 June 2012 - 01:05 PM

Great scripts. icon14.gif
This also gives good useful info to people who are learning SCO.

Terreur69
  • Terreur69

    C2C - Down The Road

  • Members
  • Joined: 27 Dec 2010
  • France

#3

Posted 18 June 2012 - 09:08 PM Edited by terreur69, 19 June 2012 - 07:58 AM.

it will help me a lot, thank you skorpro wink.gif

add blip on radar:

CODE
Blip testBlip;
ADD_BLIP_FOR_COORD(cordX, cordY, cordZ, &testBlip);  
CHANGE_BLIP_SPRITE(testBlip, BLIP_HOSPITAL);  
CHANGE_BLIP_COLOUR(testBlip, 0);  
CHANGE_BLIP_DISPLAY(testBlip, BLIP_DISPLAY_MAP_ONLY);  
CHANGE_BLIP_NAME_FROM_ASCII(testBlip, "Hospital");



video editor :
CODE

boolean start_var = 0;

while (TRUE)
{
if ( (IS_GAME_KEYBOARD_KEY_PRESSED(65)))   // press F7
{
if  (start_var == 0)
{

ACTIVATE_REPLAY_MENU();

WAIT(500);
start_var == 1;
}
else if (start_var == 1)
{
return;

WAIT(100);
start_var == 0;
}
}
WAIT(0);
}

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#4

Posted 20 June 2012 - 07:07 AM

@terreur69 & Frank.s

Thanx smile.gif
Some new SCO scripts coming soon...



Deluxe8900
  • Deluxe8900

    Player Hater

  • Members
  • Joined: 14 Jun 2012

#5

Posted 25 June 2012 - 09:44 PM

to pickup up object:

CODE
void pickupitem(void)
       {
          if(IS_GAME_KEYBOARD_KEY_JUST_PRESSED(KEY_##))
   {
       
           Ped Pped = GetPlayerPed();
           GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS(Pped, 0, 0, 0, &BGx, &BGy, &BGz);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup1 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup2 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup3 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup4 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup5 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup6 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup7 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup8 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup9 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup10 , TRUE);
           CREATE_OBJECT(##, BGx, BGy, BGz,&pickup11 , TRUE);
             
           SET_OBJECT_AS_STEALABLE(pickup, true);
           SET_OBJECT_AS_STEALABLE(pickup1, true);
           SET_OBJECT_AS_STEALABLE(pickup2, true);
           SET_OBJECT_AS_STEALABLE(pickup3, true);
           SET_OBJECT_AS_STEALABLE(pickup4, true);
           SET_OBJECT_AS_STEALABLE(pickup5, true);
           SET_OBJECT_AS_STEALABLE(pickup6, true);
           SET_OBJECT_AS_STEALABLE(pickup7, true);
           SET_OBJECT_AS_STEALABLE(pickup8, true);
           SET_OBJECT_AS_STEALABLE(pickup9, true);
           SET_OBJECT_AS_STEALABLE(pickup10, true);
           SET_OBJECT_AS_STEALABLE(pickup11, true);
           Print("Pick object up");
}                      
}


Just replace the ## with a object hex or hash whatever, and it will work, and change your game key press smile.gif

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#6

Posted 26 June 2012 - 12:11 AM Edited by Skorpro, 26 June 2012 - 12:19 AM.

@Deluxe8900
Thanx for your script biggrin.gif

You want to stop the heli animation just for fun... My way to do this:
CODE

/****************************************************
*   SCOCL project by Alexander Blade (c) 2011     *
* This mod was created by Skorpro (c) 2008-2012   *
****************************************************/

#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>


#define heliKey 35 // 35 = H
Vehicle currentHeli, attachedHeli;
uint heliModel;
float hx, hy, hz;
int heliCol1, heliCol2, heliSCol1, heliSCol2; // Heli Colors
bool heliAnim = 0;


void SkorproHeliAnimStop(void)
{
 if (IS_CHAR_IN_ANY_HELI(GetPlayerPed()))
 {
  if (IS_GAME_KEYBOARD_KEY_PRESSED(heliKey)) // default "H"
  {
   if (heliAnim == 0)
   {
    GET_CAR_CHAR_IS_USING(GetPlayerPed(), &currentHeli);
    TURN_OFF_VEHICLE_EXTRA(currentHeli, 1, 1);
    TURN_OFF_VEHICLE_EXTRA(currentHeli, 3, 1);
    GET_CAR_COLOURS(currentHeli, &heliCol1, &heliCol2);
    GET_EXTRA_CAR_COLOURS(currentHeli, &heliSCol1, &heliSCol2);
    GET_CAR_MODEL(currentHeli, &heliModel);
    REQUEST_MODEL(heliModel);
    while(!HAS_MODEL_LOADED(heliModel)) { WAIT(0); }
    CREATE_CAR(heliModel, hx, hy, hz, &attachedHeli, true);
    GET_CAR_COORDINATES(currentHeli, &hx, &hy, &hz);
    ATTACH_CAR_TO_CAR(attachedHeli, currentHeli, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
    SET_CAR_VISIBLE(currentHeli, 0);
    CHANGE_CAR_COLOUR(attachedHeli, heliCol1, heliCol2);
    SET_EXTRA_CAR_COLOURS(attachedHeli, heliSCol1, heliSCol2);
    PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","Stop Heli Anim",1000,1);
    heliAnim = 1;
    WAIT(500);
   }
   else if (heliAnim == 1)
   {
    GET_CAR_CHAR_IS_USING(GetPlayerPed(), &currentHeli);
    SET_CAR_VISIBLE(currentHeli, 1);
    TURN_OFF_VEHICLE_EXTRA(currentHeli, 1, 0);
    TURN_OFF_VEHICLE_EXTRA(currentHeli, 3, 0);
    DELETE_CAR(&attachedHeli);
    PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","Reset Heli Anim",1000,1);
    heliAnim = 0;
    WAIT(500);
   }
  }
 }
}




// ############################### MAIN ####################################

void main(void)
{
FORCE_LOADING_SCREEN(TRUE);
THIS_SCRIPT_SHOULD_BE_SAVED();
SET_CAR_DENSITY_MULTIPLIER(1.0);
SET_MAX_WANTED_LEVEL(6);
SET_PLAYER_CONTROL(GetPlayerIndex(), TRUE);
LOAD_SCENE(-420.245, 1137.605, 12.530);
SET_CHAR_COORDINATES_NO_OFFSET(GetPlayerPed(), -420.245, 1137.605, 12.530);
SET_CHAR_HEADING(GetPlayerPed(), 360.0);
FORCE_TIME_OF_DAY(9, 21);
RELEASE_TIME_OF_DAY();
RELEASE_WEATHER();
SET_CAM_BEHIND_PED(GetPlayerPed());
WAIT(2000);
FORCE_LOADING_SCREEN(FALSE);
DO_SCREEN_FADE_IN_UNHACKED(4000);

WAIT(2000);
PRINT_STRING_WITH_LITERAL_STRING_NOW("string", "Scocl test!", 3000, 1);



while (TRUE)
{
 SkorproHeliAnimStop();
 
 // PAUSE
 WAIT(0);
}
}


Hope you like it smile.gif

NOTE: All my scripts are for free use! Be fair: Please make a small credit like "Thanx to Skorpro" (in your Readme.txt and/or Topic)! Thanx smile.gif

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#7

Posted 26 June 2012 - 12:35 AM Edited by Skorpro, 30 June 2012 - 06:09 AM.

@Xxchr0m3kingxX

This is the conversion of my "Undercover Police Car" mod ! ( converted by iHaZ for XBOX - thank you )
Note: It is still not tested!!

CODE

/*-------------------------------------
  Undercover Police Mod by SKORPRO  
-------------------------------------*/

#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>

#define key1 76 // F5
#define key2 77 // F6
#define key3 78 //F7
#define upc_horn 1

bool ULight = 0; // upc_light_var
bool LRepeat = 0; // light_repeat
bool USiren = 0; // upc_siren_var
bool USiren2= 0;// upc_siren_var2
bool copcar = 0;  // upc_policeCar
bool coprepeat = 0; // policeCar_repeat

Object UCarLight; // upc_car_light
uint m_ObjectModel = 0xCB26803D;


Vehicle UCar; // upc_car
Vehicle UCar2; // upc_car2

Ped ped; // ped

uint USound; // upc_sound
uint USound2; // upc_sound2
uint USound3; // upc_sound3

int UColorHigh = 250; // upc_color_high
int UColorLow = 0; // int upc_color_low

float u_x, u_y, u_z; // upco_x, upco_y, upco_z

//MOD
bool DoesPlayerCharExist(void)
{
return DOES_CHAR_EXIST(GetPlayerPed());
}

void WaitUntilPlayerCharExists(void)
{
while(!DoesPlayerCharExist()) { WAIT(0); }
}

void Police_Delete(void)
{
if ( (ULight == 1) && (USiren == 1) )
{
       DELETE_OBJECT(&UCarLight);
    FORCE_CAR_LIGHTS(UCar, VEHICLE_LIGHTS_0);
    SET_VEH_HAZARDLIGHTS(UCar, 0);
    ULight = 0;
 LRepeat = 0;
 STOP_SOUND(USound);
 RELEASE_SOUND_ID(USound);
 USiren = 0;
}
}

void Police_Light(void)
{
if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
{
 Police_Delete();
}

GET_CAR_COORDINATES(UCar, &u_x, &u_y, &u_z);
DRAW_LIGHT_WITH_RANGE(u_x, u_y, u_z, UColorHigh, UColorLow, UColorLow, 27.0f, 18.0f); // red
FORCE_CAR_LIGHTS(UCar, VEHICLE_LIGHTS_2);
SET_OBJECT_ALPHA(UCarLight, 0);
WAIT(80);

if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
{
 Police_Delete();
}

WAIT(80);

if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
{
 Police_Delete();
}

GET_CAR_COORDINATES(UCar, &u_x, &u_y, &u_z);
DRAW_LIGHT_WITH_RANGE(u_x, u_y, u_z, UColorHigh, UColorHigh, UColorHigh, 27.0f, 18.0f); // white
FORCE_CAR_LIGHTS(UCar, VEHICLE_LIGHTS_1);
SET_OBJECT_ALPHA(UCar, 255);
WAIT(80);

if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
{
 Police_Delete();
}

WAIT(80);

if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
{
 Police_Delete();
}  

GET_CAR_COORDINATES(UCar, &u_x, &u_y, &u_z);
DRAW_LIGHT_WITH_RANGE(u_x, u_y, u_z, UColorLow, UColorLow, UColorHigh, 27.0f, 18.0f); // blue
SET_OBJECT_ALPHA(ULight, 0);

WAIT(80);

if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
{
 Police_Delete();
}

WAIT(80);

if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
{
 Police_Delete();
}

SET_OBJECT_ALPHA(ULight, 255);
}

void Police_Sound(void)
{
if (USiren == 0)
{
 USiren = 1;
 USound = GET_SOUND_ID();
 PLAY_SOUND_FROM_VEHICLE(USound, "AMBIENT_HORNS_REGULAR_SIRENS_COP_SIREN_LOOP", UCar);
 WAIT(100);
}
else if (USiren == 1)
{
 USiren = 0;
 STOP_SOUND(USound);
 RELEASE_SOUND_ID(USound);
}
WAIT(100);
}

void Police_Horn(void)
{
USound2 = GET_SOUND_ID();
PLAY_SOUND_FROM_VEHICLE(USound2, "BC3_BUOYS_AHOY_HARBOUR_PATROL_SIREN", UCar);
}

void Police_PoliceCar(void)
{
SWITCH_CAR_SIREN(UCar2, 1);
WAIT(11);
SWITCH_CAR_SIREN(UCar2, 0);
WAIT(0);
if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_POLICE_VEHICLE(GetPlayerPed())) )
{
 copcar = 0;
 coprepeat = 0;
 SET_VEH_HAZARDLIGHTS(UCar2, 0);
 USiren2 = 0;
 STOP_SOUND(USound3);
 RELEASE_SOUND_ID(USound3);
 WAIT(100);
}
}

void StartMods1(void)
{
if ( (IS_CHAR_IN_ANY_CAR(GetPlayerPed())) && (!IS_CHAR_ON_ANY_BIKE(GetPlayerPed())) && (!IS_CHAR_IN_ANY_POLICE_VEHICLE(GetPlayerPed())) )
{
 GET_CAR_CHAR_IS_USING(GetPlayerPed(), &UCar);
  // Polizei Blaulicht
 if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(key1))
    {
  if (ULight == 0)
  {
   // Blaulicht AN!
   SET_VEH_HAZARDLIGHTS(UCar, 1);
   
   REQUEST_MODEL(m_ObjectModel);
   while(!HAS_MODEL_LOADED(m_ObjectModel))
   {
   WAIT(10);
   }
   CREATE_OBJECT(m_ObjectModel, 0.0, 0.0, 0.0, &UCarLight, true);
   ATTACH_OBJECT_TO_PED(ULight, GetPlayerPed(), BONE_ROOT, 0.55f, 1.09f, -0.07f, 0.77f, 0.0f, 0.0f, 0);
   DELETE_OBJECT(&UCarLight); // 2x erstellen!!
   WAIT(10);
   CREATE_OBJECT(m_ObjectModel, 0.0, 0.0, 0.0, UCarLight, true);
   ATTACH_OBJECT_TO_PED(UCarLight, GetPlayerPed(), BONE_ROOT, 0.55f, 1.09f, -0.07f, 0.77f, 0.0f, 0.0f, 0);
    ULight = 1;
   LRepeat = 1;
  }
  else if (ULight == 1)
  {
   // Blaulicht AUS!
   DELETE_OBJECT(&UCarLight);
   FORCE_CAR_LIGHTS(UCar, VEHICLE_LIGHTS_0);
   SET_VEH_HAZARDLIGHTS(UCar, 0);
   ULight = 0;
   LRepeat = 0;
  }
  else if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
  {
   Police_Delete();
  }
 }
 // Repeat LIGHT AN
 if (LRepeat == 1)
 {
  Police_Light();
 }
 // Repeat LIGHT AUS
 // Polizei Sound
 if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(key2))
 {
  Police_Sound();
 }   // Sound mit Horn
 if ( (IS_PLAYER_PRESSING_HORN(CONVERT_INT_TO_PLAYERINDEX(GET_PLAYER_ID())) == 1) && (!IS_CHAR_IN_ANY_POLICE_VEHICLE(GetPlayerPed())) )
 {
  if (upc_horn == 1)
  {
   if ( (ULight == 1) && (USiren == 1) )
   {
    Police_Horn();
   }
  }
 }
 // Flashlight mit Horn
 if (IS_PLAYER_PRESSING_HORN(IS_PLAYER_PRESSING_HORN(CONVERT_INT_TO_PLAYERINDEX(GET_PLAYER_ID())) == 1))
 {
  if ( (ULight == 1) && (USiren == 1) )
  {
   FORCE_CAR_LIGHTS(UCar, VEHICLE_LIGHTS_2);
   WAIT(7);
   FORCE_CAR_LIGHTS(UCar, VEHICLE_LIGHTS_1);
   WAIT(7);
  }
 }
 else if (!IS_PLAYER_PRESSING_HORN(IS_PLAYER_PRESSING_HORN(CONVERT_INT_TO_PLAYERINDEX(GET_PLAYER_ID())) == 1))
 {
  FORCE_CAR_LIGHTS(UCar, VEHICLE_LIGHTS_0);
 }
 // Aussteigen
 if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
 {
  Police_Delete();
 }
 
 if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
 {
  Police_Delete();
 }


 // Polizeiauto LIGHT without SOUND
 if (IS_CHAR_IN_ANY_POLICE_VEHICLE(GetPlayerPed()))
 {
  GET_CAR_CHAR_IS_USING(GetPlayerPed(), &UCar2);

  if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(key1))
  {
   if (copcar == 0)
   {
    SET_VEH_HAZARDLIGHTS(UCar2, 1);
    copcar = 1;
    coprepeat = 1;
    WAIT(100);
   }
   else if (copcar == 1)
   {
    SET_VEH_HAZARDLIGHTS(UCar2, 0);
    copcar = 0;
    coprepeat = 0;
    WAIT(100);
   }
  }
  // Polizei Sound im POLICECAR!
  if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(key2))
  {
   if (USiren2 == 0)
   {
    USiren2 = 1;
    USound3 = GET_SOUND_ID();
    PLAY_SOUND_FROM_VEHICLE(USound3, "AMBIENT_HORNS_REGULAR_SIRENS_COP_SIREN_LOOP", UCar2);
    WAIT(100);
   }
   else if (USiren2 == 1)
   {
    USiren2 = 0;
    STOP_SOUND(USound3);
    RELEASE_SOUND_ID(USound3);
   }
  }
  else if ((IS_CONTROL_PRESSED(2, 3)) && (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))) // Key zum Aussteigen!
  {
   USiren2 = 0;
   STOP_SOUND(USound3);
   RELEASE_SOUND_ID(USound3);
  }

  // Flashlight mit Horn
  if (IS_PLAYER_PRESSING_HORN(IS_PLAYER_PRESSING_HORN(CONVERT_INT_TO_PLAYERINDEX(GET_PLAYER_ID())) == 1))
  {
   FORCE_CAR_LIGHTS(UCar2, VEHICLE_LIGHTS_2);
   WAIT(7);
   FORCE_CAR_LIGHTS(UCar2, VEHICLE_LIGHTS_1);
   WAIT(7);
  }
  else if (!IS_PLAYER_PRESSING_HORN(IS_PLAYER_PRESSING_HORN(CONVERT_INT_TO_PLAYERINDEX(GET_PLAYER_ID())) == 1))
  {
   FORCE_CAR_LIGHTS(UCar2, VEHICLE_LIGHTS_0);
  }
 }

 // Repeat LIGHT AN
 if (coprepeat == 1)
 {
  Police_PoliceCar();
 }
 // Repeat LIGHT AU
 WAIT(10);
}
}

void Init(void)
{
THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
WaitUntilPlayerCharExists();
//THIS_SCRIPT_SHOULD_BE_SAVED();
}

void main(void)
{
Init();

while(TRUE)
{
 Police_Light();
 Police_Sound();
 Police_Horn();
 Police_Delete();
 Police_PoliceCar();
 WAIT(100);
 StartMods1();
}
}


EDIT: New code w/o #include "Helpers.c" ...

PS: Please could someone test it for me ... I'm sooo lazy... tounge2.gif



Have fun biggrin.gif

NOTE: All my scripts are for free use! Be fair: Please make a small credit like "Thanx to Skorpro" (in your Readme.txt and/or Topic)! Thanx smile.gif

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#8

Posted 26 June 2012 - 01:06 AM

Oops! I have forget some useful things:

1. How to use SCOCL ( for beginners wink.gif )

2a. Key list (english) ( Thx to jdmalex2 cookie.gif )
2b. Key list (german)

3. GTA 2 topdown view ( a small cam script )

Btw. "Can I play with madness" (Iron Maiden) ROCKZ'n'RULEZ tounge2.gif

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#9

Posted 30 June 2012 - 06:06 AM Edited by Skorpro, 30 June 2012 - 02:49 PM.

@Deluxe8900

A simple weapon trainer... (Original Alice (LUA) script by Alexander Blade! icon14.gif )

CODE

void GiveWeapon(Ped ped,eWeapon weapon)
{
if (HAS_CHAR_GOT_WEAPON(ped, weapon) == true )
{
 SET_CHAR_AMMO(ped, weapon, 30000);
}
else
{
 GIVE_WEAPON_TO_CHAR(ped, weapon, 30000, 0);
}
}

void WeaponTrainer(void)
{
  Ped p;
  GET_PLAYER_CHAR(GetPlayerIndex(), &p);
  SET_PLAYER_FAST_RELOAD(GetPlayerIndex(), true);
  GiveWeapon(p, WEAPON_KNIFE);
  GiveWeapon(p, WEAPON_GRENADE);
  GiveWeapon(p, WEAPON_DEAGLE);
  GiveWeapon(p, WEAPON_SHOTGUN);
  GiveWeapon(p, WEAPON_MICRO_UZI);
  GiveWeapon(p, WEAPON_M4);
  GiveWeapon(p, WEAPON_SNIPERRIFLE);
  GiveWeapon(p, WEAPON_RLAUNCHER);
 
  if (GET_CURRENT_EPISODE() == 2) // only TBoGT!
  {
  GiveWeapon(p, WEAPON_EPISODIC_21); // PARACHUTE
  }
}


List of Weapons (GTA4) (www.gtamodding.com)

Have fun smile.gif

EDIT: Add "SET_PLAYER_FAST_RELOAD"

NOTE: All my scripts are for free use! Be fair: Please make a small credit like "Thanx to Skorpro" (in your Readme.txt and/or Topic)! Thanx smile.gif

Terreur69
  • Terreur69

    C2C - Down The Road

  • Members
  • Joined: 27 Dec 2010
  • France

#10

Posted 30 June 2012 - 03:09 PM

hey skorpro , thank you for all the script, it will help many people icon14.gif
you remember when you're asking me to add the fov of IV, its still not working:

CODE
Camera camera;   // NOT long!
CREATE_CAM(14, &camera);
SET_CAM_FOV(camera, 50.0);

hardsty1e
  • hardsty1e

    GLITCHED

  • Members
  • Joined: 02 May 2009
  • None

#11

Posted 30 June 2012 - 04:50 PM

Very useful indeed, thank you Skorpro. Just hope the xbox360 community gives you credit and don't make money off you.

Chr0m3 x MoDz
  • Chr0m3 x MoDz

    Player Hater

  • Members
  • Joined: 25 Jun 2012

#12

Posted 01 July 2012 - 03:59 AM

QUOTE (hardsty1e @ Saturday, Jun 30 2012, 16:50)
Very useful indeed, thank you Skorpro. Just hope the xbox360 community gives you credit and don't make money off you.

You can bet some little leech will try it i already used some scripts of his in a release and credited him

Chr0m3 x MoDz
  • Chr0m3 x MoDz

    Player Hater

  • Members
  • Joined: 25 Jun 2012

#13

Posted 01 July 2012 - 04:07 AM Edited by Xxchr0m3kingxX, 09 July 2012 - 09:03 AM.

QUOTE (Skorpro @ Tuesday, Jun 26 2012, 00:35)
@Xxchr0m3kingxX

This is the conversion of my "Undercover Police Car" mod ! ( converted by iHaZ for XBOX - thank you )
Note: It is still not tested!!

NOTE: All my scripts are for free use! Be fair: Please make a small credit like "Thanx to Skorpro" (in your Readme.txt and/or Topic)! Thanx smile.gif

This mod works but it activates instantly when in car no button press and freezes after about 3 seconds

Deluxe8900
  • Deluxe8900

    Player Hater

  • Members
  • Joined: 14 Jun 2012

#14

Posted 01 July 2012 - 01:35 PM Edited by Deluxe8900, 01 July 2012 - 01:58 PM.

QUOTE (Xxchr0m3kingxX @ Sunday, Jul 1 2012, 04:07)
QUOTE (Skorpro @ Tuesday, Jun 26 2012, 00:35)
@Xxchr0m3kingxX

This mod works but it activates instantly when in car no button press and freezes after about 3 seconds

Have you converted the natives from 1.7 to 1.4?

Terreur69
  • Terreur69

    C2C - Down The Road

  • Members
  • Joined: 27 Dec 2010
  • France

#15

Posted 01 July 2012 - 01:54 PM

please , remove the code in your comment.

jdmalex2
  • jdmalex2

    Player Hater

  • Members
  • Joined: 25 Feb 2012

#16

Posted 15 July 2012 - 11:43 PM

here is the source code for my simple trainer...

there is 2 versions .

source pack


Video of the 1st trainer

compile 1_newscript.c with scocl

tested in all version except complete but shouldn't be a problem

jdmalex2
  • jdmalex2

    Player Hater

  • Members
  • Joined: 25 Feb 2012

#17

Posted 15 July 2012 - 11:46 PM Edited by jdmalex2, 15 July 2012 - 11:49 PM.


Vehicle Spawner code: needs some source files from above file pack mainly for display.. check out 1_newscript.c and add this script in the top portion.

CODE
//single's
#define SELECT_NEXT_BUTTON           DPAD_RIGHT
#define SELECT_PREVIOUS_BUTTON          DPAD_LEFT
#define CATEGORY_BUTTON_SELECT          DPAD_UP
#define SPAWN_VEH_BUTTON           DPAD_DOWN
#define BOOST_BUTTON            X
#define BOOST_ONOFF             STICK_L


//combo's
#define SPAWNER_ON_OFF_BUTTON_1          R1
#define SPAWNER_ON_OFF_BUTTON_2          STICK_L


int vehicle ,vehiclemodel , numbermodels;
int PlayerDriver , forceX , forceY , forceZ;
int isCarSpawnMenuOn = 0,boostready=true;
int models[100] , vehCounter = 0 , Option=1;
bool boost=0;
Vehicle Spawned_Vehicle ,InvVehicle , Spawned_Vehicle ,PlayerVehicle;
float x, y, z ,CarSpeed , VehSpeed;



float PositonLineBot=0.55000000;  //Vehicle Category:
float PositonLineTop=0.58000000;  //Vehicle Category: ""catagory""
float VehicleDispLine=0.61000000;  // displayes Model
float Boostline=0.65000000;        // boost on or off
float PositonLineOne=0.68000000; //Speed:
float PositonLineTwo=0.71000000; // float speed

void printname(void)
{
if(isCarSpawnMenuOn == 1)
{

 SET_TEXT_FONT(6);
 SET_TEXT_BACKGROUND(0);
 SET_TEXT_DROPSHADOW(0, 0, 0, 0, 255);
 SET_TEXT_EDGE(1, 0, 0, 0, 255);
 SET_TEXT_PROPORTIONAL(1);
 SET_TEXT_WRAP(0.00000000, 1.00000000);
 //SET_TEXT_COLOUR(253, 160, 35, 255); YELLOW
 SET_TEXT_COLOUR(255, 20, 147, 255); //PINK
 SET_TEXT_SCALE(0.30000000, 0.30000000);
 SET_TEXT_JUSTIFY(true);
 SET_TEXT_RIGHT_JUSTIFY(0);

 char* carName = GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(vehiclemodel);
 vehiclemodel = models[vehCounter];
 DISPLAY_TEXT_WITH_LITERAL_STRING(0.05000000, VehicleDispLine, "STRING", carName);
 //draw_title(0.15000000, VehicleDispLine, 0.30000000, 0.30000000, 255, 20, 147, 255, carName);
}

}

void displaySpeed(void)
{

if(IS_CHAR_ON_FOOT(GetPlayerPed()))
{
 GET_CHAR_SPEED(GetPlayerPed(), &VehSpeed);
 set_up_draw(2, 0.30000000, 0.30000000, 253, 69, 0, 255); //orange 255-69-0
 draw_text("STRING", 0.05000000, PositonLineOne, "Foot Speed:");
 set_up_draw(2, 0.30000000, 0.30000000, 255, 0, 0, 200); // red
 draw_float("NUMBR", 0.05000000, PositonLineTwo, VehSpeed);
}
if(IS_CHAR_IN_ANY_CAR(GetPlayerPed()))
{
 set_up_draw(2, 0.30000000, 0.30000000,  253, 69, 0, 255); //orange
 draw_text("STRING", 0.05000000, PositonLineOne, "Vehicle Speed:");
 set_up_draw(2, 0.30000000, 0.30000000, 255, 0, 0, 200); // red
 draw_float("NUMBR", 0.05000000, PositonLineTwo, CarSpeed);
}

}


void modelslist(void)
{
if(Option==1)
{
numbermodels = 9;
models[1]=MODEL_SULTANRS; //Sports cars and Supercars
models[2]=MODEL_SUPERGT; //Sports cars and Supercars
models[3]=MODEL_INFERNUS; //Sports cars and Supercars
models[4]=MODEL_TURISMO;//Sports cars and Supercars
models[5]=MODEL_COMET; //Sports cars and Supercars
models[6]=MODEL_COQUETTE; //Sports cars and Supercars
models[7]=MODEL_BANSHEE;  //Sports cars and Supercars
models[8]=MODEL_TURISMO;//Sports cars and Supercars
models[9]=MODEL_FELTZER;
}
if(Option==2)
{
numbermodels = 7;
models[1]=MODEL_BOBBER; //Motorcycles
models[2]=MODEL_FAGGIO; //Motorcycles
models[3]=MODEL_HELLFURY;//Motorcycles
models[4]=MODEL_NRG900;//Motorcycles
models[5]=MODEL_PCJ;//Motorcycles
models[6]=MODEL_SANCHEZ;//Motorcycles
models[7]=MODEL_ZOMBIEB;//Motorcycles
}
if(Option==3)
{
numbermodels = 13;
models[1]=MODEL_VIGERO; //Muscle Cars and Vintage
models[2]=MODEL_VIGERO2; //Muscle Cars and Vintage
models[3]=MODEL_VOODOO; //Muscle Cars and Vintage
models[4]=MODEL_STALION; //Muscle Cars and Vintage
models[5]=MODEL_RUINER; //Muscle Cars and Vintage
models[6]=MODEL_SABRE; //Muscle Cars and Vintage
models[7]=MODEL_SABRE2; //Muscle Cars and Vintage
models[8]=MODEL_SABREGT; //Muscle Cars and Vintage
models[9]=MODEL_PEYOTE; //Muscle Cars and Vintage
models[10]=MODEL_MANANA; //Muscle Cars and Vintage
models[11]=MODEL_FACTION; //Muscle Cars and Vintage
models[12]=MODEL_DUKES; //Muscle Cars and Vintage
models[13]=MODEL_BUCCANEER; //Muscle Cars and Vintage
}
if(Option==4)
{
numbermodels = 6;
models[1]=MODEL_FUTO; //Two-Doors and Hatchbacks
models[2]=MODEL_FORTUNE; //Two-Doors and Hatchbacks
models[3]=MODEL_URANUS; //Two-Doors and Hatchbacks
models[4]=MODEL_SENTINEL; //Two-Doors and Hatchbacks
models[5]=MODEL_BLISTA; //Two-Doors and Hatchbacks
models[6]=MODEL_VIRGO;
}
if(Option==5)
{
numbermodels = 33;
models[1]=MODEL_SOLAIR;//Four-Door Sedans/Saloons and Station Wagons
models[2]=MODEL_SULTAN; //Four-Door Sedans/Saloons and Station Wagons
models[3]=MODEL_VINCENT;//Four-Door Sedans/Saloons and Station Wagons
models[4]=MODEL_WASHINGTON;//Four-Door Sedans/Saloons and Station Wagons
models[5]=MODEL_WILLARD;//Four-Door Sedans/Saloons and Station Wagons
models[6]=MODEL_STRATUM;//Four-Door Sedans/Saloons and Station Wagons
models[7]=MODEL_STRETCH;//Four-Door Sedans/Saloons and Station Wagon
models[8]=MODEL_ROM;//Four-Door Sedans/Saloons and Station Wagons
models[9]=MODEL_SCHAFTER;//Four-Door Sedans/Saloons and Station Wagons
models[10]=MODEL_PREMIER;//Four-Door Sedans/Saloons and Station Wagons
models[11]=MODEL_PINNACLE;
models[12]=MODEL_PRES;//Four-Door Sedans/Saloons and Station Wagons
models[13]=MODEL_PRIMO;//Four-Door Sedans/Saloons and Station Wagons
models[14]=MODEL_PMP600;//Four-Door Sedans/Saloons and Station Wagons
models[15]=MODEL_ORACLE;//Four-Door Sedans/Saloons and Station Wagons
models[16]=MODEL_MERIT;//Four-Door Sedans/Saloons and Station Wagons
models[17]=MODEL_MARBELLA;//Four-Door Sedans/Saloons and Station Wagons
models[18]=MODEL_LOKUS;//Four-Door Sedans/Saloons and Station Wagons
models[19]=MODEL_INGOT;//Four-Door Sedans/Saloons and Station Wagons
models[20]=MODEL_INTRUDER;//Four-Door Sedans/Saloons and Station Wagons
models[21]=MODEL_HAKUMAI;//Four-Door Sedans/Saloons and Station Wagons
models[22]=MODEL_FEROCI;//Four-Door Sedans/Saloons and Station Wagons
models[23]=MODEL_FEROCI2;//Four-Door Sedans/Saloons and Station Wagons
models[24]=MODEL_EMPEROR;//Four-Door Sedans/Saloons and Station Wagons
models[25]=MODEL_EMPEROR2;//Four-Door Sedans/Saloons and Station Wagons
models[26]=MODEL_ESPERANTO;//Four-Door Sedans/Saloons and Station Wagons
models[27]=MODEL_FEROCI;//Four-Door Sedans/Saloons and Station Wagons
models[28]=MODEL_FEROCI2;//Four-Door Sedans/Saloons and Station Wagons
models[29]=MODEL_DF8;//Four-Door Sedans/Saloons and Station Wagons
models[30]=MODEL_DILETTANTE;//Four-Door Sedans/Saloons and Station Wagons
models[31]=MODEL_CHAVOS;//Four-Door Sedans/Saloons and Station Wagons
models[32]=MODEL_COGNOSCENTI;//Four-Door Sedans/Saloons and Station Wagons
models[33]=MODEL_ADMIRAL;  //Four-Door Sedans/Saloons and Station Wagons
}
if(Option==6)
{
numbermodels = 13;
models[1]=MODEL_RANCHER;//SUVs/Crossovers, Pick-ups and Vans
models[2]=MODEL_REBLA;//SUVs/Crossovers, Pick-ups and Vans
models[3]=MODEL_PATRIOT;//SUVs/Crossovers, Pick-ups and Vans
models[4]=MODEL_PERENNIAL;//SUVs/Crossovers, Pick-ups and Vans
models[5]=MODEL_PERENNIAL2;//SUVs/Crossovers, Pick-ups and Vans
models[6]=MODEL_LANDSTALKER;//SUVs/Crossovers, Pick-ups and Vans
models[7]=MODEL_MINIVAN;//SUVs/Crossovers, Pick-ups and Vans
models[8]=MODEL_MOONBEAM;//SUVs/Crossovers, Pick-ups and Vans
models[9]=MODEL_FXT;//SUVs/Crossovers, Pick-ups and Vans
models[10]=MODEL_HABANERO;//SUVs/Crossovers, Pick-ups and Vans
models[11]=MODEL_HUNTLEY;//SUVs/Crossovers, Pick-ups and Vans
models[12]=MODEL_BOBCAT; //SUVs/Crossovers, Pick-ups and Vans
models[13]=MODEL_CAVALCADE;//SUVs/Crossovers, Pick-ups and Vans
}
if(Option==7)
{
numbermodels = 19;
models[1]=MODEL_FLATBED;//Commercial/Industrial
models[2]=MODEL_FORKLIFT;//Commercial/Industrial
models[3]=MODEL_BURRITO;//Commercial/Industrial
models[4]=MODEL_BURRITO2;//Commercial/Industrial
models[5]=MODEL_BENSON;//Commercial/Industrial
models[6]=MODEL_BIFF;//Commercial/Industrial
models[7]=MODEL_BOXVILLE; //Commercial/Industrial
models[8]=MODEL_MRTASTY;//Commercial/Industrial
models[9]=MODEL_MULE;//Commercial/Industrial
models[10]=MODEL_PACKER;//Commercial/Industrial
models[11]=MODEL_PHANTOM;//Commercial/Industrial
models[12]=MODEL_PONY;//Commercial/Industrial
models[13]=MODEL_RIPLEY;//Commercial/Industrial
models[14]=MODEL_SPEEDO;//Commercial/Industrial
models[15]=MODEL_YANKEE;//Commercial/Industrial
models[16]=MODEL_STEED;//Commercial/Industrial
models[17]=MODEL_AIRTUG; //Commercial/Industria
models[18]=MODEL_ROMERO; //Commercial/Industria
models[19]=MODEL_E109; //Commercial/Industria
}
if(Option==8)
{
numbermodels = 15;
models[1]=MODEL_NOOSE; //Emergency
models[2]=MODEL_AMBULANCE; //Emergency
models[3]=MODEL_POLICE;  //Emergency
models[4]=MODEL_POLICE2; //Emergency
models[5]=MODEL_POLPATRIOT; //Emergency
models[6]=MODEL_PSTOCKADE; //Emergency
models[7]=MODEL_AMBULANCE; //Emergency
models[8]=MODEL_POLICEB; //Emergency
models[9]=MODEL_POLICE3; //Emergency
models[10]=MODEL_POLICE4; //Emergency
models[11]=MODEL_POLICEW; //Emergency
models[12]=MODEL_FBI;
models[13]=MODEL_FIRETRUK;
models[14]=MODEL_NSTOCKADE;
models[15]=MODEL_STOCKADE;
}
if(Option==9)
{
numbermodels = 5;
models[1]=MODEL_BUS;//Public Servic
models[2]=MODEL_CABBY;//Public Service
models[3]=MODEL_TAXI;//Public Service
models[4]=MODEL_TAXI2;//Public Service
models[5]=MODEL_TRASH;//Public Service
}
if(Option==10)
{
numbermodels = 4;
models[1]=MODEL_ANNIHILATOR;//Aircraft
models[2]=MODEL_MAVERICK;//Aircraft
models[3]=MODEL_POLMAV;//Aircraft
models[4]=MODEL_TOURMAV;//Aircraft
}
if(Option==11)
{
numbermodels = 8;
models[1]=MODEL_DINGHY;//Boats
models[2]=MODEL_JETMAX;//Boats
models[3]=MODEL_MARQUIS;//Boats
models[4]=MODEL_PREDATOR;//Boats
models[5]=MODEL_REEFER;//Boats
models[6]=MODEL_SQUALO;//Boats
models[7]=MODEL_TUGA;//Boats
models[8]=MODEL_TROPIC;//Boats
//models[LAST_MODEL]=MODEL_SUBWAY_LO;
//models[LAST_MODEL]=MODEL_SUBWAY_HI;
}
if(Option==12)
{
numbermodels = 39;
//EFLC
models[1]=MODEL_APC;
models[2]=MODEL_AVAN;
models[3]=MODEL_BUFFALO;
models[4]=MODEL_BULLET;
models[5]=MODEL_CADDY;
models[6]=MODEL_CAVCADE2;
models[7]=MODEL_F620;
models[8]=MODEL_GBURRITO;
models[9]=MODEL_STRETCH2;
models[10]=MODEL_PBUS;
models[11]=MODEL_SCHAFTER2;
models[12]=MODEL_SCHAFTER3;
models[13]=MODEL_SERRANO;
models[14]=MODEL_SERRANO2;
models[15]=MODEL_SLAMVAN;
models[16]=MODEL_SUPERD;
models[17]=MODEL_SUPERD2;
models[18]=MODEL_TAMPA;
models[19]=MODEL_TOWTRUCK;
models[20]=MODEL_AKUMA;
models[21]=MODEL_ANGEL;
models[22]=MODEL_BATI2;
models[23]=MODEL_DAEMON;
models[24]=MODEL_DIABO;
models[25]=MODEL_DOUBLE;
models[26]=MODEL_FAGGIO2;
models[27]=MODEL_HAKUCH;
models[28]=MODEL_HEXER;
models[29]=MODEL_LYCAN;
models[30]=MODEL_NIGHTBL;
models[31]=MODEL_REVENANT;
models[32]=MODEL_VADER;
models[33]=MODEL_WOLFS;
models[34]=MODEL_BUZZARD;
models[35]=MODEL_SWIFT;
models[36]=MODEL_SKYLIFT;
models[37]=MODEL_SMUGGLER;
models[38]=MODEL_FLOATER;
models[39]=MODEL_BLADE;
//MODEL_CKER2
//MODEL_REGINA
//MODEL_RHAPSODY
//MODEL_YANKEE2
//MODEL_BATI
//MODEL_DOUBLE2
//MODEL_WAYFARER
//MODEL_INNOV
//MODEL_HAKUCH2
}
}
void SetCarspawnmenuon(void)
{
if((IS_BUTTON_PRESSED(0,SPAWNER_ON_OFF_BUTTON_1)) && (IS_BUTTON_PRESSED(0,SPAWNER_ON_OFF_BUTTON_2)))

{
  if (isCarSpawnMenuOn == 0){ isCarSpawnMenuOn = 1;
  //Print("Car Spawner ON");
  WAIT(150);
  }
  else if(isCarSpawnMenuOn == 1){isCarSpawnMenuOn = 0;
  //Print("Car Spawner OFF");
  WAIT(150);  
  }
}
}
void BoostToggle(void)
{

if((boost==0)&&(IS_CHAR_IN_ANY_CAR(GetPlayerPed())))
{
 set_up_draw(2, 0.30000000, 0.30000000, 255, 20, 147, 110); //orange  //pink 255-20-147
 draw_text("STRING", 0.05000000, Boostline, "Boost OFF");
 if(IS_BUTTON_JUST_PRESSED(0, BOOST_ONOFF))
 {
  boost=1;
 }
 
}
else if((boost==1)&&(IS_CHAR_IN_ANY_CAR(GetPlayerPed())))
{
 set_up_draw(2, 0.30000000, 0.30000000, 255, 20, 147, 255); //orange
 draw_text("STRING", 0.05000000, Boostline, "Boost ON");
 if(IS_BUTTON_JUST_PRESSED(0, BOOST_ONOFF))
 {
  boost=0;
 
 }
}  
}
void Boost(void)
{

   Vehicle PlayerVehicle;
   int PlayerDriver , forceX , forceY , forceZ;

   CarSpeed = 0.00000000;

if (IS_CHAR_IN_ANY_CAR(GetPlayerPed()))
{
 GET_CAR_CHAR_IS_USING(GetPlayerPed(), &PlayerVehicle);  
 GET_DRIVER_OF_CAR(PlayerVehicle, &PlayerDriver );
 
 if (((GetPlayerPed() == PlayerDriver) && (IS_VEH_DRIVEABLE( PlayerVehicle )) && (DOES_VEHICLE_EXIST( PlayerVehicle ))))
 {
 
  GET_CAR_SPEED( PlayerVehicle, &CarSpeed);
 
  if(boost==1)
  {
   //START_PTFX_ON_VEH( "fire_gas_burner_glow", PlayerVehicle, ptX,ptY,ptZ, 0, 1, 1, 1.00000000 );
   //uint stopfxone = TRIGGER_PTFX_ON_VEH( "fire_gas_burner_glow", PlayerVehicle, ptX,ptY,ptZ, 0, 1, 1, 1.00000000);
   //START_PTFX_ON_VEH( "fire_gas_burner_flames", PlayerVehicle, ptX,ptY,ptZ, 0, 1, 1, 1.00000000 );
   //uint stopptfx = TRIGGER_PTFX_ON_VEH( "fire_gas_burner_flames", PlayerVehicle, ptX,ptY,ptZ, 0, 1, 1, 1.00000000);
   //stopfxone;

  if ((IS_VEHICLE_ON_ALL_WHEELS( PlayerVehicle )) && (!IS_CAR_IN_AIR_PROPER( PlayerVehicle )))
  {
   
   if((IS_BUTTON_JUST_PRESSED(0,BOOST_BUTTON)) && (boostready==true))
   {
    if ((CarSpeed > 1.50000000) && (CarSpeed < 55.00000000))
    {
     
     forceX = 0.00000000*CarSpeed*22.60000000;
     forceY = -1.00000000-CarSpeed-22.60000000;
     forceZ = 0.00000000*CarSpeed*22.60000000;
     
     APPLY_FORCE_TO_CAR(PlayerVehicle, 0, forceX, forceY, forceZ, 0.00000000,0.00000000,0.00000000, 0, 1, 1, 1 );
     
                       TRIGGER_PTFX_ON_VEH( "nitro_splutter", PlayerVehicle, 0.03000000, -0.05000000, 0.00000000, 0.00000000 , 0.00000000 , 0.00000000 , 1.00000000 );
     START_PTFX_ON_VEH("nitro_burst", PlayerVehicle, 0.03000000, -0.05000000, 0.00000000, 0.00000000 , 0.00000000 , 0.00000000 , 1.00000000 );

     SET_CAR_FORWARD_SPEED(PlayerVehicle, CarSpeed+10.0f);

     Cam camaraC;
     GET_GAME_CAM(&camaraC);
     
   
     //START_PTFX_ON_VEH( "fire_gas_burner_flames", PlayerVehicle, ptX,ptY,ptZ, 0, 1, 1, 1.00000000 );
     //uint stopptfx = TRIGGER_PTFX_ON_VEH( "fire_gas_burner_flames", PlayerVehicle, ptX,ptY,ptZ, 0, 1, 1, 1.00000000);
     //stopptfx;
     boostready=false;
    }
   }
   else if(boostready==false)
   {
    //STOP_PTFX(stopptfx);
    boostready=true;
   
   }
  }
               
  }
       }
   }
}
void SpawnerToggleListControl(void)
{
if( isCarSpawnMenuOn == 1)
{
if(IS_BUTTON_JUST_PRESSED(0,SELECT_NEXT_BUTTON))
{
 if(vehCounter < numbermodels)
 {
 //vehCounter = (vehCounter+1)%NUMBER_OF_MODELS;
 vehCounter+=1;
 }
 
}
else if(IS_BUTTON_JUST_PRESSED(0,SELECT_PREVIOUS_BUTTON))
{
 if(vehCounter > 1 )
 {
 //vehCounter = (vehCounter-1)%NUMBER_OF_MODELS;
 vehCounter-=1;

 }

}
}
}

void ShowLineDisp(char *Category)
{
set_up_draw(2, 0.30000000, 0.30000000, 255, 0, 0, 200); //red
draw_text("STRING", 0.05000000, PositonLineTop, Category);
}
void SpawnerToggleListView(void)
{
if( isCarSpawnMenuOn == 1)
{
 
 set_up_draw(2, 0.30000000, 0.30000000, 253, 69, 0, 255); //orange 255-69-0
 draw_text("STRING", 0.05000000, PositonLineBot, "Vehicle Category:");
 
 /*if( Option == 0)
 {
   ShowLineDisp("All avalible vehicles");
   
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1;
    Option = 1;
   }
   
 }*/
 if( Option == 1)
 {
   ShowLineDisp("Sports cars and Supercars");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1;
    Option = 2;
   }
 }
 else if( Option == 2)
 {
   ShowLineDisp("Motorcycles");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {  
    vehCounter = 1; // 9 to 15 //Motorcycles
    Option = 3;
   }
 }
 else if( Option == 3)
 {
   ShowLineDisp("Muscle Cars and Vintage");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {  
    vehCounter = 1; //16 to 28 //Muscle Cars and Vintage
    Option = 4;
   }
 }
 else if( Option == 4)
 {
   ShowLineDisp( "Two-Doors and Hatchbacks");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; //29 to 34 //Two-Doors and Hatchbacks
    Option = 5;
   }
 }
 else if( Option == 5)
 {
   ShowLineDisp("Four-Door Sedans and Station Wagons");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; //35 to 67 //Four-Door Sedans/Saloons and Station Wagons
    Option = 6;
   }
 }
 else if( Option == 6)
 {
   ShowLineDisp("SUVs,Crossovers, Pick-ups and Vans");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; //68 to 80 //SUVs/Crossovers, Pick-ups and Vans
    Option = 7;
   }
 }
 else if( Option == 7)
 {
   ShowLineDisp( "Commercial/Industrial");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; //81 to 99 //Commercial/Industrial
    Option = 8;
   }
 }
 else if( Option == 8)
 {
   ShowLineDisp("Emergency");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; // 100 to 114 //Emergency
    Option = 9;
   }
 }
 else if( Option == 9)
 {
   ShowLineDisp("Public Service");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; // 115 to 119 //Public Service
    Option = 10;
   }
 }
 else if( Option == 10)
 {
   ShowLineDisp("Aircraft");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; // 120 to 123 //Aircraft
    Option = 11;
   }
 }
 else if( Option == 11)
 {
   ShowLineDisp("Boats");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; //124 to 131 //Boats
    Option = 12;
   }
 }
 else if( Option == 12)
 {
   ShowLineDisp("EFLC Vehicles");
   if(IS_BUTTON_JUST_PRESSED(0,CATEGORY_BUTTON_SELECT))
   {
    vehCounter = 1; // 132 to 170// EFLC
    Option = 1;
   }
 }
}
}
void DeleteVehicle(void)
{
float fX, fY, fZ;
Vehicle charVehicle;
if(IS_CHAR_IN_ANY_CAR(GetPlayerPed()))
{
 GET_CHAR_COORDINATES(GetPlayerPed(), &fX, &fY, &fZ);
 GET_CAR_CHAR_IS_USING(GetPlayerPed(), &charVehicle);
 if(DOES_VEHICLE_EXIST(charVehicle))
 {
  WARP_CHAR_FROM_CAR_TO_COORD(GetPlayerPed(), fX, fY, fZ);
  DELETE_CAR(&charVehicle);
 }

}

}


void PressButtonToSpawn(void)
{
if( isCarSpawnMenuOn == 1)
{

 if(IS_BUTTON_JUST_PRESSED(0, SPAWN_VEH_BUTTON))
 {
  vehicle = models[vehCounter];
  DeleteVehicle();
  REQUEST_MODEL(vehicle);
  if (IS_MODEL_IN_CDIMAGE(vehicle))
  {
  while (!HAS_MODEL_LOADED(vehicle)) WAIT(0);
  MARK_MODEL_AS_NO_LONGER_NEEDED(vehicle);

  GET_CHAR_COORDINATES(GetPlayerPed(), &x, &y, &z);
  CREATE_CAR(vehicle, x, y, z, &Spawned_Vehicle, true);
  SET_CAR_ENGINE_ON(Spawned_Vehicle, 0, true);
  WARP_CHAR_INTO_CAR(GetPlayerPed(), Spawned_Vehicle);
  SET_CAR_AS_MISSION_CAR(Spawned_Vehicle);
 
  }
  else
  {
  Print("Error , Cannot Find Model In Vehicles.img");
  }
 
 }

}
}

bool inheli=0;
void HeliBladesFull(void)
{
Vehicle modveh;
if((IS_CHAR_IN_ANY_HELI(GetPlayerPed())) & (inheli==1))
{
 GET_CAR_CHAR_IS_USING(GetPlayerPed(), &modveh);
 if(DOES_VEHICLE_EXIST(modveh))
 {
  SET_HELI_BLADES_FULL_SPEED(modveh);
  inheli=0;
 }
 
}
else if((!IS_CHAR_IN_ANY_HELI(GetPlayerPed())) & (inheli==0))
{
 inheli=1;
}
}

/*
// Not Needed For Final Product  START
bool finishedspawn = 0; // USED FOR TESTING JUST SPAWNS U AT THE AIRPORT AND BREAKS THE LOOP SO YOU ARNT STUCK IN INF SPAWN MODE
void spawnatairportonce(void) // Not really needed Used for testing
{
if(finishedspawn == 0)
{
SET_CHAR_COORDINATES(GetPlayerPed(), 2242.19,  727.24,  5.91);// AIRPORT
finishedspawn = 1;
}
}// Not Needed For Final Product  END*/


void DoNewScript(void)
{


printname();
modelslist();

SetCarspawnmenuon();
SpawnerToggleListControl();
SpawnerToggleListView();
BoostToggle();
Boost();
HeliBladesFull();
displaySpeed();
PressButtonToSpawn();
//spawnatairportonce();// USED FOR TESTING JUST SPAWNS U AT THE AIRPORT

//PrintHelp();
}



My vehicle spawner I made while back.. has its own categories for picking what you want faster

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#18

Posted 06 February 2013 - 09:38 PM

Hi folks, hi terreur69!

It's been a looong time! But after my New Safehouses project I decided to make some codes in SCO again wink.gif

This time I tried to make a Simple Traffic Loader in SCO... and this is the result:

CODE

// Simple Traffic Loader by SKORPRO

#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>

#define ALLMODELS 95  // number of ALL car models
#define WAITING 5000  // interval = time between LOAD and UNLOAD model
#define RNDCARCOUNT 10  // number of LOADED cars
boolean taxiUNLOAD = true;  // oppress taxis
boolean supOwnCar = true;  // suppress OWN current car
uint globRndModel[RNDCARCOUNT];
uint random;
int iRnd1, iRnd2;

typedef struct _ModelDataSet
{
uint cars;
} ModelDataSet;

ModelDataSet rndModel[ALLMODELS];

void SkorproRandomCarLoad(int rndCars, int count) // ##################
{
rndModel[0].cars = MODEL_ADMIRAL;
rndModel[1].cars = MODEL_BANSHEE;
rndModel[2].cars = MODEL_BENSON;
rndModel[3].cars = MODEL_BIFF;
rndModel[4].cars = MODEL_BLISTA;
rndModel[5].cars = MODEL_BOBCAT;
rndModel[6].cars = MODEL_BOXVILLE;
rndModel[7].cars = MODEL_BUCCANEER;
rndModel[8].cars = MODEL_BURRITO;
rndModel[9].cars = MODEL_BUS;
rndModel[10].cars = MODEL_CAVALCADE;
rndModel[11].cars = MODEL_CHAVOS;
rndModel[12].cars = MODEL_COGNOSCENTI;
rndModel[13].cars = MODEL_COMET;
rndModel[14].cars = MODEL_COQUETTE;
rndModel[15].cars = MODEL_DF8;
rndModel[16].cars = MODEL_DILETTANTE;
rndModel[17].cars = MODEL_DUKES;
rndModel[18].cars = MODEL_E109;
rndModel[19].cars = MODEL_EMPEROR;
rndModel[20].cars = MODEL_EMPEROR2;
rndModel[21].cars = MODEL_ESPERANTO;
rndModel[22].cars = MODEL_FACTION;
rndModel[23].cars = MODEL_FELTZER;
rndModel[24].cars = MODEL_FEROCI;
rndModel[25].cars = MODEL_FLATBED;
rndModel[26].cars = MODEL_FORTUNE;
rndModel[27].cars = MODEL_FUTO;
rndModel[28].cars = MODEL_FXT;
rndModel[29].cars = MODEL_HABANERO;
rndModel[30].cars = MODEL_HAKUMAI;
rndModel[31].cars = MODEL_HUNTLEY;
rndModel[32].cars = MODEL_INFERNUS;
rndModel[33].cars = MODEL_INGOT;
rndModel[34].cars = MODEL_INTRUDER;
rndModel[35].cars = MODEL_LANDSTALKER;
rndModel[36].cars = MODEL_LOKUS;
rndModel[37].cars = MODEL_MANANA;
rndModel[38].cars = MODEL_MARBELLA;
rndModel[39].cars = MODEL_MERIT;
rndModel[40].cars = MODEL_MINIVAN;
rndModel[41].cars = MODEL_MOONBEAM;
rndModel[42].cars = MODEL_MRTASTY;
rndModel[43].cars = MODEL_MULE;
rndModel[44].cars = MODEL_ORACLE;
rndModel[45].cars = MODEL_PACKER;
rndModel[46].cars = MODEL_PATRIOT;
rndModel[47].cars = MODEL_PERENNIAL;
rndModel[48].cars = MODEL_PEYOTE;
rndModel[49].cars = MODEL_PHANTOM;
rndModel[50].cars = MODEL_PINNACLE;
rndModel[51].cars = MODEL_PMP600;
rndModel[52].cars = MODEL_PONY;
rndModel[53].cars = MODEL_PREMIER;
rndModel[54].cars = MODEL_PRES;
rndModel[55].cars = MODEL_PRIMO;
rndModel[56].cars = MODEL_RANCHER;
rndModel[57].cars = MODEL_REBLA;
rndModel[58].cars = MODEL_BUS;
rndModel[59].cars = MODEL_ROMERO;
rndModel[60].cars = MODEL_ROM;
rndModel[61].cars = MODEL_RUINER;
rndModel[62].cars = MODEL_SABRE;
rndModel[63].cars = MODEL_SABRE2;
rndModel[64].cars = MODEL_SABREGT;
rndModel[65].cars = MODEL_SCHAFTER;
rndModel[66].cars = MODEL_SENTINEL;
rndModel[67].cars = MODEL_SOLAIR;
rndModel[68].cars = MODEL_SPEEDO;
rndModel[69].cars = MODEL_STALION;
rndModel[70].cars = MODEL_STEED;
rndModel[71].cars = MODEL_STOCKADE;
rndModel[72].cars = MODEL_STRATUM;
rndModel[73].cars = MODEL_STRETCH;
rndModel[74].cars = MODEL_SULTAN;
rndModel[75].cars = MODEL_SULTANRS;
rndModel[76].cars = MODEL_SUPERGT;
rndModel[77].cars = MODEL_TRASH;
rndModel[78].cars = MODEL_TURISMO;
rndModel[79].cars = MODEL_URANUS;
rndModel[80].cars = MODEL_VIGERO;
rndModel[81].cars = MODEL_VIGERO2;
rndModel[82].cars = MODEL_VINCENT;
rndModel[83].cars = MODEL_VIRGO;
rndModel[84].cars = MODEL_VOODOO;
rndModel[85].cars = MODEL_WASHINGTON;
rndModel[86].cars = MODEL_WILLARD;
rndModel[87].cars = MODEL_YANKEE;
rndModel[88].cars = MODEL_BOBBER;
rndModel[89].cars = MODEL_FAGGIO;
rndModel[90].cars = MODEL_HELLFURY;
rndModel[91].cars = MODEL_NRG900;
rndModel[92].cars = MODEL_PCJ;
rndModel[93].cars = MODEL_SANCHEZ;
rndModel[94].cars = MODEL_ZOMBIEB;

uint model = rndModel[rndCars].cars;

// Request Model
REQUEST_MODEL(model);
while(!HAS_MODEL_LOADED(model)) { WAIT(10); }
globRndModel[count] = model;
}

void SkorproKillModels()
{
if (supOwnCar == true)
{  
 Vehicle currCar;
 uint currModel;
 GET_CAR_CHAR_IS_USING(GetPlayerPed(), &currCar);
 GET_CAR_MODEL(currCar, &currModel);
 SUPPRESS_CAR_MODEL(currModel);
 MARK_MODEL_AS_NO_LONGER_NEEDED(currModel);
}
if (taxiUNLOAD == true)
{
 MARK_MODEL_AS_NO_LONGER_NEEDED(MODEL_TAXI);
 MARK_MODEL_AS_NO_LONGER_NEEDED(MODEL_TAXI2);
 MARK_MODEL_AS_NO_LONGER_NEEDED(MODEL_CABBY);
}
}

void main(void)
{
while (TRUE)
{
 for (iRnd1 = 0; iRnd1 < RNDCARCOUNT; iRnd1++)
 {
  GENERATE_RANDOM_INT_IN_RANGE(0, ALLMODELS - 1, &random);
  SkorproRandomCarLoad(random, iRnd1);
  WAIT(100);
  SkorproKillModels();
 }
 WAIT(WAITING);
 for (iRnd2 = 0; iRnd2 < RNDCARCOUNT; iRnd2++)
 {
  MARK_MODEL_AS_NO_LONGER_NEEDED(globRndModel[iRnd2]);
  SkorproKillModels();
 }
 WAIT(10);
}
}


...I have tried the rndModel[ALLMODELS] as a array like
CODE

rndModel[ALLMODELS] = { MODEL_ADMIRAL, MODEL_BANSHEE... };

...and it worked perfectly in C++ (ScriptHook) but not in SCO! Why? I have no idea.
Anyway! With typedef struct it works perfectly too.

@terreur69:
Hope this is what you want smile.gif If not, PM me!


@ALL:
NOTE: All my scripts are for free use! Be fair: Please make a small credit like "Thanx to Skorpro" (in your Readme.txt and/or Topic)! Thanx
smile.gif

spadger
  • spadger

    Player Hater

  • Members
  • Joined: 28 Jun 2012

#19

Posted 23 March 2013 - 06:52 PM

Yes the array initializing is broken on scocl, it should work of course, and does with any other compiler. You can also auto initialize a whole array to one value like thus: int array[20] = { 0 };


Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#20

Posted 14 May 2013 - 08:57 PM

QUOTE (spadger @ Saturday, Mar 23 2013, 18:52)
Yes the array initializing is broken on scocl, it should work of course, and does with any other compiler. You can also auto initialize a whole array to one value like thus: int array[20] = { 0 };

Thanx smile.gif

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#21

Posted 14 May 2013 - 09:24 PM Edited by Skorpro, 13 September 2013 - 02:43 AM.

Hi,
this time I post a small demonstration how to enter cutscene rooms like Tony's apartment (TBOGT only!) without any trainer(s).
Visit the red X on map and then press "T" to enter.
 

// Cutscene Room: Tony's apartment by SKORPRO
// Thanx to Alexander Blade, sjaak327 and Billsy93

#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>


void main(void)
{
if (GET_CURRENT_EPISODE() == 2) // 2=TBOGT
{
 Blip CSBlip;
 Object CSObject;
 REQUEST_MODEL(0xCFC254FA);
 while(!HAS_MODEL_LOADED(0xCFC254FA)) { WAIT(0); }

 // Obj
 CREATE_OBJECT_NO_OFFSET(0xCFC254FA, -74.3f, -223.7f, 13.6f, &CSObject, 1); // z-1
 SET_OBJECT_VISIBLE(CSObject, 0);
 SET_OBJECT_COLLISION(CSObject, 0);

 // Blip
 ADD_BLIP_FOR_OBJECT(CSObject, &CSBlip);
 CHANGE_BLIP_SPRITE(CSBlip, BLIP_PLAYBOY_X_RED);
 CHANGE_BLIP_SCALE(CSBlip, 0.5f);
 CHANGE_BLIP_DISPLAY(CSBlip, 4);
 SET_BLIP_AS_SHORT_RANGE(CSBlip, 1);
 CHANGE_BLIP_NAME_FROM_ASCII(CSBlip, "Tony's apartment");

 while(TRUE)  // The real script LOOP !
 {
  if (LOCATE_CHAR_ON_FOOT_3D(GetPlayerPed(), -74.3f, -223.7f, 14.6f, 2.0f, 2.0f, 2.0f, 0))
  {
   PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Press  'T'  to enter Tony's apartment!", 500, 1);
   if (IS_GAME_KEYBOARD_KEY_PRESSED(20)) // Press "T"
   {
    DO_SCREEN_FADE_OUT(1000);
    WAIT(1000);
    CLEAR_NAMED_CUTSCENE("tony");
    SET_PLAYER_CONTROL(GetPlayerIndex(), 1);
    SET_CHAR_COORDINATES_NO_OFFSET(GetPlayerPed(), -74.933f, -204.725f, 32.81f);
    SET_CHAR_HEADING(GetPlayerPed(), 180.0f);
    LOAD_ALL_OBJECTS_NOW();
    INIT_CUTSCENE("tony");
    WAIT(1200);
    SET_CAM_BEHIND_PED(GetPlayerPed());
    DO_SCREEN_FADE_IN(1000);
   }
  }
  if (LOCATE_CHAR_ON_FOOT_3D(GetPlayerPed(), -74.549f, -199.814f, 32.809f, 2.0f, 2.0f, 2.0f, 0))
  {
   FREEZE_CHAR_POSITION(GetPlayerPed(), 1);
   DO_SCREEN_FADE_OUT(1000);
   WAIT(1000);
   CLEAR_NAMED_CUTSCENE("tony");
   SET_PLAYER_CONTROL(GetPlayerIndex(), 1);
   SET_CHAR_COORDINATES_NO_OFFSET(GetPlayerPed(), -74.213f, -226.05f, 14.652f);
   SET_CHAR_HEADING(GetPlayerPed(), 180.0f);
   SET_CAM_BEHIND_PED(GetPlayerPed());
   WAIT(1200);
   FREEZE_CHAR_POSITION(GetPlayerPed(), 0);
   DO_SCREEN_FADE_IN(1000);
  }
  // Wait!
  WAIT(0);
 }
}
WAIT(0);
}

Special thanx to Alexander Blade, sjaak327 and Billsy93cookie.gifcookie.gifcookie.gif

@ALL:
NOTE: All my scripts are for free use! Be fair: Please make a small credit like "Thanx to Skorpro" (in your Readme.txt and/or Topic)! Thanx
smile.gif

  • Deadly Target likes this

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#22

Posted 16 July 2013 - 02:55 AM Edited by Skorpro, 13 September 2013 - 02:50 AM.

Hi modders smile.gif

This time I've made an example "script.img" for all people who want to learn SCO coding smile.gif
The source codes are included...

Please download this Script.IMG example!

If you want to test it first, copy the script.img to your GTA IV folder (eg. "C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\common\data\cdimages")
Then remove all your savegames (C:\Users\USERNAME\Documents\Rockstar Games\GTA IV\SGTA*.*)
Now start GTA IV...

IMPORTANT: Don't forget to make backups of your savegames & original script.img!!!





-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-How to use source codes-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-


1. Create in drive "C:\" two folders called "Input" and "Output".
2. Copy the included 5 source files (main.c, ...) into "C:\Input".
3. Copy the included compile.bat to "...\Scocl\bin" (e.g. "C:\Scocl\bin") and start it!
4. Now you will find 5 SCO files in your Output folder.
5. Download and install OpenIV and start it.
6. Open the File menu and choose Create... (or press CTRL+N) then IMG archive, type "script.img" as name and save it. Next press "Yes".
7. Now you get a clean window. Press the green "+" button and choose the 5 compiled SCO files (C:\Output).
8. Open the File menu and choose Rebuild (or press Shift+CTRL+R) and press "Rebuild" then "OK" and "Yes".
9. Close OpenIV.
10. Make a BACKUP of your savegames folder (C:\Users\USERNAME\Documents\Rockstar Games\GTA IV\) then delete all "SGTA... files" (NOT "ControlMap.dat")!
11. Make a BACKUP of the original script.img (eg. in C:\Program Files\Rockstar Games\EFLC\TLAD\common\data\cdimages)!
12. Copy YOUR self-made script.img into the game folder (eg. in C:\Program Files\Rockstar Games\EFLC\TLAD\common\data\cdimages).
13. Start the game -> a new game will starts...

It's a little bit tricky... but if you follow my instruction step by step you will get it rightwink.gif





-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-How to change coords & keys-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-


To change spawn coords open "startup.c". Then edit this lines:

#define PLY_X 2783.87 // x
#define PLY_Y 426.42 // y
#define PLY_Z 5.82 // z
#define PLY_A 45.0 // heading

 

To change keys open "trainer.c". Then edit this lines:

if (IS_GAME_KEYBOARD_KEY_PRESSED(63)) // press F5

to eg. ...

if (IS_GAME_KEYBOARD_KEY_PRESSED(67)) // 67 = F9

and ...

if (IS_GAME_KEYBOARD_KEY_PRESSED(64)) // press F6

to eg. ...

if (IS_GAME_KEYBOARD_KEY_PRESSED(68)) // 68 = F10

To get the right KEY CODES for "IS_GAME_KEYBOARD_KEY_PRESSED" simply use my SCO KeysCodes Tool!






-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-How to add own scripts-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-


Open scriptlauncher.c and search this line...

CheckScript("trainer", FALSE);

...copy and paste it below!
Now change "trainer" to the name of your own SCO script! E.g.:

CheckScript("trainer", FALSE);
CheckScript("myfirstmod", FALSE); // for YOUR myfirstmod.sco!

Make a copy of "compile.bat" ("...\Scocl\bin") and rename it to "compile new.bat" and edit it like this:

@echo off
cls
echo .
echo .
echo . Compiling NEW script(s) for GTA IV...
echo .
echo .
pause

scocl.exe GTAIV "C:\Input\scriptlauncher.c" "C:\Output\" DEBUGOUTPUT
scocl.exe GTAIV "C:\Input\myfirstmod.c" "C:\Output\" DEBUGOUTPUT

cls
echo .
echo .
echo . READY! Now add the SCOs to script.img!
echo .
echo .
pause

Ok, start "compile new.bat"!
Add the 2 new SCOs to your script.img (see "How to use source codes") alien.gif



That was it for today! Have fun biggrin.gif

Skorpro


NOTE: All my scripts are for free use! Be fair: Please make a small credit like "Thanx to Skorpro" (in your Readme.txt and/or Topic)! Thanx smile.gif

  • jpm1 and Deadly Target like this

pedro2555
  • pedro2555

    Open Sourcer

  • Members
  • Joined: 02 Sep 2012
  • Portugal

#23

Posted 16 July 2013 - 05:09 PM

Great content on this topics. I've seen some functions used but not documented, can anyone add those to GTAModding?

I've just added something like 50+ native functions documentations, it would be extremely useful if people here do the same.

Fastvido
  • Fastvido

    Player Hater

  • Members
  • Joined: 16 Jul 2013

#24

Posted 17 July 2013 - 03:06 PM

I would like someone to make a mod like this but more updated and also if they can convert it for the xbox360/ps3 too?

lilToki
  • lilToki

    Player Hater

  • Members
  • Joined: 16 Aug 2012

#25

Posted 17 July 2013 - 07:17 PM Edited by lilToki, 17 July 2013 - 08:17 PM.

QUOTE (Fastvido @ Wednesday, Jul 17 2013, 15:06)
I would like someone to make a mod like this but more updated and also if they can convert it for the xbox360/ps3 too?

There is a Mod Request Post. Quit spamming the PC forums with your console needs & you already asked this in the console forums suicidal.gif ...

Michael Wojtanis
  • Michael Wojtanis

    Rinepim

  • Members
  • Joined: 17 Jul 2013

#26

Posted 18 July 2013 - 10:05 AM

@Skorpro
This is possible to check normal functions what is not in missions but in normal game?

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#27

Posted 25 July 2013 - 02:25 AM

QUOTE (Michael Wojtanis @ Thursday, Jul 18 2013, 10:05)
@Skorpro
This is possible to check normal functions what is not in missions but in normal game?

I'm sorry but don't understand exactly what you mean!?! (I'm afraid my English is a bit rusty.)
Do you mean hardcoded functions??

If you want explain it in Polish (I speak German and a little bit Polish too wink.gif )

PS: I like your GTA 5 Weapon HUD in GTA 4 0.905 mod! Very cool idea cookie.gif

LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#28

Posted 13 February 2014 - 04:49 PM

thanks for your hard work SkorPro ;)


Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009
  • Germany

#29

Posted 25 February 2014 - 11:04 AM

thanks for your hard work SkorPro ;)

You're welcome ch3y... wooops! I mean you're welcome YourGrace ;) :D

  • LordOfTheBongs likes this

LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#30

Posted 25 February 2014 - 03:26 PM

xD

 

Yeah I finally got a chance to test out your Tony's Apartment code... was very helpful, thanks. Im guessing no collision files were created since it was just meant to be a cutscene but would have been cool if there was a way to load collision in that apartment. Scripthookdotnet has a method to load the environment and I tried to use that instead of just Loading all objects now... the method i described actually calls that native. These are the natives it wraps...

 

REQUEST_COLLISION_AT_POSN

LOAD_ALL_OBJECTS_NOW

LOAD_SCENE
POPULATE_NOW

 

But no dice :/

 

Either way, the Tony's Apt mod taught me a thing or two, thanks for getting back to me with that info ;)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users