[Ajuda] Arquivo ini nгo estб sendo deletado! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Arquivo ini nгo estб sendo deletado! (
/showthread.php?tid=623849)
Arquivo ini nгo estб sendo deletado! -
SukMathcuck - 06.12.2016
Olб, sou novato no pwn, estou em duvida de como deletar a empresa de veнculos criada, estб criando, mais nгo deleta.
Como posso fazer para que delete o arquivo ini nas scriptfiles?
Acho que nгo estб deletando, por que? Nгo existe a funзгo de deletar o arquivo?
PHP код:
CMD:deletedealership(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command!");
new
dealerid,
msg[128];
if(sscanf(params, "d", dealerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletedealership [dealerid]");
if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_RED, "Invalid dealerid!");
for(new i=1; i < MAX_DVEHICLES; i++)
{
if(VehicleCreated[i] == VEHICLE_DEALERSHIP && strval(VehicleOwner[i]) == dealerid)
{
DestroyVehicle(VehicleID[i]);
Delete3DTextLabel(VehicleLabel[i]);
VehicleCreated[i] = 0;
}
}
DealershipCreated[dealerid] = 0;
Delete3DTextLabel(DealershipLabel[dealerid]);
SaveDealership(dealerid);
format(msg, sizeof(msg), "Deleted dealership id %d", dealerid);
SendClientMessage(playerid, COLOR_WHITE, msg);
return 1;
}
PHP код:
SaveDealership(dealerid)
{
new Filename[64], line[256];
format(Filename, sizeof(Filename), "Concessionбrias/d%d.ini", dealerid);
new File:handle = fopen(Filename, io_write);
format(line, sizeof(line), "Created=%d\r\n", DealershipCreated[dealerid]); fwrite(handle, line);
format(line, sizeof(line), "Pos=%.3f,%.3f,%.3f\r\n", DealershipPos[dealerid][0],
DealershipPos[dealerid][1], DealershipPos[dealerid][2]);
fwrite(handle, line);
fclose(handle);
}