[Ajuda] Velocimetro
#1

Pessoal eu criei uma text draw para usar com um sistema de velocнmetro, mais sу que nгo ta aparecendo as informaзхes mais sim a textdraw que eu ponhei pra ser substituнda pela string que mostra s informaзхes, e eu nгo estou conseguindo arrumar esse erro se alguйm poder me ajudar fico grato, irei deixar o cуdigo abaixo.

Код:
/text dra OnGameModeInit....
	Textdraw91 = TextDrawCreate(592.000000, 321.000000, "000");
	TextDrawBackgroundColor(Textdraw91, 255);
	TextDrawFont(Textdraw91, 1);
	TextDrawLetterSize(Textdraw91, 0.259999, 1.799999);
	TextDrawColor(Textdraw91, -16776961);
	TextDrawSetOutline(Textdraw91, 0);
	TextDrawSetProportional(Textdraw91, 1);
	TextDrawSetShadow(Textdraw91, 1);
	
	Textdraw101 = TextDrawCreate(593.000000, 338.000000, "000");
	TextDrawBackgroundColor(Textdraw101, 255);
	TextDrawFont(Textdraw101, 1);
	TextDrawLetterSize(Textdraw101, 0.300000, 1.600000);
	TextDrawColor(Textdraw101, -16776961);
	TextDrawSetOutline(Textdraw101, 0);
	TextDrawSetProportional(Textdraw101, 1);
	TextDrawSetShadow(Textdraw101, 1);

	Textdraw131 = TextDrawCreate(586.000000, 353.000000, "000");
	TextDrawBackgroundColor(Textdraw131, 255);
	TextDrawFont(Textdraw131, 1);
	TextDrawLetterSize(Textdraw13, 0.300000, 1.600000);
	TextDrawColor(Textdraw131, -16776961);
	TextDrawSetOutline(Textdraw131, 0);
	TextDrawSetProportional(Textdraw131, 1);
	TextDrawSetShadow(Textdraw131, 1);

	Textdraw141 = TextDrawCreate(586.000000, 369.000000, "000");
	TextDrawBackgroundColor(Textdraw141, 255);
	TextDrawFont(Textdraw141, 1);
	TextDrawLetterSize(Textdraw141, 0.300000, 1.600000);
	TextDrawColor(Textdraw141, -16776961);
	TextDrawSetOutline(Textdraw141, 0);
	TextDrawSetProportional(Textdraw141, 1);
	TextDrawSetShadow(Textdraw141, 1);

//OnPlayerStateChange
if(newstate == PLAYER_STATE_DRIVER)
	{
		TextDrawShowForPlayer(playerid, Textdraw91);
		TextDrawShowForPlayer(playerid, Textdraw101);
		TextDrawShowForPlayer(playerid, Textdraw131);
		TextDrawShowForPlayer(playerid, Textdraw141);
	}
	else if(oldstate == PLAYER_STATE_DRIVER)
	{
		TextDrawHideForPlayer(playerid, Textdraw91);
		TextDrawHideForPlayer(playerid, Textdraw101);
		TextDrawHideForPlayer(playerid, Textdraw131);
		TextDrawHideForPlayer(playerid, Textdraw141);
	}

// Public para Getar a as informaзхes no velocнmetro
public Speedo()
{
    for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
    {
		if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
		{
			//CHECAR VELOCIDADE
			new string[228];
			format(string,sizeof(string),"%dKM/H", VelocidadeKM(playerid));
			TextDrawSetString(Text:Textdraw91, string);
			TextDrawShowForPlayer(playerid, Textdraw91);
			//CHECAR LATARIA
			GetVehicleHealth(GetPlayerVehicleID(playerid), Lataria);
			format(string,sizeof(string),"Lataria: %0.0f%%", Lataria);
			TextDrawSetString(Textdraw131, string);
			//CHECAR VEICULO
			format(string,sizeof(string),"Veiculo: %s", Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
			TextDrawSetString(Textdraw141, string);
			// Checar gasolina
			format(string,sizeof(string),"Gasolina: %d%", Gas[GetPlayerVehicleID(playerid)]);
			TextDrawSetString(Textdraw101, string);

		}
	
	}
}
Se precisar do resto sу avisar que eu posto!.
Reply
#2

Qual bug exatamente estб ocorrendo ?
PHP код:
public Speedo()
{
    static
        
playerid
    
;
    
playerid GetMaxPlayers();
    for( ; 
playerid > -1; --playerid){
        if(
IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
        {
            
//CHECAR VELOCIDADE
            
new string[128];
            
format(string,sizeof(string),"%dKM/H"VelocidadeKM(playerid));
            
TextDrawSetString(Text:Textdraw91string);
            
TextDrawShowForPlayer(playeridTextdraw91);
            
            
//CHECAR LATARIA
            
GetVehicleHealth(GetPlayerVehicleID(playerid), Lataria);
            
format(string,sizeof(string),"Lataria: %0.0f%%"Lataria);
            
TextDrawSetString(Textdraw131string);
            
            
//CHECAR VEICULO
            
format(string,sizeof(string),"Veiculo: %s"Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            
TextDrawSetString(Textdraw141string);
            
            
// Checar gasolina
            
format(string,sizeof(string),"Gasolina: %d%"Gas[GetPlayerVehicleID(playerid)]);
            
TextDrawSetString(Textdraw101string);

        }
    }

Reply
#3

Tipo a text draw que era pra ser substituнda pela string nгo esta sendo substituнda continua 000 no velocнmetro
Reply
#4

PHP код:
public Speedo()
{
    static
        
playerid
    
;
    
playerid GetMaxPlayers();
    for( ; 
playerid > -1; --playerid){
        if(
IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
        {
            
//CHECAR VELOCIDADE
            
new string[128];
            
format(string,sizeof(string),"%dKM/H"VelocidadeKM(playerid));
            
TextDrawSetString(Text:Textdraw91string);
            
TextDrawShowForPlayer(playeridTextdraw91);
            
            
//CHECAR LATARIA
            
GetVehicleHealth(GetPlayerVehicleID(playerid), Lataria);
            
format(string,sizeof(string),"Lataria: %0.0f%%"Lataria);
            
TextDrawSetString(Textdraw131string);
            
TextDrawShowForPlayer(playeridTextdraw131);
            
            
//CHECAR VEICULO
            
format(string,sizeof(string),"Veiculo: %s"Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            
TextDrawSetString(Textdraw141string);
            
TextDrawShowForPlayer(playerid,  Textdraw141);
            
            
// Checar gasolina
            
format(string,sizeof(string),"Gasolina: %d%"Gas[GetPlayerVehicleID(playerid)]);
            
TextDrawSetString(Textdraw101string);
            
TextDrawShowForPlayer(playerid,  Textdraw101);
        }
    } 
Reply
#5

Cara olha o que acontece Imagem
Reply
#6

PHP код:
public Speedo()
{
    static
        
playerid
    
;
    
playerid GetMaxPlayers();
    for( ; 
playerid > -1; --playerid){
        if(
IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
        {
            
//CHECAR VELOCIDADE
            
new string[128];
            
format(string,sizeof(string),"%dKM/H"VelocidadeKM(playerid));
            
TextDrawSetString(Text:Textdraw91string);
            
TextDrawShowForPlayer(playeridTextdraw91);
            
            
//CHECAR LATARIA
            
GetVehicleHealth(GetPlayerVehicleID(playerid), Lataria);
            
format(string,sizeof(string),"Lataria: %0.0f%%"Lataria);
            
TextDrawSetString(Textdraw131string);
            
TextDrawShowForPlayer(playeridTextdraw131);
            
            
//CHECAR VEICULO
            
format(string,sizeof(string),"Veiculo: %s"Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            
TextDrawSetString(Textdraw141string);
            
TextDrawShowForPlayer(playerid,  Textdraw141);
            
            
// Checar gasolina
            
format(string,sizeof(string),"Gasolina: %d%"Gas[GetPlayerVehicleID(playerid)]);
            
TextDrawSetString(Textdraw101string);
            
TextDrawShowForPlayer(playerid,  Textdraw101);
        }
    }  
    return 
SetTimer("Speedo"1000true);

Colocas no OnGameModeInit()
PHP код:
Speedo(); 
Reply
#7

Garfield bugo o servidor fica lagado nгo carrega os veнculos.
Reply
#8

PHP код:
public Speedo()
{
    for(new 
playerid=0;playerid<MAX_PLAYERS;playerid++)
    {
        if(
IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
        {
            
//CHECAR VELOCIDADE
            
new string[228];
            
format(string,sizeof(string),"%02d Km/H",GetVehicleSpeed(playervehicle));
            
TextDrawSetString(Text:Textdraw91string);
            
TextDrawShowForPlayer(playeridTextdraw91);
            
//CHECAR LATARIA
            
GetVehicleHealth(GetPlayerVehicleID(playerid), Lataria);
            
format(string,sizeof(string),"Lataria: %0.0f%%"Lataria);
            
TextDrawSetString(Textdraw131string);
            
//CHECAR VEICULO
            
format(string,sizeof(string),"Veiculo: %s"Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            
TextDrawSetString(Textdraw141string);
            
// Checar gasolina
            
format(string,sizeof(string),"Gasolina: %d%"Gas[GetPlayerVehicleID(playerid)]);
            
TextDrawSetString(Textdraw101string);
        }
    }
}
stock GetVehicleSpeed(vehicleid)
{
        new 
Float:xPos[3];
        
GetVehicleVelocity(vehicleidxPos[0], xPos[1], xPos[2]);
        return 
floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 170.00);

Reply
#9

Quote:
Originally Posted by ApocaSamp
Посмотреть сообщение
PHP код:
public Speedo()
{
    for(new 
playerid=0;playerid<MAX_PLAYERS;playerid++)
    {
        if(
IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
        {
            
//CHECAR VELOCIDADE
            
new string[228];
            
format(string,sizeof(string),"%02d Km/H",GetVehicleSpeed(playervehicle));
            
TextDrawSetString(Text:Textdraw91string);
            
TextDrawShowForPlayer(playeridTextdraw91);
            
//CHECAR LATARIA
            
GetVehicleHealth(GetPlayerVehicleID(playerid), Lataria);
            
format(string,sizeof(string),"Lataria: %0.0f%%"Lataria);
            
TextDrawSetString(Textdraw131string);
            
//CHECAR VEICULO
            
format(string,sizeof(string),"Veiculo: %s"Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            
TextDrawSetString(Textdraw141string);
            
// Checar gasolina
            
format(string,sizeof(string),"Gasolina: %d%"Gas[GetPlayerVehicleID(playerid)]);
            
TextDrawSetString(Textdraw101string);
        }
    }
}
stock GetVehicleSpeed(vehicleid)
{
        new 
Float:xPos[3];
        
GetVehicleVelocity(vehicleidxPos[0], xPos[1], xPos[2]);
        return 
floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 170.00);

O tуpico й de 2012 cara.
Reply
#10

Eu nem tinha reparado huehueuhehuhu

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)