[Ajuda]Velocimetro a milhгo!
#7

Ok;

Ai vai:
pawn Код:
No inicio:
forward AtualizarVeloVictor(playerid);
new Text:box[MAX_PLAYERS],Text:tacho[MAX_PLAYERS],Text:fahrzeug[MAX_PLAYERS],Text:kmh[MAX_PLAYERS];
new Text:hoehe[MAX_PLAYERS],Text:zustand[MAX_PLAYERS];
new SpeedoON[MAX_PLAYERS];
//========================================================================
//Em OnGameMode Init
SetTimer("AtualizarVeloVictor",1000, 1);
//=============================================================================
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        box[i] = TextDrawCreate(198.000000,396.000000,"_");
        TextDrawUseBox(box[i],1);
        TextDrawBoxColor(box[i],0x00000066);
        TextDrawTextSize(box[i],438.000000,0.000000);
        TextDrawAlignment(box[i],0);
        TextDrawBackgroundColor(box[i],0x00000033);
        TextDrawFont(box[i],3);
        TextDrawLetterSize(box[i],1.000000,4.000000);
        TextDrawColor(box[i],0xffffffff);
        TextDrawSetOutline(box[i],1);
        TextDrawSetProportional(box[i],1);
        TextDrawSetShadow(box[i],1);

        /*tacho[i] = TextDrawCreate(288.000000,380.000000,"Velocimetro");
        TextDrawUseBox(tacho[i],1);
        TextDrawBoxColor(tacho[i],0x00000066);
        TextDrawTextSize(tacho[i],343.000000,67.000000);
        TextDrawAlignment(tacho[i],0);
        TextDrawBackgroundColor(tacho[i],0x000000ff);
        TextDrawFont(tacho[i],2);
        TextDrawLetterSize(tacho[i],0.399999,1.400000);
        TextDrawColor(tacho[i],0xffffffff);
        TextDrawSetOutline(tacho[i],1);
        TextDrawSetProportional(tacho[i],1);
        TextDrawSetShadow(tacho[i],1);*/


        fahrzeug[i] = TextDrawCreate(198.000000,396.000000," ");
        TextDrawAlignment(fahrzeug[i],0);
        TextDrawBackgroundColor(fahrzeug[i],0x000000ff);
        TextDrawFont(fahrzeug[i],1);
        TextDrawLetterSize(fahrzeug[i],0.299999,1.000000);
        TextDrawColor(fahrzeug[i],0xffffffff);
        TextDrawSetOutline(fahrzeug[i],1);
        TextDrawSetProportional(fahrzeug[i],1);
        TextDrawSetShadow(fahrzeug[i],1);

        kmh[i] = TextDrawCreate(345.000000,396.000000," ");
        TextDrawAlignment(kmh[i],0);
        TextDrawBackgroundColor(kmh[i],0x000000ff);
        TextDrawFont(kmh[i],1);
        TextDrawLetterSize(kmh[i],0.299999,1.000000);
        TextDrawColor(kmh[i],0xffffffff);
        TextDrawSetOutline(kmh[i],1);
        TextDrawSetProportional(kmh[i],1);
        TextDrawSetShadow(kmh[i],1);

        hoehe[i] = TextDrawCreate(199.000000,408.000000," ");
        TextDrawAlignment(hoehe[i],0);
        TextDrawBackgroundColor(hoehe[i],0x000000ff);
        TextDrawFont(hoehe[i],1);
        TextDrawLetterSize(hoehe[i],0.299999,1.000000);
        TextDrawColor(hoehe[i],0xffffffff);
        TextDrawSetOutline(hoehe[i],1);
        TextDrawSetProportional(hoehe[i],1);
        TextDrawSetShadow(hoehe[i],1);

        zustand[i] = TextDrawCreate(345.000000,408.000000," ");
        TextDrawAlignment(zustand[i],0);
        TextDrawBackgroundColor(zustand[i],0x000000ff);
        TextDrawFont(zustand[i],1);
        TextDrawLetterSize(zustand[i],0.299999,1.000000);
        TextDrawColor(zustand[i],0xffffffff);
        TextDrawSetOutline(zustand[i],1);
        TextDrawSetProportional(zustand[i],1);
        TextDrawSetShadow(zustand[i],1);
    }
//=============================================================
Em qualquer lugar:

public AtualizarVeloVictor(playerid)
{
    new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
    new Float:PlayerSpeedDistance,value;
    new Float:Speedo_HP;


    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
        {
            GetPlayerPos(i, Speedo_X, Speedo_Y, Speedo_Z);
            GetPlayerVehicleID(i);
            GetVehicleHealth(GetPlayerVehicleID(i), Speedo_HP);
            PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(Speedo_X,SavePlayerPosV[i][sX])),2)+floatpower(floatabs(floatsub(Speedo_Y,SavePlayerPosV[i][sY])),2)+floatpower(floatabs(floatsub(Speedo_Z,SavePlayerPosV[i][sZ])),2));
            value = floatround(PlayerSpeedDistance * 5000);
            new vehicle = GetPlayerVehicleID(i);
            new str1[256],str2[256],str3[256],str4[256];
            if(SpeedoON[i] == 0)
            {
                TextDrawShowForPlayer(i, box[i]);
                //TextDrawShowForPlayer(i, tacho[i]);
                TextDrawShowForPlayer(i, fahrzeug[i]);
                TextDrawShowForPlayer(i, kmh[i]);
                TextDrawShowForPlayer(i, hoehe[i]);
                TextDrawShowForPlayer(i, zustand[i]);
                SpeedoON[i] = 1;
            }
            new kmh_anzahl = floatround(value/1600);

            format(str1,sizeof(str1),"Veiculo: ~r~%s",vehName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
            TextDrawSetString(fahrzeug[i], str1);

            if(kmh_anzahl >= 150)
            {
                format(str2,sizeof(str2),"KM/H: ~g~%d",kmh_anzahl);
                TextDrawSetString(kmh[i], str2);
            }
            else if(kmh_anzahl >= 100)
            {
                format(str2,sizeof(str2),"KM/H: ~r~%d",kmh_anzahl);
                TextDrawSetString(kmh[i], str2);
            }
            else if(kmh_anzahl >= 50)
            {
                format(str2,sizeof(str2),"KM/H: ~r~%d",kmh_anzahl);
                TextDrawSetString(kmh[i], str2);
            }
            else
            {
                format(str2,sizeof(str2),"KM/H: ~r~%d",kmh_anzahl);
                TextDrawSetString(kmh[i], str2);
            }

            format(str3,sizeof(str3),"Combustivel: ~r~%d%", Gas[vehicle]);
            TextDrawSetString(hoehe[i], str3);

            if(Speedo_HP >= 551)
            {
                format(str4,sizeof(str4),"Lataria: ~r~%0.0f%%", Speedo_HP/10);
                TextDrawSetString(zustand[i], str4);
            }
            else if(Speedo_HP >= 361)
            {
                format(str4,sizeof(str4),"Lataria: ~r~%0.0f%%", Speedo_HP/10);
                TextDrawSetString(zustand[i], str4);
            }
            else
            {
                format(str4,sizeof(str4),"Lataria: ~r~%0.0f%%", Speedo_HP/10);
                TextDrawSetString(zustand[i], str4);
            }
        }
        SavePlayerPosV[i][sX] = Speedo_X, SavePlayerPosV[i][sY] = Speedo_Y, SavePlayerPosV[i][sZ] = Speedo_Z;
    }
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerInAnyVehicle(i))
        {
            TextDrawHideForPlayer(i, box[i]); TextDrawHideForPlayer(i, tacho[i]); TextDrawHideForPlayer(i, fahrzeug[i]); TextDrawHideForPlayer(i, kmh[i]);
            TextDrawHideForPlayer(i, hoehe[i]); TextDrawHideForPlayer(i, zustand[i]); TextDrawHideForPlayer(i, forum[i]);
            SpeedoON[i] = 0;
        }
    }
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(spawnado[i] == 1)
            {
                if(SpeedoON[i] == 1)
                {
                }
                if(SpeedoON[i] == 0)
                {
                }
            }
        }
    }
}
Reply


Messages In This Thread
[Ajuda]Velocimetro a milhгo! - by roginho_97 - 16.10.2010, 14:17
Re: [Ajuda]Velocimetro a milhгo! - by pedro xD~ - 16.10.2010, 16:20
Re: [Ajuda]Velocimetro a milhгo! - by roginho_97 - 16.10.2010, 16:37
Re: [Ajuda]Velocimetro a milhгo! - by HigorOliverr - 16.10.2010, 16:49
Re: [Ajuda]Velocimetro a milhгo! - by roginho_97 - 16.10.2010, 17:08
Respuesta: [Ajuda]Velocimetro a milhгo! - by Serial_Killer - 16.10.2010, 17:21
Re: [Ajuda]Velocimetro a milhгo! - by roginho_97 - 16.10.2010, 17:44
Re: [Ajuda]Velocimetro a milhгo! - by jonas_gabriel - 16.10.2010, 18:59
Respuesta: [Ajuda]Velocimetro a milhгo! - by Serial_Killer - 16.10.2010, 20:17
Re: [Ajuda]Velocimetro a milhгo! - by roginho_97 - 16.10.2010, 20:29

Forum Jump:


Users browsing this thread: 1 Guest(s)