[Ajuda] Velocнmetro nгo aparece
#1

[CENTER]
Ola Amigos estou com um problema aqui no Gm
Acontece que quando entro no carro nгo aparece o velocнmetro, o sistema de gasolina, velocidade tudo pega so que nгo aparece na tela.
Irei postar o code pra vocкs
Код:
//Velocimetro 
new Text:box,Text:box1,Text:box2,Text:box3,Text:box4,Text:box5,Text:tacho[MAX_PLAYERS],Text:VeInfo[MAX_PLAYERS],Text:kmhor[MAX_PLAYERS];
new Text:GazoInfo[MAX_PLAYERS],Text:LataInfo[MAX_PLAYERS],Text:TempoGasInfo[MAX_PLAYERS],Text:LocalInf[MAX_PLAYERS],Text:SpedUrl;
Код:
	SetTimer("Velocimetro", 700, 1);
Код:
// • Velocimetro por - Alex_Killer
	box = TextDrawCreate(146.000000, 342.000000, "_");
	TextDrawBackgroundColor(box, 255);
	TextDrawFont(box, 1);
	TextDrawLetterSize(box, 0.280000, 8.899999);
	TextDrawColor(box, -1);
	TextDrawSetOutline(box, 0);
	TextDrawSetProportional(box, 1);
	TextDrawSetShadow(box, 1);
	TextDrawUseBox(box, 1);
	TextDrawBoxColor(box, 0x00000045);
	TextDrawTextSize(box, 320.000000, 11.000000);

	box1 = TextDrawCreate(146.000000, 342.000000, "_");
	TextDrawBackgroundColor(box1, 255);
	TextDrawFont(box1, 1);
	TextDrawLetterSize(box1, 0.280000, 8.899999);
	TextDrawColor(box1, -1);
	TextDrawSetOutline(box1, 0);
	TextDrawSetProportional(box1, 1);
	TextDrawSetShadow(box1, 1);
	TextDrawUseBox(box1, 1);
	TextDrawBoxColor(box1, 0x1E90FF25);
	TextDrawTextSize(box1, 140.000000, 11.000000);

	box2 = TextDrawCreate(326.000000, 342.000000, "_");
	TextDrawBackgroundColor(box2, 255);
	TextDrawFont(box2, 1);
	TextDrawLetterSize(box2, 0.280000, 8.899999);
	TextDrawColor(box2, -1);
	TextDrawSetOutline(box2, 0);
	TextDrawSetProportional(box2, 1);
	TextDrawSetShadow(box2, 1);
	TextDrawUseBox(box2, 1);
	TextDrawBoxColor(box2, 0x1E90FF25);
	TextDrawTextSize(box2, 320.000000, 11.000000);

	box3 = TextDrawCreate(146.000000, 342.000000, "_");
	TextDrawBackgroundColor(box3, 255);
	TextDrawFont(box3, 1);
	TextDrawLetterSize(box3, 0.280000, -0.200000);
	TextDrawColor(box3, -1);
	TextDrawSetOutline(box3, 0);
	TextDrawSetProportional(box3, 1);
	TextDrawSetShadow(box3, 1);
	TextDrawUseBox(box3, 1);
	TextDrawBoxColor(box3, 0x1E90FF25);
	TextDrawTextSize(box3, 320.000000, 11.000000);

	box4 = TextDrawCreate(146.000000, 424.000000, "_");
	TextDrawBackgroundColor(box4, 255);
	TextDrawFont(box4, 1);
	TextDrawLetterSize(box4, 0.280000, -0.200000);
	TextDrawColor(box4, -1);
	TextDrawSetOutline(box4, 0);
	TextDrawSetProportional(box4, 1);
	TextDrawSetShadow(box4, 1);
	TextDrawUseBox(box4, 1);
	TextDrawBoxColor(box4, 0x1E90FF25);
	TextDrawTextSize(box4, 320.000000, 11.000000);

	box5 = TextDrawCreate(146.000000, 343.000000, "VELOCIMETRO");
	TextDrawBackgroundColor(box5, 255);
	TextDrawFont(box5, 2);
	TextDrawLetterSize(box5, 0.300000, 1.100000);
	TextDrawColor(box5, -1);
	TextDrawSetOutline(box5, 0);
	TextDrawSetProportional(box5, 1);
	TextDrawSetShadow(box5, 1);
	TextDrawUseBox(box5, 1);
	TextDrawBoxColor(box5, 0x1E90FF25);
	TextDrawTextSize(box5, 320.000000, 1.000000);

    for(new j=0; j<MaiorID; j++)
    {
		TextPosto[j] = TextDrawCreate(450.000000, 180.000000, "_");
		TextDrawBackgroundColor(TextPosto[j], 255);
		TextDrawFont(TextPosto[j], 3);
		TextDrawLetterSize(TextPosto[j], 0.299999,1.000000);
		TextDrawColor(TextPosto[j], -1);
		TextDrawSetOutline(TextPosto[j], 1);
		TextDrawSetProportional(TextPosto[j], 1);

		VeInfo[j] = TextDrawCreate(149.000000, 356.000000, "Veiculo: ~b~~h~Turismo");
		TextDrawBackgroundColor(VeInfo[j], 255);
		TextDrawFont(VeInfo[j], 2);
		TextDrawLetterSize(VeInfo[j], 0.300000, 1.100000);
		TextDrawColor(VeInfo[j], -1);
		TextDrawSetOutline(VeInfo[j], 0);
		TextDrawSetProportional(VeInfo[j], 1);
		TextDrawSetShadow(VeInfo[j], 1);

        kmhor[j] = TextDrawCreate(149.000000, 365.000000, "VELOCIDADE: 100 ~r~~h~KM/H");
        TextDrawBackgroundColor(kmhor[j], 255);
        TextDrawFont(kmhor[j], 2);
        TextDrawLetterSize(kmhor[j], 0.300000, 1.100000);
        TextDrawColor(kmhor[j], -1);
        TextDrawSetOutline(kmhor[j], 0);
        TextDrawSetProportional(kmhor[j], 1);
        TextDrawSetShadow(kmhor[j], 1);

        LataInfo[j] = TextDrawCreate(149.000000, 374.000000, "LATARIA: ~b~~h~100");
        TextDrawBackgroundColor(LataInfo[j], 255);
        TextDrawFont(LataInfo[j], 2);
        TextDrawLetterSize(LataInfo[j], 0.300000, 1.100000);
        TextDrawColor(LataInfo[j], -1);
        TextDrawSetOutline(LataInfo[j], 0);
        TextDrawSetProportional(LataInfo[j], 1);
        TextDrawSetShadow(LataInfo[j], 1);

        TempoGasInfo[j] = TextDrawCreate(145.000000,385.000000, "~w~Gas Tempo: ~p~~h~100 Min");
        TextDrawBackgroundColor(TempoGasInfo[j], 255);
        TextDrawFont(TempoGasInfo[j], 3);
        TextDrawLetterSize(TempoGasInfo[j], 0.299999,1.000000);
        TextDrawColor(TempoGasInfo[j], 16711935);
        TextDrawSetOutline(TempoGasInfo[j], 1);
        TextDrawSetProportional(TempoGasInfo[j], 1);

        GazoInfo[j] = TextDrawCreate(149.000000, 384.000000, "Litros Gasolina: ~b~~h~~h~100");
        TextDrawBackgroundColor(GazoInfo[j], 255);
        TextDrawFont(GazoInfo[j], 2);
        TextDrawLetterSize(GazoInfo[j], 0.300000, 1.100000);
        TextDrawColor(GazoInfo[j], -1);
        TextDrawSetOutline(GazoInfo[j], 0);
        TextDrawSetProportional(GazoInfo[j], 1);
        TextDrawSetShadow(GazoInfo[j], 1);

        LocalInf[j] = TextDrawCreate(149.000000, 398.000000, "Localizacao:~n~~b~~h~~h~Los Santos");
        TextDrawBackgroundColor(LocalInf[j], 255);
        TextDrawFont(LocalInf[j], 2);
        TextDrawLetterSize(LocalInf[j], 0.300000, 1.100000);
        TextDrawColor(LocalInf[j], -1);
        TextDrawSetOutline(LocalInf[j], 0);
        TextDrawSetProportional(LocalInf[j], 1);
        TextDrawSetShadow(LocalInf[j], 1);
    	}
Код:
forward Velocimetro(playerid);
public Velocimetro()
{
    new Float:Speedo_HP;
    new str1[128],str2[128],str3[128],str4[128];
    new GasEtempo[MAX_PLAYERS],ResultOwn[MAX_PLAYERS];
    for(new i=0; i<MaiorID; i++)
	{
 		new vehicle = GetPlayerVehicleID(i);
        GetVehicleHealth(vehicle, Speedo_HP);
		if(gPlayerLogged[i] == 1 && IsPlayerInAnyVehicle(i))
		{
			if(TextShow[i] == false)
			{
				TextDrawShowForPlayer(i, box);
				TextDrawShowForPlayer(i, box1);
				TextDrawShowForPlayer(i, box2);
				TextDrawShowForPlayer(i, box3);
				TextDrawShowForPlayer(i, box4);
				TextDrawShowForPlayer(i, box5);
				TextDrawShowForPlayer(i, VeInfo[i]);
				TextDrawShowForPlayer(i, kmhor[i]);
				TextDrawShowForPlayer(i, GazoInfo[i]);
				TextDrawShowForPlayer(i, LataInfo[i]);
				//TextDrawShowForPlayer(i, TempoGasInfo[i]);
				TextDrawShowForPlayer(i, LocalInf[i]);
                TextDrawShowForPlayer(i, SpedUrl);
				TextShow[i] = true;
            }
            //veiculo
            format(str1,sizeof(str1),"~w~Veiculo:~g~~h~~h~ %s",vehName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
			TextDrawSetString(VeInfo[i], str1);
			/*if(GetPlayerSpeed(i, true) >= 150)
			{
				format(str2,sizeof(str2),"~>~~w~Velocidade: ~r~%d KM/H",GetPlayerSpeed(i, true));
				TextDrawSetString(kmhor[i], str2);
 			}  */
            //velocidade
            if(GetPlayerSpeed(i, true) >= 150)
 			{
				format(str2,sizeof(str2),"~w~Velocidade:~w~ %d ~r~~h~KM/H",GetPlayerSpeed(i, true));
				TextDrawSetString(kmhor[i], str2);
 			}
 			else
 			{
    			format(str2,sizeof(str2),"~w~Velocidade:~w~ %d ~g~~h~~h~KM/H",GetPlayerSpeed(i, true));
				TextDrawSetString(kmhor[i], str2);
 			}
            // Start do carro
            if(Speedo_HP >= 551)
			{
				format(str4,sizeof(str4),"~w~Lataria:~w~ %0.0f%%", Speedo_HP/10);
				TextDrawSetString(LataInfo[i], str4);
 			}
 			else if(Speedo_HP >= 361)
 			{
    			format(str4,sizeof(str4),"~w~Lataria:~w~ %0.0f%%", Speedo_HP/10);
				TextDrawSetString(LataInfo[i], str4);
 			}
 			else
 			{
    			format(str4,sizeof(str4),"~w~Lataria:~r~~h~ %0.0f%%", Speedo_HP/10);
				TextDrawSetString(LataInfo[i], str4);
 			}
            // inf tempo gas
            GasEtempo[i] = Gas[vehicle]*18;
            ResultOwn[i] = GasEtempo[i]/60;
            if(ResultOwn[i] > 5)
 			{
				format(str4,sizeof(str4),"~w~Gas Tempo:~w~ %d ~g~~h~~h~Min", ResultOwn[i]);
				TextDrawSetString(TempoGasInfo[i], str4);
 			}
            else
 			{
				format(str4,sizeof(str4),"~w~Gas Tempo:~w~ %d ~g~~h~~h~Min", ResultOwn[i]);
				TextDrawSetString(TempoGasInfo[i], str4);
 			}
            // combustivel
            if(Gas[vehicle] >= 20)
			{
                format(str3,sizeof(str3),"~w~Combustivel:~w~ %d", Gas[vehicle]);
			    TextDrawSetString(GazoInfo[i], str3);
 			}
 			else if(Gas[vehicle] < 20)
 			{
                format(str3,sizeof(str3),"~w~Combustivel:~w~ %d", Gas[vehicle]);
			    TextDrawSetString(GazoInfo[i], str3);
 			}
 			else
 			{
                format(str3,sizeof(str3),"~b~~h~~h~~h~Combustivel:~r~~h~ %d", Gas[vehicle]);
			    TextDrawSetString(GazoInfo[i], str3);
 			}
			format(str4,sizeof(str4),"~b~~h~~h~~h~Local: ~w~%s",ReturnPlayerZone(i));
			TextDrawSetString(LocalInf[i], str4);
		}
		else
		{
		    if(TextShow[i] == true)
		    {
                TextDrawHideForPlayer(i, box);
				TextDrawHideForPlayer(i, box1);
				TextDrawHideForPlayer(i, box2);
				TextDrawHideForPlayer(i, box3);
				TextDrawHideForPlayer(i, box4);
				TextDrawHideForPlayer(i, box5);
                TextDrawHideForPlayer(i, tacho[i]);
                TextDrawHideForPlayer(i, VeInfo[i]);
                TextDrawHideForPlayer(i, kmhor[i]);
                TextDrawHideForPlayer(i, GazoInfo[i]);
                TextDrawHideForPlayer(i, LataInfo[i]);
                TextDrawHideForPlayer(i, TempoGasInfo[i]);
                TextDrawHideForPlayer(i, LocalInf[i]);
                TextDrawHideForPlayer(i, SpedUrl);
			    TextShow[i] = false;
			}
		}
	}
}
Espero que possam ajuda Obrigado
Reply
#2

man tira o () e coloca (playerid) na "public Velocimetro"

Ex:
PHP код:
public Velocimetro(playerid
Reply
#3

Valew, Mais nгo resolveu meu problema
Reply
#4

Quote:
Originally Posted by marcos_orkut
Посмотреть сообщение
Valew, Mais nгo resolveu meu problema
Adicione na public OnPlayerEnterVehicle

PHP код:
Velocimetro(playerid); 
Reply
#5

Nгo Foi
Reply
#6

Este code esta no seu GM ou FS?
Reply
#7

no GM
Reply
#8

PHP код:
public OnGameModeInit()
{
     
SetTimer("Velocimentro"300true);
     return 
1;
}
forward Velocimetro();
public 
Velocimetro()
{
    new 
FloatSpeedo_HP;
    new 
str1[128], str2[128], str3[128], str4[128];
    new 
GasEtempo[MAX_PLAYERS], ResultOwn[MAX_PLAYERS];
    for (new 
0MaiorIDi++)
    {
        new 
vehicle GetPlayerVehicleID(i);
        
GetVehicleHealth(vehicleSpeedo_HP);
        if (
gPlayerLogged[i] == && IsPlayerInAnyVehicle(i))
        {
            if (
TextShow[i] == false)
            {
                
TextDrawShowForPlayer(ibox);
                
TextDrawShowForPlayer(ibox1);
                
TextDrawShowForPlayer(ibox2);
                
TextDrawShowForPlayer(ibox3);
                
TextDrawShowForPlayer(ibox4);
                
TextDrawShowForPlayer(ibox5);
                
TextDrawShowForPlayer(iVeInfo[i]);
                
TextDrawShowForPlayer(ikmhor[i]);
                
TextDrawShowForPlayer(iGazoInfo[i]);
                
TextDrawShowForPlayer(iLataInfo[i]);
                
//TextDrawShowForPlayer(i, TempoGasInfo[i]);
                
TextDrawShowForPlayer(iLocalInf[i]);
                
TextDrawShowForPlayer(iSpedUrl);
                
TextShow[i] = true;
            }
            
//veiculo
            
format(str1sizeof(str1), "~w~Veiculo:~g~~h~~h~ %s"vehName[GetVehicleModel(GetPlayerVehicleID(i)) - 400]);
            
TextDrawSetString(VeInfo[i], str1);
/*if(GetPlayerSpeed(i, true) >= 150)
            {
                format(str2,sizeof(str2),"~>~~w~Velocidade: ~r~%d KM/H",GetPlayerSpeed(i, true));
                TextDrawSetString(kmhor[i], str2);
             }  */
            //velocidade
            
if (GetPlayerSpeed(itrue) >= 150)
            {
                
format(str2sizeof(str2), "~w~Velocidade:~w~ %d ~r~~h~KM/H"GetPlayerSpeed(itrue));
                
TextDrawSetString(kmhor[i], str2);
            }
            else
            {
                
format(str2sizeof(str2), "~w~Velocidade:~w~ %d ~g~~h~~h~KM/H"GetPlayerSpeed(itrue));
                
TextDrawSetString(kmhor[i], str2);
            }
            
// Start do carro
            
if (Speedo_HP >= 551)
            {
                
format(str4sizeof(str4), "~w~Lataria:~w~ %0.0f%%"Speedo_HP 10);
                
TextDrawSetString(LataInfo[i], str4);
            }
            else if (
Speedo_HP >= 361)
            {
                
format(str4sizeof(str4), "~w~Lataria:~w~ %0.0f%%"Speedo_HP 10);
                
TextDrawSetString(LataInfo[i], str4);
            }
            else
            {
                
format(str4sizeof(str4), "~w~Lataria:~r~~h~ %0.0f%%"Speedo_HP 10);
                
TextDrawSetString(LataInfo[i], str4);
            }
            
// inf tempo gas
            
GasEtempo[i] = Gas[vehicle] * 18;
            
ResultOwn[i] = GasEtempo[i] / 60;
            if (
ResultOwn[i] > 5)
            {
                
format(str4sizeof(str4), "~w~Gas Tempo:~w~ %d ~g~~h~~h~Min"ResultOwn[i]);
                
TextDrawSetString(TempoGasInfo[i], str4);
            }
            else
            {
                
format(str4sizeof(str4), "~w~Gas Tempo:~w~ %d ~g~~h~~h~Min"ResultOwn[i]);
                
TextDrawSetString(TempoGasInfo[i], str4);
            }
            
// combustivel
            
if (Gas[vehicle] >= 20)
            {
                
format(str3sizeof(str3), "~w~Combustivel:~w~ %d"Gas[vehicle]);
                
TextDrawSetString(GazoInfo[i], str3);
            }
            else if (
Gas[vehicle] < 20)
            {
                
format(str3sizeof(str3), "~w~Combustivel:~w~ %d"Gas[vehicle]);
                
TextDrawSetString(GazoInfo[i], str3);
            }
            else
            {
                
format(str3sizeof(str3), "~b~~h~~h~~h~Combustivel:~r~~h~ %d"Gas[vehicle]);
                
TextDrawSetString(GazoInfo[i], str3);
            }
            
format(str4sizeof(str4), "~b~~h~~h~~h~Local: ~w~%s"ReturnPlayerZone(i));
            
TextDrawSetString(LocalInf[i], str4);
        }
        else
        {
            if (
TextShow[i] == true)
            {
                
TextDrawHideForPlayer(ibox);
                
TextDrawHideForPlayer(ibox1);
                
TextDrawHideForPlayer(ibox2);
                
TextDrawHideForPlayer(ibox3);
                
TextDrawHideForPlayer(ibox4);
                
TextDrawHideForPlayer(ibox5);
                
TextDrawHideForPlayer(itacho[i]);
                
TextDrawHideForPlayer(iVeInfo[i]);
                
TextDrawHideForPlayer(ikmhor[i]);
                
TextDrawHideForPlayer(iGazoInfo[i]);
                
TextDrawHideForPlayer(iLataInfo[i]);
                
TextDrawHideForPlayer(iTempoGasInfo[i]);
                
TextDrawHideForPlayer(iLocalInf[i]);
                
TextDrawHideForPlayer(iSpedUrl);
                
TextShow[i] = false;
            }
        }
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)