Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <SII>
- #include <ZCMD>
- #include <sscanf>
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_RED 0xFF0000FF
- #define CYELLOW "{9DBD1E}"
- #define CORANGE "{E68C0E}"
- #define CBLUE "{39AACC}"
- #define CDGREEN "{6FA828}"
- #define CWHITE "{FFFFFF}"
- #define CRED "{FF0000}"
- #define CGREY "{7D8584}"
- #define MAX_BUYABLE_VEH 500
- new totalveh = 0;
- public OnFilterScriptInit()
- {
- LoadAllVehicles();
- printf("Car Making System by Electrux Loaded!!");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i = 0; i < MAX_BUYABLE_VEH; ++i)
- DestroyVehicle(i);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SendClientMessage(playerid,COLOR_RED,"Car Making system by Electrux");
- return 1;
- }
- CMD:csv(playerid,params[])
- {
- new CarFile[20],model,Float:px,Float:py,Float:pz,Float:pa,c1,c2,str1[256];
- if(sscanf(params,"iii",model,c1,c2)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /csv [modeid] [color1] [color2]");
- if(totalveh > MAX_BUYABLE_VEH) return SendClientMessage(playerid,COLOR_RED,"Max vehicle number already reached");
- GetPlayerPos(playerid,px,py,pz);
- GetPlayerFacingAngle(playerid,pa);
- format(CarFile, sizeof(CarFile), "/savevehs/%d.ini", totalveh);
- INI_Open(CarFile);
- INI_WriteInt("ModelID",model);
- INI_WriteFloat("PosX",px);
- INI_WriteFloat("PosY",py);
- INI_WriteFloat("PosZ",pz);
- INI_WriteFloat("Angle",pa);
- INI_WriteInt("Color1",c1);
- INI_WriteInt("Color2",c2);
- INI_Save();
- INI_Close();
- ++ totalveh;
- CreateVehicle(model,px,py,pz,pa,c1,c2,10*60);
- format(str1, sizeof(str1), ""#CYELLOW"Vehicle: "#CBLUE"%i (VID: %i) "#CYELLOW"has been created.", model,totalveh);
- SendClientMessage(playerid, -1, str1);
- return 1;
- }
- stock LoadAllVehicles()
- {
- for(new i = 0; i < MAX_BUYABLE_VEH; ++i)
- {
- new File[20],model,Float:px,Float:py,Float:pz,Float:pa,c1,c2;
- format(File, sizeof(File), "/savevehs/%d.ini", i);
- if(INI_Exist(File))
- {
- INI_Open(File);
- printf("\n-------------------------------------------------------------------------\n");
- model = INI_ReadInt("ModelID"); printf("Car Model --> %d",model);
- px = INI_ReadFloat("PosX"); printf("PosX --> %f",px);
- py = INI_ReadFloat("PosY"); printf("PosY --> %f",py);
- pz = INI_ReadFloat("PosZ"); printf("PosZ --> %f",pz);
- pa = INI_ReadFloat("Angle"); printf("Angle --> %f",pa);
- c1 = INI_ReadInt("Color1"); printf("Color1 --> %d",c1);
- c2 = INI_ReadInt("Color2"); printf("Color2 --> %d",c2);
- printf("\n-------------------------------------------------------------------------\n");
- INI_Close();
- ++ totalveh;
- }
- CreateVehicle(model,px,py,pz,pa,c1,c2,10*60);
- }
- printf("\n======================================\n======================================\nTotal Vehicles %d\n======================================\n======================================\n",totalveh);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment