Textdraw doesn't show
#1

Hey I created my own speedometer but it doesnt want to show up..Heres the codes:

pawn Код:
new Text:SPEEDOS[MAX_PLAYERS];

new Text:SPEEDOMPH[MAX_PLAYERS];
pawn Код:
SPEEDOS[playerid] = TextDrawCreate(587.000000, 357.000000, " ");
    TextDrawColor(SPEEDOS[playerid], 16711935);
    TextDrawSetOutline(SPEEDOS[playerid], 1);
    TextDrawShowForPlayer(playerid,SPEEDOS[playerid]);
   
   
   
    SPEEDOMPH[playerid] = TextDrawCreate(580.000000, 422.000000, "M.P.H");
    TextDrawLetterSize(SPEEDOMPH[playerid], 0.500000, 2.000000);
    TextDrawColor(SPEEDOMPH[playerid], -65281);
pawn Код:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        TextDrawShowForPlayer(playerid,SPEEDOS[playerid]);
       
       
        TextDrawShowForPlayer(playerid,SPEEDOMPH[playerid]);
        SetTimer("Speedometer", 100, true);
    }
pawn Код:
public Speedometer(playerid)
{
    new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
    vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid != 0)
    {
        GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
        final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.416672; // 250.666667 = kmph  // 199,4166672= mph
        final_speed_int = floatround(final_speed,floatround_round);
        format(speed_string,256,"%i ",final_speed_int);
        TextDrawSetString(SPEEDOS[playerid], speed_string);
    }
    else
    {
        TextDrawSetString(SPEEDOS[playerid], " ");
       
    }
    return 1;
}

Anyone see an issue? thanks in advance.
Reply
#2

Are you creating the TD for the player when they connect?
Reply
#3

Yeah, because can't use [playerid] under ongamemodeinit
Reply
#4

Well no, but you can create a loop...

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Reply
#5

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Well no, but you can create a loop...

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Yeah thats right, It use to work perfectly fine before, No idea why it decided to stop working, But I'll just head to the loop i guess.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)