House - Buy
#1

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?
Reply
#2

3 day bump, anyone?
Reply
#3

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 :/
Reply
#4

Sorry for double-post, i think you could try it:
PHP код:
if(strcmp(hInfo[h][hOwner], "None"true) == 0
Reply
#5

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)
Reply
#6

Have you verified your gHouse value ?
Reply
#7

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.
Reply
#8

You have to send error message out of your loop
PHP код:
 for(new 0<= gHouseh++) 
Reply
#9

Really? why...

Anyways, still havent fixed it.
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)