How to remove the original house at SAMP ?
#1

Hello, i have a problem here... The problem is :

I have made an house system script (buy, sell, lock, unlock and etc). But the /lock commands didn"t work as well. When i make an house checkpoint at Original House (Original HOuse at GTA SA Game) and i bought the house, when i want to lock the prop its not working, it says "your property dont have interiors. i know its because i didn't also using commands /addpropint so that will happen. So i think, can i remove the original house interior and make new using /addprop and /addpropint ? if can please tell me how... also i put the script, so if someone can help to rebuild the script without deleted the original prop, please help Thanks a lot

Script :

Код:
CMD:lockprop(playerid, params[])
{
	new playername[25], giveplayer[25], tmp2[256], temp2;
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	if (areatype[playerarea[playerid]][0] != AREA_TYPE_PROP) return SendClientMessage2(playerid, COLOR_RED, "You must be at your property to lock it!");
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	if (areatype[playerarea[playerid]][1] != dini_Int(AddDirFile(dir_userfiles, playername), "propowned")) return SendClientMessage2(playerid, COLOR_RED, "You do not own this property!");
	format(giveplayer, 10, "prop%d", areatype[playerarea[playerid]][1]);
	if(!dini_Isset(AddDirFile(dir_propfiles, giveplayer), "interior")) return SendClientMessage(playerid, COLOR_RED,"Your property doesnt have an interior.");
	temp2 = dini_Int(AddDirFile(dir_propfiles, giveplayer), "interior");
	format(tmp2, sizeof(tmp2), "propint%d", temp2);
	//if(dini_Int(AddDirFile(dir_propints, tmp2), "locked")==1) return SendClientMessage(playerid, COLOR_RED, "ERROR:You Have Already Locked Your Prop.");
	if(dini_Isset(AddDirFile(dir_propints, tmp2), "Locked")) return SendClientMessage2(playerid, COLOR_RED, "You have already locked your property.");
	dini_IntSet(AddDirFile(dir_propints, tmp2), "locked", 1);
 	GameTextForPlayer(playerid, "~p~Property locked", 5000, 3);
	return 1;
}


CMD:unlockprop(playerid, params[])
{
	new playername[25], giveplayer[25], tmp2[256], temp2;
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	if (areatype[playerarea[playerid]][0] != AREA_TYPE_PROP) return SendClientMessage2(playerid, COLOR_RED, "You must be at your property to unlock it!");
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	if (areatype[playerarea[playerid]][1] != dini_Int(AddDirFile(dir_userfiles, playername), "propowned")) return SendClientMessage2(playerid, COLOR_RED, "You do not own this property!");
	format(giveplayer, 10, "prop%d", areatype[playerarea[playerid]][1]);
	if(!dini_Isset(AddDirFile(dir_propfiles, giveplayer), "interior")) return SendClientMessage(playerid, COLOR_RED,"Your property doesnt have an interior.");
	temp2 = dini_Int(AddDirFile(dir_propfiles, giveplayer), "interior");
	format(tmp2, sizeof(tmp2), "propint%d", temp2);
	//if(dini_Int(AddDirFile(dir_propints, tmp2), "locked")==0) return SendClientMessage(playerid, COLOR_RED, "ERROR:You Have Already UnLocked Your Prop.");
	//dini_IntSet(AddDirFile(dir_propints, tmp2), "locked", 0);
 	if(!dini_Isset(AddDirFile(dir_propints, tmp2), "Locked")) return SendClientMessage2(playerid, COLOR_RED, "You have already unlocked your property.");
	dini_Unset(AddDirFile(dir_propints, tmp2), "Locked");
 	GameTextForPlayer(playerid, "~p~Property unLocked", 5000, 3);
	return 1;
}
Reply
#2

why are those so confusing. And why do you have 2 commands. Just set a bool:locked=true;
If someone writes /lock check if they are at a house entrance and get house id from there.
Check if they own the house(or have keys), check if locked is true or false and do opposite of it and save house.
Way too easier and saves time. I use Dini too, here is my lock command:

Код:
CMD:lock(playerid,params[])
{
	new playName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playName, MAX_PLAYER_NAME);
    for(new i = 0; i < MHOUSE; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.5, hInfo[i][henx], hInfo[i][heny], hInfo[i][henz]))
        {
            if(!strcmp(hInfo[i][howner], playName, false)||!strcmp(hInfo[i][hkey], playName, false))
            {
                if(hInfo[i][locked]==true)
                {
                	hInfo[i][locked] = false; 
                	SendClientMessage(playerid, COLOR_GREEN, "House unlocked!");
                	return 1;
				}
				if(hInfo[i][locked]==false)
                {
                	hInfo[i][locked] = true; 
                	SendClientMessage(playerid, COLOR_GREEN, "House locked!");
                	return 1;
				}
            }
         }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)