give me idea - TextDraw limits
#1

Hi all,
I have came across a problem with textdraws.
I create an array by this way:
pawn Код:
enum KMOraEnum { Text:csik, Text:benzin, Text:sebesseg, Text:szazmeter, Text:kilometer };
new Text:kmora[MAX_VEHICLES][KMOraEnum];
This can hold 2000*5 = 10000 textdraw entry.
In OnVehicleSpawn i use:
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    kmora[vehicleid][benzin] = TextDrawCreate(479.000000,358.000000,"Benzin: 0 liter");
    kmora[vehicleid][sebesseg] = TextDrawCreate(494.000000,330.000000,"0 km / h");
    kmora[vehicleid][kilometer] = TextDrawCreate(476.000000,346.000000,"000000");
    kmora[vehicleid][szazmeter] = TextDrawCreate(601.000000,346.000000,"1");
    kmora[vehicleid][csik] = TextDrawCreate(623.000000,320.000000,"----------");
    // other textdraw things...
OnPlayerEnterVehicle:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    // some code
    if (!ispassenger)
    {
        TextDrawShowForPlayer(playerid, kmora[vehicleid][kilometer]);
        TextDrawShowForPlayer(playerid, kmora[vehicleid][szazmeter]);
        TextDrawShowForPlayer(playerid, kmora[vehicleid][benzin]);
        TextDrawShowForPlayer(playerid, kmora[vehicleid][csik]);
        TextDrawShowForPlayer(playerid, kmora[vehicleid][sebesseg]);
        T_kmora[playerid] = SetTimerEx("OnDistanceUpdate", 5000, 1, "d", GetPlayerVehicleID(playerid));
    }
        // some other code
My problem is the TextDraw does not get shown for anyone who enters the vehicle.
What can be the problem here? I thought of textdraw limits. SAMP Wiki says maximum 2048 textdraw can be created serverwise. I load my vehicles from SQLite, I have about ~150 vehicle in the table.
It's about 150*5 = 750 TD, and I have MAX_PLAYERS*7 textdraws for other things. But that is working.

If the problem is the limit, how can I solve that?
If it is not the limit, what is it?

Please help me

Thanks
Reply
#2

Why not create per-player textdraws, and just update them whenever a player enters a vehicle?
Although 500x5 still gets over the limit. You could also redefine MAX_VEHICLES or MAX_PLAYERS to a lower value.
Reply
#3

problem was Vehicle Library lol... and it's f****in' wrong callings - my OnPlayer(Enter/Exit)Vehicle got never called lol... anyway optimized the TDs, thanks Vince.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)