#include <a_samp>
#include <dini>
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
new vehics[256];
new Float:vehx;
new Float:vehy;
new Float:vehz;
new Float:vehang;
new vehm;
new vehc1;
new vehc2;
new vehictext[256];
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Car Spawner Test Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
for (new vehicids; vehicids<701; vehicids++)
{
format(vehics,sizeof(vehics), "%d.car",vehicids);
if (dini_Exists(vehics))
{ vehx=dini_Float(vehics, "X-Pos");
vehy=dini_Float(vehics, "Y-Pos");
vehz=dini_Float(vehics, "Z-Pos");
vehm=dini_Int(vehics, "Model");
vehc1=dini_Int(vehics, "Color1");
vehc2=dini_Int(vehics, "Color2");
AddStaticVehicle(vehm, vehx, vehy, vehz, vehang, vehc1, vehc2);
format(vehictext,sizeof(vehictext), "Car Created! Model:%d at X:%f Y:%f Z:%f", vehm, vehx, vehy, vehz);
print (vehictext);
}
}
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp(cmd,"/savecar", true, 10) == 0)
{ new tmp[256];
new tmp2[256];
tmp = strtok(cmdtext, idx);
new color1 = strval(tmp);
tmp2 = strtok(cmdtext, idx);
new color2 = strval(tmp);
if(IsPlayerInAnyVehicle(playerid))
{
new vehictemp=GetPlayerVehicleID(playerid);
new Float:vehicx;
new Float:vehicy;
new Float:vehicz;
new Float:vehicangle;
new vehicmodel=(GetVehicleModel(vehictemp));
new vehicstring[256];
format(vehicstring,sizeof(vehicstring), "%d.car",vehictemp);
GetVehiclePos(vehictemp, vehicx, vehicy, vehicz);
GetVehicleZAngle(vehictemp, vehicangle);
DestroyVehicle(vehictemp);
if (!dini_Exists(vehicstring))
{dini_Create(vehicstring);}
dini_FloatSet(vehicstring,"X-Pos",vehicx);
dini_FloatSet(vehicstring,"Y-Pos",vehicy);
dini_FloatSet(vehicstring,"Z-Pos",vehicz);
dini_FloatSet(vehicstring,"Angle",vehicangle);
dini_IntSet(vehicstring,"Model",vehicmodel);
dini_IntSet(vehicstring,"Color1",color1);
dini_IntSet(vehicstring,"Color2",color2);
SendClientMessage(playerid, 0xDEEE20FF, "Car Saved!");
CreateVehicle(vehicmodel, vehicx, vehicy, vehicz, vehicangle, color1, color2, 100000000^1000000000);
}
return 1;
}
return 0;
}