[Help] Remove File
#1

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;
	}
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)