Problem with using dynamic "/buyhouse" -
Jochemd - 30.12.2010
Hello,
pawn Код:
dcmd_buyhouse(playerid,params[])
{
#pragma unused params
for(new h = 0; h < MAX_HOUSES; h ++)
{
format(file,sizeof(file),"Stuff/Houses/%d.ini",h);
if(dini_Exists(file))
{
if(IsPlayerInRangeOfPoint(playerid,5,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ]))
{
if(!strlen(HouseInfo[h][Owner]))
{
if(GetPlayerMoney(playerid) >= HouseInfo[h][Price])
{
new string[70];
format(string,sizeof(string),"Do you want to buy this house for $%d?",HouseInfo[h][Price]);
ShowPlayerDialog(playerid,DIALOG_BUYHOUSE,DIALOG_STYLE_MSGBOX,"Buy a House",string,"Yes","No");
SetPVarInt(playerid,"BuyingHouse",h);
}
else return SendClientMessage(playerid,COLOR_WHITE,"You do not have enough money to purchase this house.");
}
else return SendClientMessage(playerid,COLOR_WHITE," This house has already been bought.");
}
else return SendClientMessage(playerid,COLOR_WHITE," You are not near any unbought house pickup.");
}
}
return 1;
}
This works fine for house ID 0 (so file is called 0). But for the others, it just gives the message 'You are not near any unbought house pickup'. Why? Everything in the enum is just fine.
Regards, Jochem
Note: MAX_HOUSES = 200.
Re: Problem with using dynamic "/buyhouse" -
_rAped - 30.12.2010
Quote:
Originally Posted by Jochemd
Hello,
pawn Код:
dcmd_buyhouse(playerid,params[]) { #pragma unused params for(new h = 0; h < MAX_HOUSES; h ++) { format(file,sizeof(file),"Stuff/Houses/%d.ini",h); if(dini_Exists(file)) { if(IsPlayerInRangeOfPoint(playerid,5,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ])) { if(!strlen(HouseInfo[h][Owner])) { if(GetPlayerMoney(playerid) >= HouseInfo[h][Price]) { new string[70]; format(string,sizeof(string),"Do you want to buy this house for $%d?",HouseInfo[h][Price]); ShowPlayerDialog(playerid,DIALOG_BUYHOUSE,DIALOG_STYLE_MSGBOX,"Buy a House",string,"Yes","No"); SetPVarInt(playerid,"BuyingHouse",h); } else return SendClientMessage(playerid,COLOR_WHITE,"You do not have enough money to purchase this house."); } else return SendClientMessage(playerid,COLOR_WHITE," This house has already been bought."); } else return SendClientMessage(playerid,COLOR_WHITE," You are not near any unbought house pickup."); } } return 1; }
This works fine for house ID 0 (so file is called 0). But for the others, it just gives the message 'You are not near any unbought house pickup'. Why? Everything in the enum is just fine.
Regards, Jochem
Note: MAX_HOUSES = 200.
|
for(new h = 0; h < MAX_HOUSES; h ++)
Sure that MAX_HOUSES hasn't been set to 1 or smth?
-- Nvm just saw that note --
Re: Problem with using dynamic "/buyhouse" -
Jochemd - 30.12.2010
No, it is 200.
Re: Problem with using dynamic "/buyhouse" -
MadeMan - 30.12.2010
pawn Код:
dcmd_buyhouse(playerid,params[])
{
#pragma unused params
for(new h = 0; h < MAX_HOUSES; h ++)
{
format(file,sizeof(file),"Stuff/Houses/%d.ini",h);
if(dini_Exists(file))
{
if(IsPlayerInRangeOfPoint(playerid,5,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ]))
{
if(!strlen(HouseInfo[h][Owner]))
{
if(GetPlayerMoney(playerid) >= HouseInfo[h][Price])
{
new string[70];
format(string,sizeof(string),"Do you want to buy this house for $%d?",HouseInfo[h][Price]);
ShowPlayerDialog(playerid,DIALOG_BUYHOUSE,DIALOG_STYLE_MSGBOX,"Buy a House",string,"Yes","No");
SetPVarInt(playerid,"BuyingHouse",h);
return 1;
}
else return SendClientMessage(playerid,COLOR_WHITE,"You do not have enough money to purchase this house.");
}
else return SendClientMessage(playerid,COLOR_WHITE," This house has already been bought.");
}
}
}
SendClientMessage(playerid,COLOR_WHITE," You are not near any unbought house pickup.");
return 1;
}
Re: Problem with using dynamic "/buyhouse" -
Jochemd - 30.12.2010
the return 1; did not work.
Re: Problem with using dynamic "/buyhouse" -
Surmav - 30.12.2010
I got this problem once I tried making dyna mic cars, dunno how to fix it but probably others will
Re: Problem with using dynamic "/buyhouse" -
Ash. - 30.12.2010
Quote:
Originally Posted by Surmav
I got this problem once I tried making dyna mic cars, dunno how to fix it but probably others will
|
Helpful?
And just as a matter of thought, try changing:
pawn Код:
for(new h = 0; h < MAX_HOUSES; h ++)
to
pawn Код:
for(new h; h < MAX_HOUSES; h++)
Re: Problem with using dynamic "/buyhouse" -
Jochemd - 30.12.2010
Yeah, that worked, how? When you do:
It's 0 by default?