XADRENALINEIX

Evil B's Simple Base for Map Mods

Jul 6th, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.24 KB | None | 0 0
  1. #include <natives.h>
  2. #include <common.h>
  3. #include <consts.h>
  4. #include <types.h>
  5. #include <strings.h>
  6.  
  7.  
  8. /*********************************
  9. *   Always have this to the number
  10. *   of objects or vehicles
  11. *   you want + 1 to keep the
  12. *   array from breaking your
  13. *   script.
  14. *********************************/
  15. #define NUM_OF_OBJECTS 3
  16. #define NUM_OF_VEH 3
  17.  
  18. Object objects[NUM_OF_OBJECTS];
  19. Vehicle vehicles[NUM_OF_VEH];
  20. bool network;
  21. uint episode;
  22.  
  23. void create_object(uint model, float x, float y, float z, float h, float qx, float qy, float qz, float qw, bool dynamic, int id){
  24.     int nvid;
  25.     if(IS_MODEL_IN_CDIMAGE(model)){
  26.         REQUEST_MODEL(model);
  27.         while(!HAS_MODEL_LOADED(model)) WAIT(0);
  28.  
  29.         CREATE_OBJECT_NO_OFFSET(model, x, y, z, &objects[id], true);
  30.         SET_OBJECT_HEADING(objects[id], h);
  31.         SET_OBJECT_QUATERNION(objects[id], qx, qy, qz, qw);
  32.         SET_OBJECT_INVINCIBLE(objects[id], true);
  33.         SET_OBJECT_PROOFS(objects[id], false, false, false, false, false);
  34.         SET_OBJECT_VISIBLE(objects[id], true);
  35.         SET_OBJECT_LIGHTS(objects[id], true);
  36.  
  37.         if (dynamic)
  38.             SET_OBJECT_DYNAMIC(objects[id], true);
  39.         else
  40.             FREEZE_OBJECT_POSITION(objects[id], true);
  41.  
  42.         MARK_MODEL_AS_NO_LONGER_NEEDED(model);
  43.         WAIT(50);
  44.  
  45.         if(network){
  46.             GET_NETWORK_ID_FROM_OBJECT(objects[id], &nvid);
  47.             SET_NETWORK_ID_CAN_MIGRATE(nvid, false);
  48.         }
  49.     }
  50.     else print("One or more object models not in episode!");
  51. }
  52.  
  53. void create_car(uint model,float x,float y,float z,float h, float qx, float qy, float qz, float qw, int id){
  54.     if(IS_MODEL_IN_CDIMAGE(model)){
  55.         REQUEST_MODEL(model);
  56.         while(!HAS_MODEL_LOADED(model)) WAIT(0);
  57.         CREATE_CAR(model,x,y,z,&vehicles[id],true);
  58.         SET_CAR_HEADING(vehicles[id],h);
  59.         SET_VEHICLE_QUATERNION(vehicles[id], qx, qy, qz, qw);
  60.        
  61.         MARK_MODEL_AS_NO_LONGER_NEEDED(model);
  62.     }
  63.     else print("One or more vehicle models not in episode!");
  64. }
  65.  
  66. void main(void){
  67.     THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
  68.     episode = GET_CURRENT_EPISODE();
  69.     network = IS_NETWORK_SESSION();
  70.     WAIT(500);
  71.     create_object(
  72.     create_object(
  73.  
  74.     /*********************************
  75.     *   Credits if you want to have
  76.     *   some in the script.
  77.     *********************************/
  78.     print("Map Name name");
  79.     WAIT(5000);
  80.     print("By: Creator");
  81.     while(true)
  82.         WAIT(0);
  83. }
Advertisement
Add Comment
Please, Sign In to add comment