It creates 255 3DTextDraws instead of 1 0_0
#1

So, the title says all, IT creates 255 textdraws (Size of max_houses) instead of one wich makes HUGE lag:

CODE:

pawn Код:
CMD:createhouse(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel]>= 6)
    {
    new Float:posx, Float:posy, Float:posz;
    new price;
    new iposx, iposy, iposz;
    new intid;
    new h;
    new string[256];
    for(new i = 0; i < sizeof(House); i++)
    {
    if(House[i][Setted] == 1)
    {
        h = i + 1;
    }
        if(!sscanf(params, "iiiii", price, iposx, iposy, iposz, intid))
        {
            GetPlayerPos(playerid, posx, posy, posz);
            format(file5, sizeof(file5), "realityrp/houses/%d.ini", h);
            dini_Create(file5);
            dini_IntSet(file5, "hforsale",House[h][hforsale] = 1);
            dini_IntSet(file5, "hprice",House[h][hprice] = price);
            dini_IntSet(file5, "howner",House[h][howner] = 99999);
            dini_FloatSet(file5, "henx", posx);
            dini_FloatSet(file5, "heny", posy);
            dini_FloatSet(file5, "henz", posz);
            dini_IntSet(file5, "hexx",House[h][hexx] = iposx);
            dini_IntSet(file5, "hexy",House[h][hexy] = iposy);
            dini_IntSet(file5, "hexz",House[h][hexz] = iposz);
            dini_IntSet(file5, "hint",House[h][hint] = intid);
            dini_IntSet(file5, "hvw",House[h][hvw] = h);
            dini_IntSet(file5, "hlocked",House[h][hlocked] = 1);
            dini_IntSet(file5, "Setted",House[h][Setted] = 1);
            House[h][henx] = dini_Float(file5, "henx");
            House[h][heny] = dini_Float(file5, "heny");
            House[h][henz] = dini_Float(file5, "henz");
            HousePickup[h] = CreatePickup(1273, 1, posx, posy, posz + 0.25);
            format(string, sizeof(string), "House Price: %i \nTo buy this house use /buyhouse", House[h][hprice]);
            HouseLabel[h] = Create3DTextLabel(string ,COLOR_BLUE, House[h][henx],House[h][heny],House[h][henz],50, 0, 1);
            Index[tophnumber] = Index[tophnumber] + 1;
        }
        else return SendClientMessage(playerid, COLOR_GREY, "USAGE: /createhouse [price][Int X][Int Y][Int Z][Int ID]");
    }
    return 1;
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command");
}
Reply
#2

uhmm.. Spelling Mistake, I mean 3DTextLabel...


I fixed it, It actually was in the code.
I made the loop wrong so It created all House files in one time and setted all houses to the same parameters, I fixed it by using your tip for my vehicle dealership with an index file (still love that idea).

Will post again if any more errors/bugs appear
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)