[Resolvido]
#8

Toma...:

Topo do GM:

pawn Код:
forward Speedometer();

em OnGameModeInit:


pawn Код:
SetTimer("Speedometer", 1000, true);

pawn Код:
public Speedometer()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
    {
      new State = GetPlayerState(i);
        if(State == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle(i))
      {
        #define MULTIPLY_SPEED 4
        new carid = GetPlayerVehicleID(i);
            new VehicleModel = GetVehicleModel(GetPlayerVehicleID(i));

            new Float:x, Float:y, Float:z, Float:health, string[256]; TextDrawDestroy(black); TextDrawDestroy(Speedom[i]);
            GetPlayerPos(i, x, y, z); GetVehicleHealth(GetPlayerVehicleID(i), health);
            new Float:Dis = floatsqroot(floatpower(floatabs(floatsub(OldCoordsX[i],x)),2) + floatpower(floatabs(floatsub(OldCoordsY[i],y)),2));

            if(VehicleModel==509||VehicleModel==481||VehicleModel==510) { SetVehicleHealth(GetPlayerVehicleID(i), 1000); Gas[carid] = 100; }
            if(VehicleModel==520||VehicleModel==476||VehicleModel==593||VehicleModel==553||VehicleModel==513||VehicleModel==512||VehicleModel==577||VehicleModel==592||VehicleModel==511||VehicleModel==539||VehicleModel==464||VehicleModel==519) { Gas[carid] = 100; }
            new speed = (floatround(Dis)*MULTIPLY_SPEED);

      new Sspeed[15];

        if( speed == 0) {
                format(Sspeed,sizeof(Sspeed),"~w~%dKm/H",(floatround(Dis)*MULTIPLY_SPEED));
          } else if( speed >= 1 && speed <= 60 ){
            format(Sspeed,sizeof(Sspeed),"~W~%dKm/H",(floatround(Dis)*MULTIPLY_SPEED));

          } else if( speed >= 61 && speed <= 120 ){
            format(Sspeed,sizeof(Sspeed),"~R~%dKm/H",(floatround(Dis)*MULTIPLY_SPEED));

          } else {
                format(Sspeed,sizeof(Sspeed),"~R~%dKm/H",(floatround(Dis)*MULTIPLY_SPEED));

          }
      new Ggas[30];
            if(VehicleModel==509||VehicleModel==481||VehicleModel==510)

            {format(Ggas,sizeof(Ggas),"~G~N/A");}
        if( Gas[carid] == 0) {
                format(Ggas,sizeof(Ggas),"~R~Vazio");
          } else if( Gas[carid]<= 20){
            format(Ggas,sizeof(Ggas),"~R~%d",(Gas[carid]));

          } else if( Gas[carid] >= 21 && Gas[carid]<=100){
            format(Ggas,sizeof(Ggas),"~w~%d",(Gas[carid]));

          }

      /*new Ggas[30];
            if(VehicleModel==509||VehicleModel==481||VehicleModel==510)

            {format(Ggas,sizeof(Ggas),"~G~N/A");}
        if( Gas[carid] == 0) {
                format(Ggas,sizeof(Ggas),"~R~Vazio");
          } else if( Gas[carid]<= 20){
            format(Sspeed,sizeof(Sspeed),"~R~%.3f",(Gas[carid]));

          } else if( Gas[carid] > 20){
            format(Sspeed,sizeof(Sspeed),"~G~%.3f",(Gas[carid]));

          } */


            format(string,sizeof(string),"~g~R$:~w~%d~n~~r~Fome:%d~n~~B~Veiculo:~n~~w~%s~n~~B~Velocidade:~n~~W~%s~n~~B~Life: ~w~%.1f~n~~B~Gas:~w~ %s" ,GP[i],PlayerInfo[i][pFomee],vehName[GetVehicleModel(GetPlayerVehicleID(i))-400], Sspeed, health/10,Ggas);

            black = TextDrawCreate(494.000000,375.000000,"_");
            TextDrawTextSize(black,600.000000,0.000000);
            TextDrawAlignment(black,0);
            TextDrawFont(black,2);
            TextDrawLetterSize(black,1.700000,6.250000);
            TextDrawSetOutline(black,1);
            TextDrawSetProportional(black,1);
            TextDrawSetShadow(black,1);

            Speedom[i] = TextDrawCreate(495.000000,376.000000,string);
        TextDrawTextSize(Speedom[i],600.000000,0.000000);
            TextDrawAlignment(Speedom[i],0);
            TextDrawFont(Speedom[i],2);
            TextDrawLetterSize(Speedom[i],0.299999,1.000000);
            TextDrawSetOutline(Speedom[i],1);
            TextDrawSetProportional(Speedom[i],1);
            TextDrawSetShadow(Speedom[i],1);

            TextDrawShowForPlayer(i, black);
            TextDrawShowForPlayer(i, Speedom[i]);
            OldCoordsX[i] = x; OldCoordsY[i] = y;
        } else { TextDrawHideForPlayer(i, black); TextDrawHideForPlayer(i, Speedom[i]); }
    }
        return true;
}
Reply


Messages In This Thread
[Resolvido] - by tshadow - 23.05.2010, 12:31
Re: [ajuda]speedometer - by andmeida10 - 24.05.2010, 19:52
Re: [ajuda]speedometer - by tshadow - 24.05.2010, 20:15
Re: [ajuda]speedometer - by andmeida10 - 24.05.2010, 20:47
Re: [ajuda]speedometer - by tshadow - 25.05.2010, 18:36
Re: [ajuda]speedometer - by andmeida10 - 25.05.2010, 18:39
Re: [ajuda]speedometer - by tshadow - 25.05.2010, 19:03
Re: [ajuda]speedometer - by andmeida10 - 25.05.2010, 20:23
Re: [ajuda]speedometer - by ipsBruno - 25.05.2010, 21:43
Re: [ajuda]speedometer - by tshadow - 26.05.2010, 18:23

Forum Jump:


Users browsing this thread: 2 Guest(s)