SA-MP Forums Archive
[Ajuda] Coloquei Velocimetro no meu gm e entro no carro e nao aparece - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Coloquei Velocimetro no meu gm e entro no carro e nao aparece (/showthread.php?tid=495369)



Coloquei Velocimetro no meu gm e entro no carro e nao aparece - GustavoG3D - 17.02.2014

Codigos agora entro no carro e nao aparece
Observe coloquei todas new !
PHP код:
public Velocimetro()
{
    new 
Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
    new 
Float:PlayerSpeedDistance,value;
    new 
Float:Speedo_HP;
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
        {
            
GetPlayerPos(iSpeedo_XSpeedo_YSpeedo_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(ibox[i]);
                
//TextDrawShowForPlayer(i, tacho[i]);
                
TextDrawShowForPlayer(ifahrzeug[i]);
                
TextDrawShowForPlayer(ikmh[i]);
                
TextDrawShowForPlayer(ihoehe[i]);
                
TextDrawShowForPlayer(izustand[i]);
                
TextDrawHideForPlayer(iforum[i]);
            }
            new 
kmh_anzahl floatround(value/1600);
            
format(str1,sizeof(str1),"~d~ Veiculo: ~p~%s            ~n~~n~~n~        ~g~|~y~|~b~|~w~www.~g~brasil~y~style~b~city~w~.com~g~|~y~|~b~|",vehName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
            
TextDrawSetString(fahrzeug[i], str1);
            if(
kmh_anzahl >= 150)
            {
                
format(str2,sizeof(str2),"~d~ KM/H: ~g~%d",kmh_anzahl);
                
TextDrawSetString(kmh[i], str2);
            }
            else if(
kmh_anzahl >= 100)
            {
                
format(str2,sizeof(str2),"~d~ KM/H: ~g~%d",kmh_anzahl);
                
TextDrawSetString(kmh[i], str2);
            }
            else if(
kmh_anzahl >= 50)
            {
                
format(str2,sizeof(str2),"~d~ KM/H: ~g~%d",kmh_anzahl);
                
TextDrawSetString(kmh[i], str2);
            }
            else
            {
                
format(str2,sizeof(str2),"~d~ KM/H: ~g~%d",kmh_anzahl);
                
TextDrawSetString(kmh[i], str2);
            }
            
format(str3,sizeof(str3),"~d~ Combustivel: ~p~%d%"Gas[vehicle]);
            
TextDrawSetString(hoehe[i], str3);
            if(
Speedo_HP >= 551)
            {
                
format(str4,sizeof(str4),"~d~ Lataria: ~y~%0.0f%%"Speedo_HP/10);
                
TextDrawSetString(zustand[i], str4);
            }
            else if(
Speedo_HP >= 361)
            {
                
format(str4,sizeof(str4),"~d~ Lataria: ~y~%0.0f%%"Speedo_HP/10);
                
TextDrawSetString(zustand[i], str4);
            }
            else if(
Speedo_HP >= 250)
            {
                
format(str4,sizeof(str4),"~d~ Lataria: ~y~%0.0f%%"Speedo_HP/10);
                
TextDrawSetString(zustand[i], str4);
            }
            else
            {
                
format(str4,sizeof(str4),"~d~ Lataria: ~y~%0.0f%%"Speedo_HP/10);
                
TextDrawSetString(zustand[i], str4);
            }
        }
        
SavePlayerPosV[i][sX] = Speedo_XSavePlayerPosV[i][sY] = Speedo_YSavePlayerPosV[i][sZ] = Speedo_Z;
    }
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(!
IsPlayerInAnyVehicle(i))
        {
            
TextDrawHideForPlayer(ibox[i]); TextDrawHideForPlayer(ifahrzeug[i]); TextDrawHideForPlayer(ikmh[i]);
            
TextDrawHideForPlayer(ihoehe[i]); TextDrawHideForPlayer(izustand[i]);TextDrawShowForPlayer(iforum[i]);
            
SpeedoON[i] = 0;
        }
    }




Re: Coloquei Velocimetro no meu gm e entro no carro e nao aparece - ForT - 17.02.2014

Vocк colocou o
pawn Код:
SetTimer("Velocimetro", 1000, 1);
no OnGameModeInit?


Re: Coloquei Velocimetro no meu gm e entro no carro e nao aparece - GustavoG3D - 17.02.2014

Pior que sim vc pode colocar em FS?
e me mandar por favor ? ta dificio aqui


Re: Coloquei Velocimetro no meu gm e entro no carro e nao aparece - Dieguinho - 17.02.2014

colocou em MAX_PLayers ??


assim

pawn Код:
// Velocimetro
new Text:box          [ MAX_PLAYERS ];
new Text:fahrzeug     [ MAX_PLAYERS ];
new Text:zustand      [ MAX_PLAYERS ];
new SpeedoON          [ MAX_PLAYERS ];
new spawnado          [ MAX_PLAYERS ];



Re: Coloquei Velocimetro no meu gm e entro no carro e nao aparece - GustavoG3D - 17.02.2014

Sim coloquei menos o spawnado
alguem ajuda poe em FS pra min por favor


Respuesta: Re: Coloquei Velocimetro no meu gm e entro no carro e nao aparece - cantiliano - 17.02.2014

pawn Код:
public OnPlayerStateChange ( playerid , newstate , oldstate )
{
    if( newstate == PLAYER_STATE_DRIVER )
    {
        TextDrawShowForPlayer(playerid, box[playerid]);
        TextDrawShowForPlayer(playerid, fahrzeug[playerid]);
        TextDrawShowForPlayer(playerid, kmh[playerid]);
        TextDrawShowForPlayer(playerid, hoehe[playerid]);
        TextDrawShowForPlayer(playerid, zustand[playerid]);
        TextDrawShowForPlayer(playerid, forum[playerid]);
    }

    if( newstate == PLAYER_STATE_ONFOOT )
    {
        TextDrawHideForPlayer(playerid, box[playerid]);
        TextDrawHideForPlayer(playerid, fahrzeug[playerid]);
        TextDrawHideForPlayer(playerid, kmh[playerid]);
        TextDrawHideForPlayer(playerid, hoehe[playerid]);
        TextDrawHideForPlayer(playerid, zustand[playerid]);
        TextDrawHideForPlayer(playerid, forum[playerid]);
    }
    return 1;
}

public Velocimetro()
{
    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];

            new kmh_anzahl = floatround(value/1600);
            format(str1,sizeof(str1),"~d~ Veiculo: ~p~%s            ~n~~n~~n~        ~g~|~y~|~b~|~w~www.~g~brasil~y~style~b~city~w~.com~g~|~y~|~b~|",vehName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
            TextDrawSetString(fahrzeug[i], str1);
            if(kmh_anzahl >= 150)
            {
                format(str2,sizeof(str2),"~d~ KM/H: ~g~%d",kmh_anzahl);
                TextDrawSetString(kmh[i], str2);
            }
            else if(kmh_anzahl >= 100)
            {
                format(str2,sizeof(str2),"~d~ KM/H: ~g~%d",kmh_anzahl);
                TextDrawSetString(kmh[i], str2);
            }
            else if(kmh_anzahl >= 50)
            {
                format(str2,sizeof(str2),"~d~ KM/H: ~g~%d",kmh_anzahl);
                TextDrawSetString(kmh[i], str2);
            }
            else
            {
                format(str2,sizeof(str2),"~d~ KM/H: ~g~%d",kmh_anzahl);
                TextDrawSetString(kmh[i], str2);
            }

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

            if(Speedo_HP >= 551)
            {
                format(str4,sizeof(str4),"~d~ Lataria: ~y~%0.0f%%", Speedo_HP/10);
                TextDrawSetString(zustand[i], str4);
            }
            else if(Speedo_HP >= 361)
            {
                format(str4,sizeof(str4),"~d~ Lataria: ~y~%0.0f%%", Speedo_HP/10);
                TextDrawSetString(zustand[i], str4);
            }
            else if(Speedo_HP >= 250)
            {
                format(str4,sizeof(str4),"~d~ Lataria: ~y~%0.0f%%", Speedo_HP/10);
                TextDrawSetString(zustand[i], str4);
            }
            else
            {
                format(str4,sizeof(str4),"~d~ Lataria: ~y~%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, fahrzeug[i]); TextDrawHideForPlayer(i, kmh[i]);
            TextDrawHideForPlayer(i, hoehe[i]); TextDrawHideForPlayer(i, zustand[i]);TextDrawShowForPlayer(i, forum[i]);
            SpeedoON[i] = 0;
        }
    }
}



Re: Coloquei Velocimetro no meu gm e entro no carro e nao aparece - OrNot - 17.02.2014

manda seu skype diegin