Either one or another textdraw shown?
#1

Hi, I got some troubles with textdraws...
I have 2 Textdraws created both shown under OnPlayerConnect
pawn Код:
new Text:Opdracht[MAX_PLAYERS];
new Text:SPEEDOS[MAX_PLAYERS];
pawn Код:
//==============================================================================
//TextDraws
//==============================================================================
    Opdracht[playerid] = TextDrawCreate(320,431.000000,"New Stuntages     /help  /cmds  /v  /teles  ..."); // Info TD on the bottom of the screen
    TextDrawLetterSize(Opdracht[playerid], 0.260000, 1.400000);
    TextDrawSetOutline(Opdracht[playerid], 1);
    TextDrawBackgroundColor(Opdracht[playerid],0x000000ff);
    TextDrawUseBox(Opdracht[playerid], 1);
    TextDrawBoxColor(Opdracht[playerid], 0x000000AA);
    TextDrawAlignment(Opdracht[playerid], 2);
    TextDrawFont(Opdracht[playerid],2);
    TextDrawShowForPlayer(playerid,Opdracht[playerid]);
//------------------------------------------------------------------------------
    SPEEDOS[playerid] = TextDrawCreate(10.0,200.0," "); // SpeedoMeter TD
    TextDrawShowForPlayer(playerid,SPEEDOS[playerid]);
    return 1;
}
the speedo thing: (its from a tutorial)
pawn Код:
public OnPlayerUpdate(playerid)
{
    new Float:speed_x10,Float:speed_y10,Float:speed_z10,Float:final_speed10,speed_string10[256],final_speed_int10, vehicleid;
    vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid != 0)
    {
        GetVehicleVelocity(vehicleid,speed_x10,speed_y10,speed_z10);
        final_speed10 = floatsqroot(((speed_x10*speed_x10)+(speed_y10*speed_y10))+(speed_z10*speed_z10))*136.666667;
        final_speed_int10 = floatround(final_speed10,floatround_round);
        format(speed_string10,256,"Speed: %i",final_speed_int10);
        TextDrawSetString(SPEEDOS[playerid], speed_string10);
    }
    else
        TextDrawSetString(SPEEDOS[playerid], " ");
when I only had one TD (opcracht) in my server it worked perfectly and it got shown when the player connected...
however now that I added the SpeedoMeter thing, the opdracht TD doesn't show any longer... however the speedo works when I enter a vehicle :/
any help?
rep for helper
Thanks in advance!
Reply
#2

Do you destroy the textdraws when the player disconnects? That would help I think
Reply
#3

You have to initialise the arrays like this:
pawn Код:
new Text:Opdracht[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW,...};
new Text:SPEEDOS[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW,...};
I've asked this years ago, but I still cannot understand why it's needed.
However, it does the magic.
Reply
#4

At least for me it works this way

pawn Код:
new Text:Opdracht[MAX_PLAYERS];
new Text:SPEEDOS[MAX_PLAYERS];
Reply
#5

Quote:

wait, no it didn't help :/
please help me I think my GM is bugged as fuck!

I think you also need to destroy the textdraws in OnPlayerDisconnect, as Jakku said.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)