Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- sssss aa v v eeeeeeee x x
- ( a a v v e x x
- ssss aaaaaa v v eeee x
- ) a a v v e x x
- sssssss a a v eeeeeeee x x
- Hello SA:MP scripters, this Filterscript is a simple one. I am not sure if SA:MP has a command
- that allows you to save vehicles as "AddStaticVehicleEx" or "CreateVehicleEx".
- I was tired of having to type /save then open the file and removed "AddStaticVehicle" and put "AddStaticVehicleEx"
- and the same for "CreateVehicleEx". So I have created a FilterScript that allows you to do that.
- It has 2 types 1 - AddStaticVehicleEx and 2 - CreateVehicleEx. Then it saves them to your "scriptfiles" folder.
- 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.
- Well that is basically what it does. */
- #include <a_samp>
- #include <zcmd>
- #include <GetVehicleColor>
- #include <sscanf>
- #include <dini>
- new String[128],Float:X,Float:Y,Float:Z,Float:Angle;
- public OnFilterScriptInit()
- {
- if(!fexist("CreateEx.txt"))
- {
- dini_Create("CreateEx.txt");
- }
- if(!fexist("AddEx.txt"))
- {
- dini_Create("AddEx.txt");
- }
- return 1;
- }
- COMMAND:savex(playerid, params[])
- {
- new comment[128],respawn_delay,color1,color2,type;
- if(!IsPlayerAdmin(playerid))return 0;
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0xC0C0C0FF,"You are not in a vehicle.");
- if(sscanf(params,"iis",type,respawn_delay,comment))
- {
- SendClientMessage(playerid,0xC0C0C0FF,"Usage: /savex [type] [respawn_delay] [comment]");
- SendClientMessage(playerid,0xC0C0C0FF,"1 - AddStaticVehicleEx");
- SendClientMessage(playerid,0xC0C0C0FF,"2 - CreateVehicleEx");
- return 1;
- }
- if(type == 1)
- {
- GetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
- GetVehicleZAngle(GetPlayerVehicleID(playerid),Angle);
- GetVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
- 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);
- SendClientMessage(playerid,0xC0C0C0FF,"In-Vehicle Position Saved. (Type 1 - AddStaticVehicleEx)");
- AddStaticEx(String);
- }
- if(type == 2)
- {
- GetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
- GetVehicleZAngle(GetPlayerVehicleID(playerid),Angle);
- GetVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
- 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);
- SendClientMessage(playerid,0xC0C0C0FF,"In-Vehicle Position Saved. (Type 2 - CreateVehicleEx)");
- CreateVehEx(String);
- }
- return 1;
- }
- stock AddStaticEx(string[])
- {
- new entry[250],File:sFile;
- format(entry,sizeof(entry),"%s\r\n",string);
- sFile = fopen("AddEx.txt",io_append);
- fwrite(sFile,entry);
- fclose(sFile);
- }
- stock CreateVehEx(string[])
- {
- new entry[250],File:sFile;
- format(entry,sizeof(entry),"%s\r\n",string);
- sFile = fopen("CreateEx.txt",io_append);
- fwrite(sFile,entry);
- fclose(sFile);
- }
Advertisement
Add Comment
Please, Sign In to add comment