|° Speedometer HELP °|
#1

I have problem whit my speedometer system....Problem is when i enter vehicle textdraws show me but when i start drive i dont get number of how much im going (speed) Here is my code...

Brzina = Speed

pawn Код:
#include <a_samp>

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

forward CheckStatus();

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

new PlayerVehicle[212][] = {
"Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana",
"Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat",
"Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife",
"Trailer 1", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo",
"Seasparrow", "Pizzaboy", "Tram", "Trailer 2", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair",
"Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic", "Sanchez", "Sparrow",
"Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX", "Burrito",
"Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring",
"Sandking", "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B",
"Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster","Stunt", "Tanker",
"Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
"Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak",
"Vortex", "Vincent", "Bullet", "Clover", "Sadler", "Firetruck LA", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit",
"Utility", "Nevada", "Yosemite", "Windsor", "Monster A", "Monster B", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance",
"RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito", "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper", "Broadway",
"Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "News Van", "Tug", "Trailer 3", "Emperor", "Wayfarer", "Euros", "Hotdog",
"Club", "Freight Carriage", "Trailer 4", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
"Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A",
"Luggage Trailer B", "Stairs", "Boxville", "Tiller", "Utility Trailer" };

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Booleans
new bool:TextDrawsShown[MAX_PLAYERS];
new bool:VHSCreated[MAX_PLAYERS];

//Timer
new CheckStatusTimer;

//4all
new Text:Brzina;

//4player
new Text:VHS[MAX_PLAYERS];

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

public OnFilterScriptInit()
{
Brzina = TextDrawCreate(498.000000, 125.000000, "Brzina:");
TextDrawBackgroundColor(Brzina, 255);
TextDrawFont(Brzina, 1);
TextDrawLetterSize(Brzina, 0.500000, 1.000000);
TextDrawColor(Brzina, -1);
TextDrawSetOutline(Brzina, 1);
TextDrawSetProportional(Brzina, 1);
TextDrawUseBox(Brzina, 1);
TextDrawBoxColor(Brzina, 122);
TextDrawTextSize(Brzina, 611.000000, 0.000000);

    CheckStatusTimer = SetTimer("CheckStatus", 150, 1);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

public OnFilterScriptExit()
{
    KillTimer(CheckStatusTimer);

    TextDrawDestroy(Text:Brzina);
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        TextDrawDestroy(Text:VHS[i]);
    }
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

public OnPlayerConnect(playerid)
{
    TextDrawsShown[playerid] = false;
    VHSCreated[playerid] = false;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

public CheckStatus()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInAnyVehicle(i))
            {

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                if(TextDrawsShown[i] == false)
                {
                  TextDrawShowForPlayer(i, Text:Brzina);
                  TextDrawsShown[i] = true;
                }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

              new String[128];
            new Float:X, Float:Y, Float:Z, Float:Speed;
        GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
        Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 100.0);
                new PlayerVehicleModelID = GetVehicleModel(GetPlayerVehicleID(i));
                PlayerVehicleModelID -= 400;
                format(String,sizeof(String),"~b~Vehicle:~n~~w~%s~n~~b~Speed:~n~~w~%ikm/h", PlayerVehicle[PlayerVehicleModelID],floatround(Speed, floatround_floor));
                if(VHSCreated[i] == true)
                {
                    TextDrawDestroy(VHS[i]);
                }
        VHS[i] = TextDrawCreate(498.000000, 110.000000, String);
        TextDrawBackgroundColor(VHS[i], 255);
        TextDrawFont(VHS[i], 1);
        TextDrawLetterSize(VHS[i], 0.500000, 1.000000);
        TextDrawColor(VHS[i], -1);
        TextDrawSetOutline(VHS[i], 1);
        TextDrawSetProportional(VHS[i], 1);
        TextDrawUseBox(VHS[i], 1);
        TextDrawBoxColor(VHS[i], 122);
        TextDrawTextSize(VHS[i], 611.000000, 0.000000);
       
        VHSCreated[i] = true;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            }
            else
            {
              if(TextDrawsShown[i] == true)
              {
                    TextDrawHideForPlayer(i, Text:Brzina);
                  TextDrawsShown[i] = false;
                }
                TextDrawHideForPlayer(i, Text:VHS[i]);
            }
        }
    }
}
Reply
#2

EDIT: Can somebody help me....?
Reply
#3

Use TextDrawSetString(textdraw id ,string)........
Reply
#4

I dont understand can you help me please
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)