SpeedoMeter Bug
#1

Hello Guys,
I Have Problem With My Speedometer Script

It Show The Train NPC Stats In The Speedometer And If The NPC Not Connected And Some One Entered Vehicle And I Am Not In Vehicle It Will Show His Vehicle Stats In Speedometer

Here Is The Code:
pawn Код:
public OnGameModeInit()
{
    SetTimer("Speedometer", 100, true);
    VStats = TextDrawCreate(450,340," ");
    VName = TextDrawCreate(450,360," ");
    SPEEDOS = TextDrawCreate(450,380.0," ");
    HEALTH = TextDrawCreate(450,400.0," ");
    Doors = TextDrawCreate(450,420.0," ");
    TextDrawColor(VStats,GREEN);
    TextDrawColor(VName,GREEN);
    TextDrawColor(SPEEDOS,GREEN);
    TextDrawColor(HEALTH,GREEN);
    TextDrawColor(Doors,GREEN);
    TextDrawFont(VStats, 1);
    TextDrawFont(VName, 1);
    TextDrawFont(SPEEDOS, 1);
    TextDrawFont(HEALTH, 1);
    TextDrawFont(Doors, 1);
    TextDrawSetOutline(VStats, 1);
    TextDrawSetOutline(VName, 1);
    TextDrawSetOutline(SPEEDOS, 1);
    TextDrawSetOutline(HEALTH, 1);
    TextDrawSetOutline(Doors, 1);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid,VStats);
    TextDrawShowForPlayer(playerid,VName);
    TextDrawShowForPlayer(playerid,SPEEDOS);
    TextDrawShowForPlayer(playerid,HEALTH);
    TextDrawShowForPlayer(playerid,Doors);
    return 1;
}

public Speedometer(playerid)
{
    new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
    new Float:vehicle_health,final_vehicle_health,health_string[256],namesstring[200];
    vehicleid = GetPlayerVehicleID(playerid);
    if (IsPlayerInAnyVehicle(playerid)) {
            if(PInfo[playerid][lock] == 1) TextDrawSetString(Doors, "Doors: Locked");
            if(PInfo[playerid][lock] == 0) TextDrawSetString(Doors, "Doors: UnLocked");
            GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
            final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*250.666667;
            final_speed_int = floatround(final_speed,floatround_round);
            format(speed_string,256,"Speed: %i",final_speed_int);
            TextDrawSetString(SPEEDOS, speed_string);
            GetVehicleHealth(vehicleid,vehicle_health);
            final_vehicle_health = floatround(floatround(vehicle_health - 250)/ 7.5);
            format(health_string,256,"Health: %i", final_vehicle_health);
            TextDrawSetString(HEALTH, health_string);
            format(namesstring, sizeof namesstring,"Name: %s",VNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            TextDrawSetString(VName,namesstring);
            TextDrawSetString(VStats, "Vehicle Stats:");
        }
        else {
        TextDrawSetString(VStats, " ");
        TextDrawSetString(SPEEDOS, " ");
        TextDrawSetString(HEALTH, " ");
        TextDrawSetString(VName, " ");
        TextDrawSetString(Doors," ");
    }
    return 1;
}
Thanks
Reply


Messages In This Thread
SpeedoMeter Bug - by misho1 - 20.08.2012, 21:11
Re: SpeedoMeter Bug - by Ranama - 20.08.2012, 21:20
Re: SpeedoMeter Bug - by misho1 - 20.08.2012, 22:04
Re : SpeedoMeter Bug - by ricardo178 - 20.08.2012, 22:08
Re: SpeedoMeter Bug - by Ranama - 20.08.2012, 22:16
Re: SpeedoMeter Bug - by misho1 - 20.08.2012, 22:26
Re: SpeedoMeter Bug - by Ranama - 20.08.2012, 22:34
Re: SpeedoMeter Bug - by misho1 - 20.08.2012, 22:38
Re: SpeedoMeter Bug - by Ranama - 20.08.2012, 22:43
Re: SpeedoMeter Bug - by misho1 - 20.08.2012, 23:49

Forum Jump:


Users browsing this thread: 1 Guest(s)