SA-MP Forums Archive
how to limit buy houses in SasinosoftHouse FS - 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: how to limit buy houses in SasinosoftHouse FS (/showthread.php?tid=434483)



how to limit buy houses in SasinosoftHouse FS - dash5487 - 02.05.2013

hello

how to limit buy houses in SasinosoftHouse FS

like player only can buy only 2 houses and not more

https://sampforum.blast.hk/showthread.php?tid=405201


Re: how to limit buy houses in SasinosoftHouse FS - iGetty - 03.05.2013

Try this:

pawn Код:
#define MAX_PER_PLAYER 2

new HousesPurchased[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    HousesPurchashed[playerid] = 0;
    return 1;
}

//in the /buy command add
if(HousesPurchased[playerid] < MAX_PER_PLAYER)
{

}
else return SendClientMessage(playerid, -1, "You can only have 2 houses in total.");

//in the onplayerconnect, do a search through all houses to see if they match the owner name, then call:

HousesPurchased[playerid]++;

//If it >= 2, then set it to 2. You should be done then.