electrux

Car Make System By Electrux

Aug 6th, 2012
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.98 KB | None | 0 0
  1. #include <a_samp>
  2. #include <SII>
  3. #include <ZCMD>
  4. #include <sscanf>
  5.  
  6. #define COLOR_GREY  0xAFAFAFAA
  7. #define COLOR_RED   0xFF0000FF
  8. #define CYELLOW     "{9DBD1E}"
  9. #define CORANGE     "{E68C0E}"
  10. #define CBLUE       "{39AACC}"
  11. #define CDGREEN     "{6FA828}"
  12. #define CWHITE      "{FFFFFF}"
  13. #define CRED        "{FF0000}"
  14. #define CGREY       "{7D8584}"
  15.  
  16. #define MAX_BUYABLE_VEH     500
  17.  
  18.  
  19. new totalveh = 0;
  20.  
  21.  
  22. public OnFilterScriptInit()
  23. {
  24.     LoadAllVehicles();
  25.     printf("Car Making System by Electrux Loaded!!");
  26.     return 1;
  27. }
  28. public OnFilterScriptExit()
  29. {
  30.     for(new i = 0; i < MAX_BUYABLE_VEH; ++i)
  31.     DestroyVehicle(i);
  32.     return 1;
  33. }
  34. public OnPlayerConnect(playerid)
  35. {
  36.     SendClientMessage(playerid,COLOR_RED,"Car Making system by Electrux");
  37.     return 1;
  38. }
  39. CMD:csv(playerid,params[])
  40. {
  41.         new CarFile[20],model,Float:px,Float:py,Float:pz,Float:pa,c1,c2,str1[256];
  42.     if(sscanf(params,"iii",model,c1,c2)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /csv [modeid] [color1] [color2]");
  43.     if(totalveh > MAX_BUYABLE_VEH) return SendClientMessage(playerid,COLOR_RED,"Max vehicle number already reached");
  44.     GetPlayerPos(playerid,px,py,pz);
  45.     GetPlayerFacingAngle(playerid,pa);
  46.     format(CarFile, sizeof(CarFile), "/savevehs/%d.ini", totalveh);
  47.     INI_Open(CarFile);
  48.     INI_WriteInt("ModelID",model);
  49.     INI_WriteFloat("PosX",px);
  50.     INI_WriteFloat("PosY",py);
  51.     INI_WriteFloat("PosZ",pz);
  52.         INI_WriteFloat("Angle",pa);
  53.         INI_WriteInt("Color1",c1);
  54.         INI_WriteInt("Color2",c2);
  55.         INI_Save();
  56.         INI_Close();
  57.     ++ totalveh;
  58.     CreateVehicle(model,px,py,pz,pa,c1,c2,10*60);
  59.    
  60.     format(str1, sizeof(str1), ""#CYELLOW"Vehicle: "#CBLUE"%i (VID: %i) "#CYELLOW"has been created.", model,totalveh);
  61.     SendClientMessage(playerid, -1, str1);
  62.     return 1;
  63. }
  64.  
  65. stock LoadAllVehicles()
  66. {
  67.     for(new i = 0; i < MAX_BUYABLE_VEH; ++i)
  68.     {
  69.         new File[20],model,Float:px,Float:py,Float:pz,Float:pa,c1,c2;
  70.  
  71.         format(File, sizeof(File), "/savevehs/%d.ini", i);
  72.  
  73.         if(INI_Exist(File))
  74.         {
  75.             INI_Open(File);
  76.             printf("\n-------------------------------------------------------------------------\n");
  77.             model = INI_ReadInt("ModelID");     printf("Car Model           -->     %d",model);
  78.             px = INI_ReadFloat("PosX");         printf("PosX                -->     %f",px);
  79.             py = INI_ReadFloat("PosY");         printf("PosY                -->     %f",py);
  80.             pz = INI_ReadFloat("PosZ");         printf("PosZ                -->     %f",pz);
  81.             pa = INI_ReadFloat("Angle");        printf("Angle               -->     %f",pa);
  82.             c1 = INI_ReadInt("Color1");         printf("Color1              -->     %d",c1);
  83.             c2 = INI_ReadInt("Color2");         printf("Color2              -->     %d",c2);
  84.             printf("\n-------------------------------------------------------------------------\n");
  85.             INI_Close();
  86.             ++ totalveh;
  87.         }
  88.         CreateVehicle(model,px,py,pz,pa,c1,c2,10*60);
  89.     }
  90.     printf("\n======================================\n======================================\nTotal Vehicles %d\n======================================\n======================================\n",totalveh);
  91.     return 1;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment