Scripting Help
#1

I am using GarHouse System for houses, i need a help that the max houses owned per player is 3

how to make for example for vips 5 houses
and admins 8?

Код:
#define MAX_HOUSES_OWNED    		3 // Max houses owned per player
Reply
#2

pawn Код:
#define MAX_HOUSES_OWNED_VIP 5
#define MAX_HOUSES_OWNED_ADMIN 8
Reply
#3

Nothing Happened, still only i can own 3 while i was vip or admin
Reply
#4

Well you need to configure the buy house code. Show us the code in which the player purchases the house.
Reply
#5

That is all things that have MAX_HOUSE_OWNED :

Quote:

#define E_MAX_HOUSES_OWNED "{F6F6F6}You already own {00BC00}%d {F6F6F6}house%s. Sell one of your others before buying a new."

I think you want this :

Код:
//------------------------------------------------------------------------------
//                               House Buying
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+4)
	{
		if(response)
		{
		    new hname[MAX_PLAYER_NAME+9];
			if(GetOwnedHouses(playerid) >= MAX_HOUSES_OWNED) { ShowInfoBox(playerid, E_MAX_HOUSES_OWNED, MAX_HOUSES_OWNED, AddS(MAX_HOUSES_OWNED)); return 1; }
			if(strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE) && strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_H_ALREADY_OWNED);
			if(hInfo[h][HouseValue] > GetPlayerMoney(playerid)) { ShowInfoBox(playerid, E_CANT_AFFORD_HOUSE, hInfo[h][HouseValue], GetPlayerMoney(playerid), (hInfo[h][HouseValue] - GetPlayerMoney(playerid))); return 1; }
			else
			{
			    format(hname, sizeof(hname), "%s's House", pNick(playerid));
			    format(hInfo[h][HouseName], sizeof(hname), "%s", hname);
			    format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", pNick(playerid));
			    hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
			    hInfo[h][HouseStorage] = 0;
				GivePlayerMoney(playerid, -hInfo[h][HouseValue]);
				file = INI_Open(filename);
				INI_WriteString(file, "HouseOwner", pNick(playerid));
				INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
				INI_WriteString(file, "HouseName", hname);
				INI_WriteInt(file, "HouseStorage", 0);
				INI_Close(file);
				ShowInfoBox(playerid, I_BUY_HOUSE, hInfo[h][HouseValue]);
				foreach(Houses, h2)
				{
					if(IsHouseInRangeOfHouse(h, h2, RANGE_BETWEEN_HOUSES) && h2 != h)
					{
					    file = INI_Open(HouseFile(h2));
						INI_WriteInt(file, "HouseValue", (hInfo[h2][HouseValue] + ReturnProcent(hInfo[h2][HouseValue], HOUSE_SELLING_PROCENT2)));
                        UpdateHouseText(h2);
                        INI_Close(file);
					}
				}
				#if GH_USE_MAPICONS == true
					DestroyDynamicMapIcon(HouseMIcon[h]);
					HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 32, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
				#endif
				UpdateHouseText(h);
			}
		}
		return 1;
	}
Код:
//==============================================================================
// ReturnPlayerHouseID(playerid, houseslot);
// This function is used to return the house id from a players house 'slot'
// Example: ReturnPlayerHouseID(playerid, 0);
// Would return for example house ID 500.
//==============================================================================
stock ReturnPlayerHouseID(playerid, houseslot)
{
	new tmpcount;
	if(houseslot < 1 && houseslot > MAX_HOUSES_OWNED) return -1;
	foreach(Houses, h)
	{
	    if(!strcmp(pNick(playerid), hInfo[h][HouseOwner], CASE_SENSETIVE))
	    {
     		tmpcount++;
       		if(tmpcount == houseslot)
       		{
        		return h;
  			}
	    }
	}
	return -1;
}
Reply
#6

pawn Код:
if(GetPVarInt(playerid, "VIP") > 0 && GetOwnedHouses(playerid) >= MAX_HOUSES_OWNED_VIP) { //error here return 1; }
if(GetPVarInt(playerid, "Admin") > 0 && GetOwnedHouses(playerid) >= MAX_HOUSES_OWNED_ADMIN) { // error here return 1; }
else if(GetOwnedHouses(playerid) >= MAX_HOUSES_OWNED && GetPVarInt(playerid, "VIP") == 0 && GetPVarInt(playerid, "Admin") == 0)
You'd need to set the pvars inside your gamemode.
Reply
#7

Where to put those things in the filterscripts?
and what i put in the gamemode? :/
Reply


Forum Jump:


Users browsing this thread: