Jump to content
  • 0

Problema LoadHouses


BuNiCu-RP

Question

public:: LoadHouses() {
    new rows;
    cache_get_row_count(rows); 
    for (new f = 0, h = rows; f <= h ; f++)
    {
        cache_get_value_int(f, "houseID", HSVar:h(ID));
        cache_get_value_int(f, "houseInteriorID", HSVar:h(InteriorID));
        cache_get_value_int(f, "housePrice", HSVar:h(Price));
        cache_get_value_int(f, "houseLevel", HSVar:h(Level));
        cache_get_value_int(f, "houseForSale", HSVar:h(ForSale));
        cache_get_value_int(f, "houseVW", HSVar:h(VW));
        cache_get_value_int(f, "houseLocked", HSVar:h(Locked));
        cache_get_value_int(f, "houseMoney", HSVar:h(Money));
        cache_get_value_int(f, "houseRentable", HSVar:h(Rentable));
        cache_get_value_int(f, "houseRentprice", HSVar:h(Rentprice));
        cache_get_value_int(f, "houseRenters", HSVar:h(Renters));
        cache_get_value_int(f, "housePickup", HSVar:h(Pickup));
        

        cache_get_value_float(f, "houseExteriorPosX", HSVar:h(ExteriorPosX));
        cache_get_value_float(f, "houseExteriorPosY", HSVar:h(ExteriorPosY));
        cache_get_value_float(f, "houseExteriorPosZ", HSVar:h(ExteriorPosZ));

        cache_get_value_float(f, "houseInteriorPosX", HSVar:h(InteriorPosX));
        cache_get_value_float(f, "houseInteriorPosY", HSVar:h(InteriorPosY));
        cache_get_value_float(f, "houseInteriorPosZ", HSVar:h(InteriorPosZ));

        cache_get_value(f, "houseOwner", HSVar:h(Owner), 32);
        cache_get_value(f, "houseName", HSVar:h(Name), 64);
        cache_get_value(f, "houseTextLabel", HSVar:h(TextLabel), 256);

        HSVar:h(Cache) = cache_save();

        HousesPickup[f] = CreateDynamicPickup(HSVar:h(Pickup), 2, HSVar:h(ExteriorPosX), HSVar:h(ExteriorPosY), HSVar:h(ExteriorPosZ), -1, -1, -1, 25.0, -1, 0);
        format(HSVar:h(TextLabel), 256, "Name: %s\nOwner: %s\nLevel: %d\nRent: $%s", HSVar:h(Name), HSVar:h(Owner), HSVar:h(Level), FormatNumber(HSVar:h(Rentprice)));
        HSVar:f(Text) = Create3DTextLabel(HSVar:h(TextLabel), 0x64d6fcFF, HSVar:h(ExteriorPosX), HSVar:h(ExteriorPosY), HSVar:h(ExteriorPosZ), 25.0, 0, 0);
        
        if(HSVar:h(Locked) == 1)
        {
            format(HSVar:h(TextLabel), 256, "%s\nOwner: %s\nLevel: %d\n(Locked)", HSVar:h(Name), HSVar:h(Owner), HSVar:h(Level));
            Update3DTextLabelText(HSVar:f(Text), 0x64d6fcFF, HSVar:h(TextLabel));
        } else if(HSVar:h(ForSale) == 1) {
            format(HSVar:h(TextLabel), 256, "%s\nOwner: %s\nLevel: %d\nFor sale ($%s)", HSVar:h(Name), HSVar:h(Owner), HSVar:h(Level), FormatNumber(HSVar:h(Price)));
            Update3DTextLabelText(HSVar:f(Text), 0x64d6fcFF, HSVar:h(TextLabel));
        }
    }
    
    /* // Server Array
    SAVar[f][hExit][0]         = HSVar:h(ExteriorPosX);
    SAVar[f][hExit][1]         = HSVar:h(ExteriorPosY);
    SAVar[f][hExit][2]         = HSVar:h(ExteriorPosZ);

    SAVar[f][hEnter][0]     = HSVar:h(InteriorPosX);
    SAVar[f][hEnter][1]     = HSVar:h(InteriorPosY);
    SAVar[f][hEnter][2]     = HSVar:h(InteriorPosZ);
    
    SAVar[f][hVW]             = HSVar:h(VW);
    SAVar[f][hInt]             = HSVar:h(InteriorID);
    SAVar[f][hxID]             = HSVar:h(ID);
    */

    TotalHouses = rows;
    printf("* Loaded %d house", rows);
    return 1;
}

Publicul loadHouses.

Comanda enter:

CMD:enter(playerid, params[])
{
	if(PVar:playerid[IsLoggedIn] != true) return CmdErrorMessage(playerid, "Trebuie sa fii conectat pentru a folosi comenzii");

	for(new i = 0; i < MAX_HOUSES; i++) {
		if(HSVar:i(Locked) == 1) { GameTextForPlayer(playerid, "~r~House door loked !", 1000, 1); }

		if(HSVar:i(Locked) == 0) {
			if(IsPlayerInRangeOfPoint(playerid, 5.0, HSVar:i(ExteriorPosX), HSVar:i(ExteriorPosY), HSVar:i(ExteriorPosZ))) {
				SetPlayerInterior(playerid, HSVar:i(InteriorID));
				SetPlayerPos(playerid, HSVar:i(InteriorPosX), HSVar:i(InteriorPosY), HSVar:i(InteriorPosZ));
				GameTextForPlayer(playerid, "Welcome to home !", 1000, 4);
				// SetPlayerVirtualWorld(playerid, SAVar[i][hVW]);
			}
		}
	}
	return 1;
}

Problema este ca nu imi incarca/salveaza float...

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.