Jump to content

Comanda script ( /sellhouseto )


adiqua

Recommended Posts

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;
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.