SA-MP Forums Archive
SpeedMeter textdraw is not showing up - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SpeedMeter textdraw is not showing up (/showthread.php?tid=542686)



SpeedMeter textdraw is not showing up - lulo356 - 21.10.2014

Eyy, i have a speedmeter system but its not showing up what do i need to do

pawn Код:
forward Speedo(playerid);
public Speedo(playerid) {

    new vehicleid,
        Float:speed_x,
        Float:speed_y,
        Float:speed_z,
        Float:final_speed,
        speed_string[256],
        final_speed_int;

for(new i = 0; i < MAX_PLAYERS; i++)
    {
        vehicleid = GetPlayerVehicleID(i);

        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))*136;
            final_speed_int = floatround(final_speed,floatround_round);
            format(speed_string,256,"Speed: %i Km/H",final_speed_int);
            TextDrawSetString(Speedoo[i], speed_string);

        } else {
       
            TextDrawSetString(Speedoo[i], "Speed: 0 Km/H ");

        }


    }
    return 1;
}
OnPlayerStatechange
pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) {

        TextDrawShowForPlayer(playerid,Speedoo[playerid]);
        PlayerTextDrawShow(playerid, dashboard[playerid]);
        PlayerTextDrawShow(playerid, carhealth[playerid]);
    }

    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) {

        TextDrawHideForPlayer(playerid,Speedoo[playerid]);
        PlayerTextDrawHide(playerid, dashboard[playerid]);
        PlayerTextDrawHide(playerid, carhealth[playerid]);

    }
    return 1;
}
There are no errors and i maked two playertextdraw so thats why PlayerTextDrawShow/Hide


Re: SpeedMeter textdraw is not showing up - lulo356 - 21.10.2014

Does somebody know how to fix it?


Re: SpeedMeter textdraw is not showing up - Glossy42O - 21.10.2014

Don't bump.


Re: SpeedMeter textdraw is not showing up - SaintMikey - 21.10.2014

Off-Topic advice: Please, do not try to bump your own threads, It'll be taken as double-posting, and may/may not be infractable.


Re: SpeedMeter textdraw is not showing up - gurmani11 - 21.10.2014

be sure that you have created "PlayerTextDraws" in "OnPlayerConnect"


Re: SpeedMeter textdraw is not showing up - lulo356 - 21.10.2014

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
be sure that you have created "PlayerTextDraws" in "OnPlayerConnect"
Why should i place PlayerTextDraw in OnPlayerConnect, then you will see when you connect the speed meter,,,


Re: SpeedMeter textdraw is not showing up - gurmani11 - 21.10.2014

PlayerTextDraws are specified only a player. A player who joins server the textdraws will only be created in it they will not show up untill you add "PlayerTextDrawShow" in OnPlayerConnect


Re: SpeedMeter textdraw is not showing up - lulo356 - 21.10.2014

I already tryed that but it will shows up when a player connects and logs in


Re: SpeedMeter textdraw is not showing up - gurmani11 - 21.10.2014

show whole code with your txtdraws data .. Let me manage it.


Re: SpeedMeter textdraw is not showing up - lulo356 - 21.10.2014

onplayerconnect
pawn Код:
Speedoo[playerid] = TextDrawCreate(510.000000, 371.000000, "Speed:");
    TextDrawBackgroundColor(Speedoo[playerid], 255);
    TextDrawFont(Speedoo[playerid], 1);
    TextDrawLetterSize(Speedoo[playerid], 0.400000, 1.000000);
    TextDrawColor(Speedoo[playerid], -1);
    TextDrawSetOutline(Speedoo[playerid], 1);
    TextDrawSetProportional(Speedoo[playerid], 1);
    TextDrawUseBox(Speedoo[playerid], 1);
    TextDrawBoxColor(Speedoo[playerid], -222);
    TextDrawTextSize(Speedoo[playerid], 640.000000, 0.000000);
    TextDrawSetSelectable(Speedoo[playerid], 0);

    fuel[playerid] = CreatePlayerTextDraw(playerid, 510.000000, 386.000000, "Fuel:");
    PlayerTextDrawBackgroundColor(playerid, fuel[playerid], 255);
    PlayerTextDrawFont(playerid, fuel[playerid], 1);
    PlayerTextDrawLetterSize(playerid, fuel[playerid], 0.409999, 1.000000);
    PlayerTextDrawColor(playerid, fuel[playerid], -1);
    PlayerTextDrawSetOutline(playerid, fuel[playerid], 1);
    PlayerTextDrawSetProportional(playerid, fuel[playerid], 1);
    PlayerTextDrawUseBox(playerid, fuel[playerid], 1);
    PlayerTextDrawBoxColor(playerid, fuel[playerid], -222);
    PlayerTextDrawTextSize(playerid, fuel[playerid], 660.000000, 0.000000);
    PlayerTextDrawSetSelectable(playerid, fuel[playerid], 0);

    dashboard[playerid] = CreatePlayerTextDraw(playerid, 531.000000, 351.000000, "Dash Board");
    PlayerTextDrawBackgroundColor(playerid, dashboard[playerid], 255);
    PlayerTextDrawFont(playerid, dashboard[playerid], 1);
    PlayerTextDrawLetterSize(playerid, dashboard[playerid], 0.400000, 2.000000);
    PlayerTextDrawColor(playerid, dashboard[playerid], 16777215);
    PlayerTextDrawSetOutline(playerid, dashboard[playerid], 1);
    PlayerTextDrawSetProportional(playerid, dashboard[playerid], 1);
    PlayerTextDrawSetSelectable(playerid, dashboard[playerid], 0);

    carhealth[playerid] = CreatePlayerTextDraw(playerid, 510.000000, 401.000000, "Health:");
    PlayerTextDrawBackgroundColor(playerid, carhealth[playerid], 255);
    PlayerTextDrawFont(playerid, carhealth[playerid], 1);
    PlayerTextDrawLetterSize(playerid, carhealth[playerid], 0.319999, 1.000000);
    PlayerTextDrawColor(playerid, carhealth[playerid], -1);
    PlayerTextDrawSetOutline(playerid, carhealth[playerid], 1);
    PlayerTextDrawSetProportional(playerid, carhealth[playerid], 1);
    PlayerTextDrawUseBox(playerid, carhealth[playerid], 1);
    PlayerTextDrawBoxColor(playerid, carhealth[playerid], -222);
    PlayerTextDrawTextSize(playerid, carhealth[playerid], 660.000000, 0.000000);
    PlayerTextDrawSetSelectable(playerid, carhealth[playerid], 0);