SA-MP Forums Archive
[Help] Remove File - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Remove File (/showthread.php?tid=125193)



[Help] Remove File - Oi! - 02.02.2010

It works fine, only thing is it doesn't delete the file from the folder...

Can someone help me?

Код:
	if(strcmp(cmd, "/destroyhouse", true) == 0)
 	{
		if(IsPlayerConnected(playerid))
    {
	 		if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid,COLOR_RED,"	You are not authorized to use this command!");
			else if(GetPlayerInterior(giveplayerid) != 0) return SendClientMessage(playerid,COLOR_GREY, "Make sure the player is out of their house!");
	    else if(HouseInfo[giveplayerid][hHouseX] == 0) return SendClientMessage(playerid,COLOR_GREY, "That player does not own a house!");
	 		else
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /destroyhouse [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
	 			if(giveplayerid != INVALID_PLAYER_ID)
		  	{
					new string3[128];
					new playername3[MAX_PLAYER_NAME];
					GetPlayerName(giveplayerid, playername3, sizeof(playername3));
					format(string3, sizeof(string3), "houses/%s.ini", playername3);
					new File: hFile = fopen(string3, io_append);
					if (hFile)
					{
						fremove(playername3);
	 		 			carid = playercarid[giveplayerid];
						DestroyVehicle(carid);
	 					SendClientMessage(playerid,COLOR_GREY,"	You have successfully destroyed a house!");
	 					SendClientMessage(giveplayerid,COLOR_GREY,"	Your house has just been destroyed by an admin!");
						return 1;
					}
				}
			}
			else
			{
	 			SendClientMessage(playerid, COLOR_GREY, "  Invalid Name/ID !");
			}
		}
		return 1;
	}



Re: [Help] Remove File - Jefff - 02.02.2010

U dont need this
Код:
new File: hFile = fopen(string3, io_append);
if (hFile)
{
Код:
if(fexist(string3))
{
fremove(string3);