new housenumber;
command(sellhouse, playerid, params[])
{
new id, Nam2[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME], price, string[128], string2[128];
if(sscanf(params, "ddd", housenumber, id, price)) return SendClientMessage(playerid, GREEN, "/sellhouse [YourHouseID] [ID] [Price]");
if(Player[playerid][InHouse] == 0)
return SendClientMessage(playerid, RED, "You must be in your house to sell it");
GetPlayerName(playerid,Nam2,MAX_PLAYER_NAME);//define the playerid name
GetPlayerName(id,pname,MAX_PLAYER_NAME);//define the other person name
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player is not on line");
format(string,sizeof(string), "You have offered to sell your house to %s for %d", pname, price);
format(string2,sizeof(string2), "You have been offered to buy %s's house for %d, Type /acceptbuyhouse to buy it", Nam2, price);
SendClientMessage(playerid, GREEN, string);
SendClientMessage(id, GREEN, string2);
Player[playerid][OfferedHouse] = 1;
return 1;
}
command(acceptbuyhouse, playerid, params[])
{
new id, Nam2[MAX_PLAYER_NAME],string[48], pname[MAX_PLAYER_NAME];
if(Player[playerid][OfferedHouse] == 1)
{
GetPlayerName(playerid,Nam2,MAX_PLAYER_NAME);//define the playerid name
GetPlayerName(id,pname,MAX_PLAYER_NAME);//define the other person name
format(string, sizeof(string), "Houses/House_%d.ini", housenumber);
if(fexist(string))
{
format(string, sizeof(string), "Accounts/%s.ini", Nam2);
if(fexist(string))
{
dini_IntSet(string, "House", 0);
}
format(string, sizeof(string), "Accounts/%s.ini", pname);
if(fexist(string))
{
dini_IntSet(string, "House", housenumber);
}
format(Houses[housenumber][hOwner], 255, "%s", pname);
format(string, sizeof(string), "%s Has sold his house to %s", pname, Nam2);
SendClientMessageToAll(WHITE, string);
SaveHouse(housenumber);
}
}
return 1;
}
Player[id][OfferedHouse] = 1;
In /sellhouse it should be 'id' not 'playerid'
pawn Код:
|