Jump to content

Recommended Posts

Posted

Poftim: 

CMD:sellhouseto(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
    {
		new id22 = PlayerInfo[playerid][pPhousekey];
		if(!IsPlayerInRangeOfPoint(playerid, 4,HouseInfo[id22][hEntrancex],HouseInfo[id22][hEntrancey],HouseInfo[id22][hEntrancez])) return SCM(playerid,COLOR_WHITE,"{FFF8C6}You are not near your house.");
		new money,giveplayerid,sendername[25],giveplayer[25],string[150],playername[25],other[128];
		GetPlayerName(playerid, playername, sizeof(playername));
		if(PlayerInfo[playerid][pPhousekey] != 999 && strcmp(PlayerInfo[playerid][pNormalName], HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
		{
			if(sscanf(params, "uiS(NULL)",giveplayerid,money,other)) return SendClientMessage(playerid, COLOR_WHITE, "{A9A9A9}Syntax: {FFFFFF}/sellhouseto <Name/Playerid> <Price>");
			if(strcmp(other, "NULL", true)) return SCM(playerid,COLOR_WHITE,"Nu folosi spatii in pret.");
			if(money < 1 || money > 1000000000) return SendClientMessage(playerid, COLOR_GREY, "{FFB870}Price not lower then 1 and not higher then $1,000,000,000.");
			if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        if(PlayerInfo[giveplayerid][pPhousekey] != 999) return SendClientMessage(playerid, COLOR_WHITE, "{FFF8C6}This player already own a house or have rent house.");
					if(PlayerInfo[giveplayerid][pLevel] < HouseInfo[PlayerInfo[playerid][pPhousekey]][hLevel]) return SCM(playerid,COLOR_WHITE,"{FFF8C6}This player don't have needed level.");
			        if(ProxDetectorS(8.0, playerid, giveplayerid))
					{
					    if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_WHITE, "{FFF8C6}You can't sell House to yourself.");
						if(GetPlayerCash(giveplayerid) < money) return SCM(playerid,COLOR_WHITE,"{FFB870}This player don't have money needed.");
					    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
					    format(string, sizeof(string), "{B8FFDB}* You offered to sell your House to %s for $%s.", giveplayer, FormatNumber(money));
						SendClientMessage(playerid, COLOR_WHITE, string);
						format(string, sizeof(string), "{B8FFDB}* %s wants to sell his House to you for $%s, (type /accept house %d) to accept.", sendername, FormatNumber(money),playerid);
						SendClientMessage(giveplayerid, COLOR_WHITE, string);
						HouseID[giveplayerid] = PlayerInfo[playerid][pPhousekey];
						HouseOffer[giveplayerid] = playerid;
						HousePrice[giveplayerid] = money;
					}
					else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}This player is not near you..");
				}
			}
			else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
		}
		else return SendClientMessage(playerid, COLOR_WHITE, "{FFF8C6}You don't own a House.");
	}
	return 1;
}

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.