Houses and Bizness problems.
#1

Hello guys.

I've some problems with my GM : Players can have an unlimited numbers of houses and bizness. How can I fix it ? I mean, only 1 house and 1 biz per player ?

I've set a pOHouse and this with the subcommand "acheter" (/maison acheter = /house buy):
Код:
if(PlayerInfo[playerid][pOHouse] == 0);
Thank you in advance.
Reply
#2

Little up. Thanks in advance.
Reply
#3

i replied to the old one already i told u its

pawn Код:
if(PlayerInfo[playerid][pOHouse] == 0);
Reply
#4

Yeah, little mistake I made when I create this topic, I already put the PlayerInfo instead of playerinfo.
No more errors or warnings, but still. Everyone can have the numbers of houses they want. I edit the thread.
Reply
#5

because that code is to check to see if player has the key, use need to check the /buyhouse cmd post for me to see
Reply
#6

There you go :
/maison is the main command for me (it mean /house) and /maison acheter -> acheter is the subcommand. (/maison buy)



/maison command :

pawn Код:
if(strcmp(cmd, "/maison", true) == 0 || strcmp(cmd, "/ma", true) == 0)  // Commandes pour les maisons
    {
        new Float:cx, Float:cy, Float:cz;
        subcmd = strtok(cmdtext, idx);
        if( !strlen(subcmd) )
        {
            SendClientMessage(playerid, COLOR_USAGE, "{FF6600}[Action]{99EEFF} (/ma)ison <action>");
            SendClientMessage(playerid, COLOR_USAGE, "{FF6600}[Action]{99EEFF} Actions valides : acheter, vendre, louer, delouer, fraper");
            SendClientMessage(playerid, COLOR_USAGE, "{FF6600}[Action]{99EEFF} Actions valides : Faites /entrer pour visiter.");
            SendClientMessage(playerid, COLOR_USAGE, "{FF6600}[Action]{99EEFF} Actions valides : general");
            if(pack_isAnAdmin(playerid))
                {SendClientMessage(playerid, COLOR_ADMIN, "[Action] Admin: creer, edit");}
            return 1;
        }
        if(strcmp(subcmd, "creer", true) == 0)
        {
            if(!pack_isAdmin(playerid, 4))
                {SendClientMessage(playerid, COLOR_SERVER, noAcces); return 1;}
            // Position du joueur
            new Float:x,Float:y,Float:z;
            GetPlayerPos(playerid,x,y,z);
            // Id
            format(sql, sizeof(sql), "SELECT COUNT(*) FROM srp_players_houses");
            MySQLCheckConnection();
            mysql_query(sql);
            //SQLLog(query);
            mysql_store_result();
            mysql_fetch_row(result);
            new newHouseId = strval(result) + 1;
            mysql_free_result();
            if (newHouseId>=MAX_HOUSE)
                {SendClientMessage(playerid, COLOR_ADMIN, "[Admin] Maximum de maison atteint."); return 1;}

            new intStr[64], prixStr[64];
            intStr = strtok(cmdtext, idx);
            prixStr = strtok(cmdtext, idx);
            if(!strlen(intStr) || !strlen(prixStr))
                {SendClientMessage(playerid, COLOR_USAGE, "{FF6600}[Action]{99EEFF} /ma creer [Interieur(1-42] [Prix]"); return 1;}
            new idint, prix;
            idint = strval(intStr);
            prix = strval(prixStr);
            if(idint < 1 || idint > 42)
                {SendClientMessage(playerid, COLOR_USAGE, "[Interieur] Compris entre 1 et 42"); return 1;}
            if(prix < 1 || prix > 10000000)
                {SendClientMessage(playerid, COLOR_USAGE, "[Prix] Compris entre 1 et 10 000 000$"); return 1;}

            new Float:x1, Float:y1, Float:z1;
            house_getExitPos(idint, x1, y1, z1);
            new interieur = house_getInterior(idint);
            new description[LITTLE_STRING];
            house_getDes(idint, description);

            //DB
            format(sql, sizeof(sql), "INSERT INTO srp_players_houses SET id=%d, ent_x=%f, ent_y=%f, ent_z=%f, ext_x=%f, ext_y=%f, ext_z=%f, price=%d, interior=%d, description='%s'", newHouseId, x, y, z,x1,y1,z1,prix,interieur,description);
            MySQLCheckConnection();
            mysql_query(sql);

            // IG
            HouseInfo[newHouseId-1][hEntrancex] = x;
            HouseInfo[newHouseId-1][hEntrancey] = y;
            HouseInfo[newHouseId-1][hEntrancez] = z;
            HouseInfo[newHouseId-1][hExitx] = x1;
            HouseInfo[newHouseId-1][hExity] = y1;
            HouseInfo[newHouseId-1][hExitz] = z1;
            memcpy(HouseInfo[newHouseId-1][hOwner],NOMDEFAULT, 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
            memcpy(HouseInfo[newHouseId-1][hDiscription],description, 0, 32*4, 32*4);
            HouseInfo[newHouseId-1][hValue] = prix;
            HouseInfo[newHouseId-1][hInt] = interieur;
            HouseInfo[newHouseId-1][hLock] = 0;
            HouseInfo[newHouseId-1][hOwned] = 0;
            HouseInfo[newHouseId-1][hRent] = 0;
            HouseInfo[newHouseId-1][hRentabil] = 0;
            HouseInfo[newHouseId-1][hTakings] = 0;
            HouseInfo[newHouseId-1][hAssurance] = 0;
            HouseInfo[newHouseId-1][hLevel] = 0;
            HouseInfo[newHouseId-1][hType] = 1;
            HouseInfo[newHouseId-1][hFrigo] = 0;
            HouseInfo[newHouseId-1][hArmes] = 0;
            HouseInfo[newHouseId-1][hArme1] = 0;
            HouseInfo[newHouseId-1][hAmmo1] = 0;
            HouseInfo[newHouseId-1][hArme2] = 0;
            HouseInfo[newHouseId-1][hAmmo2] = 0;
            HouseInfo[newHouseId-1][hArme3] = 0;
            HouseInfo[newHouseId-1][hAmmo3] = 0;
            HouseInfo[newHouseId-1][hArme4] = 0;
            HouseInfo[newHouseId-1][hAmmo4] = 0;
            HouseInfo[newHouseId-1][hArme5] = 0;
            HouseInfo[newHouseId-1][hAmmo5] = 0;
            HouseInfo[newHouseId-1][hCache] = 0;
            HouseInfo[newHouseId-1][hWeed] = 0;
            HouseInfo[newHouseId-1][hHero] = 0;
            HouseInfo[newHouseId-1][hCafetiere] = 0;
            HouseInfo[newHouseId-1][hAlarme] = 0;
            HouseInfo[newHouseId-1][hLoc] = 0;
            HouseInfo[newHouseId-1][hLocMax] = 0;
            HouseInfo[newHouseId-1][hPropre] = 0;
            HouseInfo[newHouseId-1][hTrashes] = 0;
            HouseInfo[newHouseId-1][hTPropre] = 0;
            HouseInfo[newHouseId-1][hCambriolee] = 0;
            HouseInfo[newHouseId-1][hTCambriolee] = 0;
            HouseInfo[newHouseId-1][hEdited] = 0;

            totalhouses++;
            HousePickup[newHouseId-1]=CreateDynamicPickup(1272, 1,x,y,z,0,0,-1,PICKUP_STREAM_DISTANCE); // Ajout du pickup
            format(string, sizeof(string), "[Admin] Maison ID %d crйe.", newHouseId-1);
            SendClientMessage(playerid, COLOR_ADMIN, string);
            return 1;

        }






"acheter"
pawn Код:
if(strcmp(subcmd, "acheter", true) == 0) // Acheter une maison
        if(PlayerInfo[playerid][pOHouse] == 0)
        {
            new Float:oldposx, Float:oldposy, Float:oldposz;
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerPos(playerid, oldposx, oldposy, oldposz);
            print("Lancement Boucle 108");
            for(new h = 0; h < totalhouses; h++)
            {
                if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 0)
                {
                    if(HouseInfo[h][hOwned] == 1)
                        { SendClientMessage(playerid, COLOR_MAISON, "[Info] Cette maison n'est pas а vendre."); return 1; }

                    pay_tempPrice[playerid] = HouseInfo[h][hValue];
                    pay_tempArticle[playerid] = h;
                    pay_tempType[playerid] = 3;
                    pay_showDialog(playerid, HouseInfo[h][hValue]);
                    break;
                }
            }
            print("Fin Boucle 108");
            return 1;
        }
Reply
#7

pawn Код:
replace
pay_tempArticle[playerid] = h;
with
PlayerInfo[playerid][pOHouse] = h;

//i dont know whats this btw
// i say its ur variables so w/e
pay_tempPrice[playerid] = HouseInfo[h][hValue];
               
                    pay_tempType[playerid] = 3;
                    pay_showDialog(playerid, HouseInfo[h][hValue]);
Reply
#8

I understood what you said in the first place, I replaced the line with the other one, I compiled, without getting any errors. I try this in game
Reply
#9

Well when I try to buy a house now it says "You don't have the key of this house"

// Boite dialogue Acceptation pour vente de maison/voiture/biz = Dialog box for acceptation selling house/car/biz
[Maison] Vous n'avez pas les clefs de cette maison : You don't have the keys of this house
[Maison] Vous n'кtes pas sur le pickup ou dans une maison. : You're not in the house or on the checkpoint.


pawn Код:
if(dialogid == 18) // Boite dialogue Acceptation pour vente de maison/voiture/biz
        {
            new thehouse;
            new itsok;
            if(PlayerInfo[playerid][pInHouse] != -1 && (house_isProprio(playerid,PlayerInfo[playerid][pInHouse]) || house_isLocataire(playerid,PlayerInfo[playerid][pInHouse])))
            {
                thehouse = PlayerInfo[playerid][pInHouse];
            }
            else
            {
                print("Lancement Boucle 32");
                for(new houseid = 0; houseid < totalhouses; houseid++)
                {
                    if (PlayerToPoint(3, playerid,HouseInfo[houseid][hEntrancex], HouseInfo[houseid][hEntrancey], HouseInfo[houseid][hEntrancez]))
                    {
                        if(house_isProprio(playerid,houseid) || house_isLocataire(playerid,houseid))
                        {
                            itsok = 1;
                            thehouse = houseid;
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_MAISON, "[Maison] Vous n'avez pas les clefs de cette maison.");
                        }
                        break;
                    }
                }
                print("Fin Boucle 32");
                if(itsok == 0)
                    {SendClientMessage(playerid, COLOR_MAISON, "[Maison] Vous n'кtes pas sur le pickup ou dans une maison."); return 1;}
            }
Reply
#10

whats

"Lancement Boucle 32"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)