SA-MP Forums Archive
DestroyHouse does not reset house owners ownership status - 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)
+--- Thread: DestroyHouse does not reset house owners ownership status (/showthread.php?tid=614782)



DestroyHouse does not reset house owners ownership status - Avetsky - 12.08.2016

Hey, I am using a house filterscript and I have discovered a pretty groundbreaking problem. Basically, whenever a house is deleted, the house itself gets removed finely from the scriptfiles, but the house owners ownership status remains as a positive number. How can I make it so when you destroy a house, it sets the house owners owner status to -1?

I do not really know which part of a code I should paste, ask for any part and I will paste it.


Re: DestroyHouse does not reset house owners ownership status - Avetsky - 13.08.2016

alright dont help then


Re: DestroyHouse does not reset house owners ownership status - BR3TT - 13.08.2016

Show us the part that destroys the house. Maybe you aren't changing/deleting all the data. If you want to keep the data then you aren't changing and saving the ownership.


Re: DestroyHouse does not reset house owners ownership status - CrazyPerry - 13.08.2016

CAN YOU show us the code that your destroy the house?


Re: DestroyHouse does not reset house owners ownership status - Avetsky - 13.08.2016

Код:
COMMAND:destroyhouse(playerid, params[])
{
	new houseid;
	if(GetPVarInt(playerid, "Admin") == 10 || IsPlayerAdmin(playerid))
    {
    	if(!sscanf(params, "i", houseid))
    	{
        	new string[254];
    	    format(string, sizeof(string), "Houses/house%i.ini", houseid);
    	    if(DOF2_FileExists(string))
    	    {
				new ModelFile[124];
				new XFile[124];
				new YFile[124];
				new ZFile[124];
				new IntVwFile[124];
				format(string, sizeof(string), "Houses/house%i.ini", houseid);
				format(ModelFile,sizeof(ModelFile),"Houses/furnhouse%i.ini",houseid);
				format(IntVwFile,sizeof(IntVwFile),"Houses/furnIntVwhouse%i.ini",houseid);
				format(XFile,sizeof(XFile),"Houses/furnXhouse%i.ini",houseid);
				format(YFile,sizeof(YFile),"Houses/furnYhouse%i.ini",houseid);
				format(ZFile,sizeof(ZFile),"Houses/furnZhouse%i.ini",houseid);
	    		DOF2_RemoveFile(ModelFile);
	    		DOF2_RemoveFile(IntVwFile);
	    		DOF2_RemoveFile(XFile);
	    		DOF2_RemoveFile(YFile);
	    		DOF2_RemoveFile(ZFile);
				DOF2_RemoveFile(string);
				format(string, sizeof(string),"House: %d destroyed successfuly.",houseid);
				SendClientMessage(playerid, COLOR_ORANGE, string);
		 		DestroyDynamic3DTextLabel(House3D[houseid]);
		 		DestroyDynamicPickup(HousePickup[houseid]);
		 		HouseInfo[houseid][HouseEnterPos][0] = 0;
				HouseInfo[houseid][HouseEnterPos][1] = 0;
				HouseInfo[houseid][HouseEnterPos][2] = 0;
	   			for(new h = 0; h < MAX_FURNITURE;h++)
				{
	    			HouseInfo[houseid][ObjectID][h] = 0;
					DestroyDynamicObject(HouseObject[houseid][h]);
				}
	 			return 1;
			}
			else return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: This house does not exist!");
		}
		else return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: /destroyhouse [houseid]!");
	}
	else return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You can not use this command!");
}



Re: DestroyHouse does not reset house owners ownership status - Konstantinos - 13.08.2016

So basically the file is removed but the owner's name was not reset from the variables. Posting the enum for HouseInfo array would be useful.


Re: DestroyHouse does not reset house owners ownership status - Avetsky - 13.08.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
So basically the file is removed but the owner's name was not reset from the variables. Posting the enum for HouseInfo array would be useful.
This is the whole set.

Код:
enum hInfo
{
	Owned,
	OwnerName[124],
	Rented,
	Type,
	RenterName[124],
	Price,
	RentPrice,
	Locked,
	//Furniture
	Int,
	Vw,
	Float:HouseEnterPos[3],
	Float:HouseIntPos[3],
	ObjectID[MAX_FURNITURE],
	Float:ObjectPosX[MAX_FURNITURE],
	Float:ObjectPosZ[MAX_FURNITURE],
	Float:ObjectPosY[MAX_FURNITURE],
	Float:ObjectPosRX[MAX_FURNITURE],
	Float:ObjectPosRY[MAX_FURNITURE],
	Float:ObjectPosRZ[MAX_FURNITURE],
	ObjectVW[MAX_FURNITURE],
	ObjectInt[MAX_FURNITURE]
}
new HouseInfo[MAX_HOUSES][hInfo];

new Text3D:House3D[MAX_HOUSES];
new HousePickup[MAX_HOUSES];

new FurnObject[MAX_PLAYERS];
new FurnID[MAX_PLAYERS];
new HouseObject[MAX_HOUSES][MAX_FURNITURE];



Re: DestroyHouse does not reset house owners ownership status - Konstantinos - 13.08.2016

124 is way too big for a player's name. 24 (MAX_PLAYER_NAME) is just fine.

pawn Код:
HouseInfo[houseid][OwnerName][0] = HouseInfo[houseid][RenterName][0] = EOS;
HouseInfo[houseid][Owned] = HouseInfo[houseid][Rented] = 0;
reset the owner's name and the name of the player who has rented the house and both owned and rented.