I was thinking so i made this command to save the CreateVehicle() function which will be added on a file in the scriptfiles folder. But how can i make this same cmd to save this data to a file with the same name but with the directory " pawno/includes ". This is a tested Command and works fine! Please help me to change the directory of saving!
pawn Код:
COMMAND:addveh(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new color1,color2,vehicleid = GetPlayerVehicleID(playerid),string[80];
if(sscanf(params, "dd",color1,color2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /addveh [Color1] [Color2]");
if(color1 < 0 || color1 > 250) return SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 250 !");
if(color2 < 0 || color2 > 250) return SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 250 !");
new Float:X,Float:Y,Float:Z,Float:A,File:pos;
GetVehiclePos(vehicleid,X,Y,Z);
GetVehicleZAngle(vehicleid,A);
pos = fopen("LSveh.txt", io_append);
format(string, 256, "CreateVehicle(%d ,%f, %f, %f, %f, %d,%d,5 * 60 * 1000);\n",GetVehicleModel(vehicleid), X, Y, Z, A,color1,color2);
fwrite(pos, string);
fclose(pos);
format(string, sizeof(string), "Vehicle Model %d Created At Location : %f, %f, %f",GetVehicleModel(vehicleid), X,Y,Z);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_GRAD3, "You are not authorised to use this Command");
}
else return SendClientMessage(playerid,COLOR_GRAD3,"You need to be in a Vehicle to use this Command.");
}
NOTE: Should i change this command to this?? O.o
pawn Код:
COMMAND:addveh(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new color1,color2,vehicleid = GetPlayerVehicleID(playerid),string[80];
if(sscanf(params, "dd",color1,color2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /addveh [Color1] [Color2]");
if(color1 < 0 || color1 > 250) return SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 250 !");
if(color2 < 0 || color2 > 250) return SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 250 !");
new Float:X,Float:Y,Float:Z,Float:A,File:pos;
GetVehiclePos(vehicleid,X,Y,Z);
GetVehicleZAngle(vehicleid,A);
pos = fopen("pawno/include/LSveh.txt", io_append); // Or pos = fopen("pawno\include\LSveh.txt", io_append); Or something else??
format(string, 256, "CreateVehicle(%d ,%f, %f, %f, %f, %d,%d,5 * 60 * 1000);\n",GetVehicleModel(vehicleid), X, Y, Z, A,color1,color2);
fwrite(pos, string);
fclose(pos);
format(string, sizeof(string), "Vehicle Model %d Created At Location : %f, %f, %f",GetVehicleModel(vehicleid), X,Y,Z);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_GRAD3, "You are not authorised to use this Command");
}
else return SendClientMessage(playerid,COLOR_GRAD3,"You need to be in a Vehicle to use this Command.");
}