wwhats wrong?
#1

its says im not close enought to a house when i am right on top of it
pawn Код:
if (strcmp("/buy", cmdtext) == 0)
    {
        for(new i = 0; i<MAX_HOUSES; i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 6.0, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ]))
            {
                new Pname[24]; GetPlayerName(playerid, Pname, 24);
                if(strlen(dini_Get("Owned.ini", Pname)))
                if(GetPlayerMoney(playerid) < HouseInfo[i][HouseCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house");
                if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!");
                GivePlayerMoney(playerid, - HouseInfo[i][HouseCost]);
                GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3);
                HouseInfo[i][Owned] = 1;
                GetPlayerName(playerid, Pname, 24);
                format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
                dini_Set("Owners.ini", Pname, HouseInfo[i][HouseNames]);
                return 1;
            }
            SendClientMessage(playerid, 0xF60000AA, "You are not near enough to a house");
            return 1;
        }
        return 1;
    }
Reply
#2

pawn Код:
IsPlayerInRangeOfPoint(playerid, 6.0, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])
Try printing
pawn Код:
HouseInfo[i][PickupX]
,
pawn Код:
HouseInfo[i][PickupY]
and
pawn Код:
HouseInfo[i][PickupZ]
- see what comes up.

pawn Код:
printf("x: %i", HouseInfo[i][PickupX]);
printf("y: %i", HouseInfo[i][PickupY]);
printf("z: %i", HouseInfo[i][PickupZ]);
Reply
#3

Quote:
Originally Posted by funky1234
Посмотреть сообщение
pawn Код:
IsPlayerInRangeOfPoint(playerid, 6.0, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])
Try printing
pawn Код:
HouseInfo[i][PickupX]
,
pawn Код:
HouseInfo[i][PickupY]
and
pawn Код:
HouseInfo[i][PickupZ]
- see what comes up.

pawn Код:
printf("x: %i", HouseInfo[i][PickupX]);
printf("y: %i", HouseInfo[i][PickupY]);
printf("z: %i", HouseInfo[i][PickupZ]);
nothin appears not even in console
Reply
#4

Try it outside of the if statement.
Reply
#5

try it:
pawn Код:
if (strcmp("/buy", cmdtext) == 0)
    {
        for(new i = 0; i<MAX_HOUSES; i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 6.0, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ]))
            {
                new Pname[24]; GetPlayerName(playerid, Pname, 24);
                if(strlen(dini_Get("Owned.ini", Pname)))
                if(GetPlayerMoney(playerid) < HouseInfo[i][HouseCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house");
                if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!");
                GivePlayerMoney(playerid, - HouseInfo[i][HouseCost]);
                GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3);
                HouseInfo[i][Owned] = 1;
                GetPlayerName(playerid, Pname, 24);
                format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
                dini_Set("Owners.ini", Pname, HouseInfo[i][HouseNames]);
                return 1;
            }
        }
        SendClientMessage(playerid, 0xF60000AA, "You are not near enough to a house");
        return 1;
    }
Reply
#6

Quote:
Originally Posted by webninjasi
Посмотреть сообщение
try it:
pawn Код:
if (strcmp("/buy", cmdtext) == 0)
    {
        for(new i = 0; i<MAX_HOUSES; i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 6.0, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ]))
            {
                new Pname[24]; GetPlayerName(playerid, Pname, 24);
                if(strlen(dini_Get("Owned.ini", Pname)))
                if(GetPlayerMoney(playerid) < HouseInfo[i][HouseCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house");
                if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!");
                GivePlayerMoney(playerid, - HouseInfo[i][HouseCost]);
                GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3);
                HouseInfo[i][Owned] = 1;
                GetPlayerName(playerid, Pname, 24);
                format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
                dini_Set("Owners.ini", Pname, HouseInfo[i][HouseNames]);
                return 1;
            }
        }
        SendClientMessage(playerid, 0xF60000AA, "You are not near enough to a house");
        return 1;
    }
thanks bro worked perrrrfect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)