Problem 3dtext
#1

i have a problem in 3dtext for house system when the player buyes/sell/update rent of the house i put to update 3dtext and isn't working i would give only buyhouse cmd for you to see and who knows to help me

pawn Код:
forward HouseUpdate(id);
public HouseUpdate(id)
{
        for(new h = 0; h < sizeof(HouseInfo); h++)
        {
            new HouseString[256];
            new HouseStatus[128];
            if(HouseInfo[h][hLock] == 0) { HouseStatus = "Otkluceno"; }
            else if(HouseInfo[h][hLock] == 1) { HouseStatus = "Zakluceno"; }
            if(HouseInfo[h][hOwned] = 1)
            {
                format(HouseString,sizeof(HouseString),"[Kukja]\n{00C0FF}Gazda:{ffffff} %s\n{00C0FF}Kukja:{ffffff} %s\n{00C0FF}Adresa:{ffffff} %s\n{00C0FF} Rent Cena:{ffffff} %d\n{00C0FF} Status:{ffffff} %s\n{00C0FF} Level:{ffffff} %d\n{00C0FF}/enter", HouseInfo[h][hOwner],HouseInfo[h][hDiscription],HouseInfo[h][hDiscription],HouseInfo[h][hRent],HouseStatus,HouseInfo[h][hLevel]);
                HouseLabel[h] = CreateDynamic3DTextLabel(HouseString ,0x2641FEAA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],5);
                HousePickup[h] = CreateDynamicPickup(1239, 1, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
                return 1;
            }
            else if(HouseInfo[h][hOwned] = 0)
            {
                format(HouseString,sizeof(HouseString),"[Kukjata Se Prodava]\n{00C0FF}Cena:{ffffff} %d$\n{00C0FF} Opis:{ffffff} %s\n{00C0FF} Adresa:{ffffff} %s \n{00C0FF} Potreben Level:{ffffff} %d\n{00C0FF}/buyhouse", HouseInfo[h][hValue], HouseInfo[h][hDiscription], HouseInfo[h][hDiscription], HouseInfo[h][hLevel]);
                HouseLabel[h] = CreateDynamic3DTextLabel(HouseString ,0x2641FEAA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],5);
                HousePickup[h] = CreateDynamicPickup(1239, 1, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
                return 1;
            }
        }
        return 1;
}
pawn Код:
if(strcmp(cmd, "/buyhouse", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new Float:oldposx, Float:oldposy, Float:oldposz;
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerPos(playerid, oldposx, oldposy, oldposz);
            for(new h = 0; h < sizeof(HouseInfo); h++)
            {
                if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 0)
                {
                    /*if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
                    {
                        format(string, sizeof(string), "   You must be Level %d to purchase this !", HouseInfo[h][hLevel]);
                        SendClientMessage(playerid, COLOR_GRAD5, string);
                        return 1;
                    }*/

                    if(PlayerInfo[playerid][pHousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pHousekey]][hOwner], true) == 0)
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "   You already own a house, type /sellhouse if you want to buy this one !");
                        return 1;
                    }
                    if(GetPlayerPCash(playerid) >= HouseInfo[h][hValue] || PlayerInfo[playerid][pFH] == 1)
                    {
                        PlayerInfo[playerid][pHousekey] = h;
                        HouseInfo[h][hOwned] = 1;
                        HouseEntered[playerid] = h;
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
                        if(PlayerInfo[playerid][pFH] == 0)
                        {
                            if(WeekendType == 5)
                            {
                                GivePlayerPCash(playerid,-HouseInfo[h][hValue]*8/10);
                                SendClientMessage(playerid,COLOR_LIGHTBLUE,"It's house weekend, you recieved this house 20% cheaper! Congratulations!");
                            }
                            else { GivePlayerPCash(playerid,-HouseInfo[h][hValue]); }
                        }
                        //PlayerPlayMusic(playerid);
                        SetPlayerInterior(playerid,HouseInfo[h][hInt]);
                        SetPlayerVirtualWorld(playerid,h+100);
                        SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
                        GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
                        PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
                        PlayerInfo[playerid][pLocal] = h;
                        SendClientMessage(playerid, COLOR_WHITE, "Congratulations, on your new Purchase !");
                        SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section !");
                        OnPropUpdate();
                        HouseEntered[playerid] = h;
                        OnPlayerDataSave(playerid);
                        DestroyDynamicPickup(HousePickup[h]);
                        DestroyDynamic3DTextLabel(HouseLabel[h]);
                        HouseUpdate(h);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "   You don't have the cash for that !");
                        return 1;
                    }
                }
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)