Код:
if(!strcmp(cmdtext, "/asellcar", true)) //Modded by Robin_Hellman Aka GTA-roleplay
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "* You need to login first !");
return 1;
}
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new ownvehkey = GetPlayerVehicleID(playerid);
RemovePlayerFromVehicle(playerid);
strmid(CarInfo[ownvehkey][cOwner], string, 0, strlen(string), 999);
format(string,sizeof(string),"No-One");
CarInfo[ownvehkey][cLocationx] = 7497.1460;
CarInfo[ownvehkey][cLocationy] = -926.4014;
CarInfo[ownvehkey][cLocationz] = -7.0675;
CarInfo[ownvehkey][cAngle] = 270.7372;
CarInfo[ownvehkey][cVirWorld] = 155;
CarInfo[ownvehkey][cPaintjob] = 999;
CarInfo[ownvehkey][cColorOne] = 1;
CarInfo[ownvehkey][cColorTwo] = 1;
CarInfo[ownvehkey][cComponent0] = 0;
CarInfo[ownvehkey][cComponent1] = 0;
CarInfo[ownvehkey][cComponent2] = 0;
CarInfo[ownvehkey][cOwned] = 0;
CarInfo[ownvehkey][cComponent3] = 0;
CarInfo[ownvehkey][cComponent4] = 0;
CarInfo[ownvehkey][cComponent5] = 0;
CarInfo[ownvehkey][cUnused] = 1;
CarInfo[ownvehkey][cComponent6] = 0;
CarInfo[ownvehkey][cComponent7] = 0;
CarInfo[ownvehkey][cComponent8] = 0;
CarInfo[ownvehkey][cComponent9] = 0;
CarInfo[ownvehkey][cComponent10] = 0;
CarInfo[ownvehkey][cComponent11] = 0;
CarInfo[ownvehkey][cComponent12] = 0;
CarInfo[ownvehkey][cComponent13] = 0;
CarInfo[ownvehkey][cID] = 0;
SetVehicleToRespawn(ownvehkey);
TogglePlayerControllable(playerid, 1);
new file[64];
format(file, sizeof(file),"LARP/Vehicles/%s.ini", ownvehkey);
fremove(file);
new ye,m,d;
new h,mi,s;
getdate(ye,m,d);
gettime(h,mi,s);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pPcarkey] == ownvehkey || PlayerInfo[i][pPcarkey2] == ownvehkey)
{
if(PlayerInfo[i][pPcarkey] == ownvehkey) PlayerInfo[i][pPcarkey] = 9999;
else if(PlayerInfo[i][pPcarkey2] == ownvehkey) PlayerInfo[i][pPcarkey2] = 9999;
GivePlayerMoney(i, GetVehiclePrice(ownvehkey) / 2);
}
else
{
format(string, sizeof(string),"LARP/Users/%s.ini",CarInfo[ownvehkey][cOwner]);
new totalcash = dini_Int(string,"Money") + GetVehiclePrice(ownvehkey);
dini_IntSet(string,"Money",totalcash);
if(dini_Int(string,"CarKey") == ownvehkey)
{
dini_IntSet(string,"CarKey",9999);
}
else if(dini_Int(string,"CarKey2") == ownvehkey)
{
dini_IntSet(string,"CarKey2",9999);
}
}
}
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~w~You have admin sold the vehicle", 10000, 3);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Admin Sold the Vehicle: [%d]",d,m,ye,h,mi,s,sendername,ownvehkey);
AdminLog(string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "** You're not authorized to use that command !");
return 1;
}
}
return 1;
}
Should this remove the %s.ini (Car/ID INI) ? I'm trying to get it to actually delete the car-file when admin sold.
You can't really save a vehicleid to a file, as it changes constantly. Which is probably why you were having trouble with the garage filterscript. (I think that was you)
If you're saving a vehicleid, saving it to a file, then loading it after restarting your server, you're probably not going to get the expected result.