House - Buy - Riddy - 22.09.2012
pawn Код:
if(strcmp(string,"buy",true) == 0) // House kaufen
{
if(house > 0) return ShowInfoDialog(playerid, "House - Info", "You already own a house");
for(new h = 0; h <= gHouse; h++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[h][hEntrancex], hInfo[h][hEntrancey], hInfo[h][hEntrancez]))
{
if(!strcmp(hInfo[h][hOwner], "None", true))
{
if(GetUserMoney(playerid) >= hInfo[h][hValue])
{
new
sendername[MAX_PLAYER_NAME];
print("Blad - Proccesed");
GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
print("Blad - Proccesed");
strmid(hInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
print("Blad - Proccesed");
GiveUserMoney(playerid,-hInfo[h][hValue]);
print("Blad - Proccesed");
SetUserHouse(playerid);
print("Blad - Proccesed");
ShowInfoDialog(playerid, "House - Info", "You successfully bought the house, use /house to manage it.");
SaveHouse(h);
print("Blad - Proccesed");
SaveAccount(playerid);
print("Blad - Proccesed");
CheckUserAchievement(playerid, ACHIEVEMENT_HOUSE, true);
print("Blad - Proccesed");
}
else ShowInfoDialog(playerid, "House - Info", "You can't afford it");
}
else ShowInfoDialog(playerid, "House - Info", "Someone already owns this house");
}
else ShowInfoDialog(playerid, "Error!", "You arent even near a house");
print("Server distance housing properly");
}
print("Server checked housing properly");
return 1;
}
I've tried all of this, and it seems like, it only reached checking distance properly, but it seems to spam the console, can there be anything wrong this this?
Re: House - Buy - Riddy - 25.09.2012
3 day bump, anyone?
Re : House - Buy -
Varkoll_ - 25.09.2012
Primary, why you don't use parameter for your "house" variable
PHP код:
if(house > 0) return ShowInfoDialog(playerid, "House - Info", "You already own a house");
Have you before assigned a value to the house ?
Have you tried to see if this condition was validated?
PHP код:
if(!strcmp(hInfo[h][hOwner], "None", true))
Sorry for my bad english :/
Re : House - Buy -
Varkoll_ - 25.09.2012
Sorry for double-post, i think you could try it:
PHP код:
if(strcmp(hInfo[h][hOwner], "None", true) == 0)
Re: Re : House - Buy - Riddy - 25.09.2012
Quote:
Originally Posted by leo3412
Sorry for double-post, i think you could try it:
PHP код:
if(strcmp(hInfo[h][hOwner], "None", true) == 0)
|
Npo, if(house > 1) works, but its after that, it stops working (the for(thingy). work perfectly)
Re : House - Buy -
Varkoll_ - 25.09.2012
Have you verified your gHouse value ?
Re: Re : House - Buy - Riddy - 26.09.2012
Quote:
Originally Posted by leo3412
Have you verified your gHouse value ?
|
gHouse is verifed, all of it is, funny thing is, the others ones actually do work and they have the exact same things, it seems like theres something wrong with the inner script itself, as the other parts which are the same work, I mean /ram actually does work when a player is near a house entrance, but when buying a house it says, your not.
Re : House - Buy -
Varkoll_ - 26.09.2012
You have to send error message out of your loop
PHP код:
for(new h = 0; h <= gHouse; h++)
Re: House - Buy - Riddy - 08.10.2012
Really? why...
Anyways, still havent fixed it.
Re : House - Buy -
lelemaster - 08.10.2012
It spams the console because a loop tries for everything, means house 1,2,3,4,5,6... So it will say everytimes "Sever checked housing properly". The only point where it will stop spamming if after checking if the player is in range of point. So you should remove the print before it.
Off Topic: Are you Garry Beneth from C-RP?