pawn Код:
public speedometer()
{
new Float:Speed;
new vehicleid;
new playerid;
new string[20];
for(playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(SpeedProgress[playerid] != INVALID_BAR_ID)
{
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleSpeed(vehicleid, Speed);
format(string, sizeof(string), "Velocidade: %i km/h", floatround(Speed));
SetProgressBarValue(SpeedProgress[playerid], Speed);
TextDrawSetString(SpeedProgressMsg[playerid], string);
TextDrawShowForPlayer(playerid, SpeedProgressMsg[playerid]);
UpdateProgressBar(SpeedProgress[playerid], playerid);
}
}
return 1;
}
ve a assinatura dele... tem la o link da comunidade
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;
}