A little assistance please.
#1

Alright, the problem is: When I /sellhouse, it works correctly, but if that person sells it back to me, it doesnt set the name but only the ID into the player variable.

pawn Код:
CMD:sellhouse(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new string[128],price, giveplayerid, invite[128];
    if(sscanf(params, "ud", giveplayerid, price)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /sellhouse [playerid] [price]");
    if(!IsPlayerNearPlayer(playerid, giveplayerid, 5.0))return SendClientMessage(playerid, COLOUR_GREY, "You must be close to the player to sell your house.");
    if(HouseOwned[giveplayerid] >= 1) return SendClientMessage(playerid, COLOUR_GREY, "That person already own's a house.");
    if(HouseOwned[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You don't have a house to sell.");
   
    HPrice[giveplayerid] = price;
    HouseOffered[giveplayerid] = 1;
    HouseIDOffered[giveplayerid] = MySQL_GetValue(PlayerSQLID[playerid], "HouseOwned", "accounts");
   
    format(invite, sizeof(invite), "%s is offering to sell you %s for $%d, type /accept house to buy.", GetNameEx(playerid), HouseName[HouseOwned[playerid]], price);
    SendClientMessage(giveplayerid, COLOUR_WHITE, invite);
   
    format(string, sizeof(string), "You are offering to sell %s to %s for $%d", HouseName[HouseOwned[playerid]], GetNameEx(giveplayerid), HPrice[giveplayerid]);
    SendClientMessage(playerid, COLOUR_ORANGE, string);
   
    HouseOwned[playerid] = 0;
    if(HouseAccepted[giveplayerid] == 1)
    {
        new accepted[128];
        format(accepted, sizeof(accepted), "%s Has Purchased your house!", GetNameEx(giveplayerid));
        SendClientMessage(playerid, COLOUR_WHITE, accepted);
    }
    return 1;
}
To accept the house being purchased:
pawn Код:
CMD:accept(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new string[64];
    if(sscanf(params, "s[64]", string)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /accept [function] Available functions: invite house");
if(strcmp(params, "house", true) == 0)
    {
        if(HouseOffered[playerid] == 1)
        {
            new query[256];
            format(query, sizeof(query), "UPDATE `houses` SET `HouseOwner` = '%s' WHERE `id` = %d", GetName(playerid), HouseIDOffered[playerid]);
            mysql_query(query);
            HouseOffered[playerid] = 0;
            HouseOwned[playerid] = HouseIDOffered[playerid];
            HouseOwner[HouseIDOffered[playerid]] = GetName(playerid);
            HouseAccepted[playerid] = 1;
        }
           
        format(string, sizeof(string), "You have purchased %s for $%d, Congratulations!", HouseName[HouseOwned[playerid]], HPrice[playerid]);
        SendClientMessage(playerid, COLOUR_WHITE, string);
       
   
    }
    return 1;
}
Reply
#2

Bump.
Reply
#3

I think you missed something else. I think is something wrong on your SQL when you sell the house for the first time.
Reply
#4

It works the first time, then the second time it fails.
Reply
#5

Any other help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)