Guest User

SaveX by Tee

a guest
Apr 20th, 2011
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.20 KB | None | 0 0
  1. /*
  2.                  sssss     aa   v        v   eeeeeeee   x     x
  3.                 (         a  a   v      v   e            x   x
  4.                 ssss     aaaaaa   v    v   eeee            x
  5.                     )   a      a   v  v   e              x   x
  6.              sssssss   a        a   v    eeeeeeee      x       x
  7.                                                                    
  8. Hello SA:MP scripters, this Filterscript is a simple one. I am not sure if SA:MP has a command
  9. that allows you to save vehicles as "AddStaticVehicleEx" or "CreateVehicleEx".
  10. I was tired of having to type /save then open the file and removed "AddStaticVehicle" and put "AddStaticVehicleEx"
  11. and the same for "CreateVehicleEx". So I have created a FilterScript that allows you to do that.
  12. It has 2 types 1 - AddStaticVehicleEx and 2 - CreateVehicleEx. Then it saves them to your "scriptfiles" folder.
  13. All you need to do is open the file "CreateEx.txt" or "AddEx.txt" and copy and paste the lines to your script. Simple :D.
  14. Well that is basically what it does. */
  15.  
  16. #include <a_samp>
  17. #include <zcmd>
  18. #include <GetVehicleColor>
  19. #include <sscanf>
  20. #include <dini>
  21.  
  22. new String[128],Float:X,Float:Y,Float:Z,Float:Angle;
  23.  
  24. public OnFilterScriptInit()
  25. {
  26.     if(!fexist("CreateEx.txt"))
  27.     {
  28.         dini_Create("CreateEx.txt");
  29.     }
  30.     if(!fexist("AddEx.txt"))
  31.     {
  32.         dini_Create("AddEx.txt");
  33.     }
  34.     return 1;
  35. }
  36.  
  37. COMMAND:savex(playerid, params[])
  38. {
  39.     new comment[128],respawn_delay,color1,color2,type;
  40.     if(!IsPlayerAdmin(playerid))return 0;
  41.     if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0xC0C0C0FF,"You are not in a vehicle.");
  42.     if(sscanf(params,"iis",type,respawn_delay,comment))
  43.     {
  44.         SendClientMessage(playerid,0xC0C0C0FF,"Usage: /savex [type] [respawn_delay] [comment]");
  45.         SendClientMessage(playerid,0xC0C0C0FF,"1 - AddStaticVehicleEx");
  46.         SendClientMessage(playerid,0xC0C0C0FF,"2 - CreateVehicleEx");
  47.         return 1;
  48.     }
  49.     if(type == 1)
  50.     {
  51.         GetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
  52.         GetVehicleZAngle(GetPlayerVehicleID(playerid),Angle);
  53.         GetVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
  54.         format(String,sizeof(String),"AddStaticVehicleEx(%i,%f,%f,%f,%f,%i,%i,%i);// %s",GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,Angle,color1,color2,respawn_delay,comment);
  55.         SendClientMessage(playerid,0xC0C0C0FF,"In-Vehicle Position Saved. (Type 1 - AddStaticVehicleEx)");
  56.         AddStaticEx(String);
  57.     }
  58.     if(type == 2)
  59.     {
  60.         GetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
  61.         GetVehicleZAngle(GetPlayerVehicleID(playerid),Angle);
  62.         GetVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
  63.         format(String,sizeof(String),"CreateVehicleEx(%i,%f,%f,%f,%f,%i,%i,%i);// %s",GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,Angle,color1,color2,respawn_delay,comment);
  64.         SendClientMessage(playerid,0xC0C0C0FF,"In-Vehicle Position Saved. (Type 2 - CreateVehicleEx)");
  65.         CreateVehEx(String);
  66.     }
  67.     return 1;
  68. }
  69.  
  70. stock AddStaticEx(string[])
  71. {
  72.     new entry[250],File:sFile;
  73.     format(entry,sizeof(entry),"%s\r\n",string);
  74.     sFile = fopen("AddEx.txt",io_append);
  75.     fwrite(sFile,entry);
  76.     fclose(sFile);
  77. }
  78.  
  79. stock CreateVehEx(string[])
  80. {
  81.     new entry[250],File:sFile;
  82.     format(entry,sizeof(entry),"%s\r\n",string);
  83.     sFile = fopen("CreateEx.txt",io_append);
  84.     fwrite(sFile,entry);
  85.     fclose(sFile);
  86. }
Advertisement
Add Comment
Please, Sign In to add comment