it takes the ID as the price!?
#1

So, this is my code..
pawn Код:
if(strcmp(cmd, "/sellhouseto", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, playername, sizeof(playername));
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD1, "USAGE: /sellhouseto [playerid/PartOfName] [price]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(giveplayerid != INVALID_PLAYER_ID)
            {
                if(!strlen(tmp))
                {
                    SCM(playerid, COLOR_GRAD1, "USAGE: /sellhouseto [playerid/PartOfName] [price]");
                    return 1;
                }
                new price,house;
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                house = PlayerInfo[playerid][pHouseKey];
                price = strval(tmp);
                if(price < 1 || price > 2000000) return SCM(playerid, COLOR_GRAD1, "Price can't be lower than 1 or higher than 2000000!");
                if(PlayerInfo[playerid][pHouseKey] == 9999)
                {
                    SCM(playerid, COLOR_WHITE, "You don't own a house.");
                    return 1;
                }
                if(PlayerInfo[playerid][pHouseKey] != 9999 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pHouseKey]][hOwner], true) == 0)
                {
                    format(string, sizeof(string),"%s Has offered you to buy his house for %i $.",playername, price);
                    SCM(giveplayerid, COLOR_RLRPGBLUE, string);
                    SCM(giveplayerid, COLOR_LIGHTGREEN,"To accept the offer, type /accept house");
                    format(string, sizeof(string),"You offered %s to buy your house for %i $.",giveplayer);
                    SCM(playerid, COLOR_RLRPGBLUE, string);
                    OfferHouse[giveplayerid] = playerid;
                    HouseInfo[house][hValue] = price;
                    OfferHouseKey[giveplayerid] = house;
                }
            }
            else
            {
                SCM(playerid, COLOR_GREY,"Player is not online");
                return 1;
            }
        }
        return 1;
    }
When someone do this cmd and offer the house to for example id 1, then the price will be 1 even if you offer the house for example 50000!? If you take id 2 the price will be 2 no matter what you type as the price it takes the ID of the player you're offering it to.. Why?
Reply


Messages In This Thread
it takes the ID as the price!? - by Don_Cage - 15.07.2014, 20:22
Re: it takes the ID as the price!? - by kamiliuxliuxliux - 15.07.2014, 22:00
Re: it takes the ID as the price!? - by Don_Cage - 15.07.2014, 22:05
Re: it takes the ID as the price!? - by BlackSirrah239 - 16.07.2014, 01:16
Re: it takes the ID as the price!? - by admiralspeedy - 16.07.2014, 05:22
Re: it takes the ID as the price!? - by R0 - 16.07.2014, 12:29
Re: it takes the ID as the price!? - by Don_Cage - 16.07.2014, 21:45

Forum Jump:


Users browsing this thread: 3 Guest(s)