How to make a /sellhouse command ?
#1

I have been trying to make a sell house command but i dont think it is writing the new owner to the file

If you need more code just tell me



Please Help Me Please



pawn Код:
command(sellhouse, playerid, params[])
{
    new id, Nam2[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME], price, string[128], string2[128];
    if(sscanf(params, "ui", id, price)) return SendClientMessage(playerid, GREEN, "/sellhouse [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[])
{
    #pragma unused params
    new NewHouseID = SpawnedHouses+1;
    new FileName[23], id, pname[MAX_PLAYER_NAME];
    if(Player[playerid][OfferedHouse] == 1)
    {
        GetPlayerName(id, pname, MAX_PLAYER_NAME);
        format(FileName, sizeof(FileName), "Houses/House_%d.ini" , NewHouseID);
        if(fexist(FileName))
        {
            dini_Set(FileName, "Owner", pname);
        }
    }
    return 1;
}

Thank You


Please Help Me Please
Reply
#2

Thank You


Please Help Me Please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)