/acceptbuyhouse Is Not Working Please Help Me
#1

Pretty much when if i sell the house to myself and then i type /acceptbuyhouse, It sends me a message saying i bought my own house and i think it edits the scriptfiles but when i try to sell it to other people it dont send the message and it dont edit it in the script files


If you need any more code just ask


global variable

pawn Код:
new housenumber;
pawn Код:
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;
}
pawn Код:
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;
}

Thank You


Please Help Me Please
Reply
#2

In /sellhouse it should be 'id' not 'playerid'

pawn Код:
Player[id][OfferedHouse] = 1;
Reply
#3

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
In /sellhouse it should be 'id' not 'playerid'

pawn Код:
Player[id][OfferedHouse] = 1;
But house comes when i do /sellhouse [MyHouseID] [MYID] [Price] and i do /acceptbuyhouse it works and sends the message


Thank You


Please Help Me Please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)