[Ajuda] Ajuda Velocimetro!
#1

Bem pego um velocimetro de Um gm e ponho no meu

do meu gm

PHP код:
public Velocimetro()
{
    new 
Float:Speedo_HP;
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
gPlayerLogged[i] == && IsPlayerInAnyVehicle(i))
        {
            new 
vehicle GetPlayerVehicleID(i);
            
GetVehicleHealth(vehicleSpeedo_HP);
            new 
string[256];
   
format(string,sizeof(string),"~>~~b~Veiculo: ~w~%s~n~~>~~p~Velocidade:~w~ %d KM/h~n~~>~~g~Combustivel: ~w~%d%%~n~~>~~r~Saude: ~w~%0.0f%%~n~~>~~y~GPS: ~w~%s" ,vehName[GetVehicleModel(vehicle)-400], GetPlayerSpeed(itrue), Gas[vehicle], Speedo_HP/10ReturnPlayerZone(i));
            
TextDrawSetString(Speed[i], string);
            if(
TextShow[i] == false)
            {
                
TextDrawShowForPlayer(iSpeed[i]);
                
TextShow[i] = true;
            }
        }
        else
        {
            if(
TextShow[i] == true)
            {
                
TextDrawHideForPlayer(iSpeed[i]);
                
TextShow[i] = false;
            }
        }
    }



do outro gm
PHP код:
public VeloThiago()
{
    new 
Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
    new 
Float:Speedo_HP;
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        new 
vehicle GetPlayerVehicleID(i);
        if(
IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
        {
            
GetPlayerPos(iSpeedo_XSpeedo_YSpeedo_Z);
            
GetPlayerVehicleID(i);
            new 
newcar GetPlayerVehicleID(i);
            
GetVehicleHealth(GetPlayerVehicleID(i), Speedo_HP);
            new 
str1[256],str2[256],str3[256],str4[256],str5[256],str6[256],str7[256];
            if(
SpeedoON[i] == 0)
            {
                
TextDrawShowForPlayer(ibox[i]);
                
TextDrawShowForPlayer(ifahrzeug[i]);
                
TextDrawShowForPlayer(imph[i]);
                
TextDrawShowForPlayer(icombustivelt[i]);
                
TextDrawShowForPlayer(izustand[i]);
                
TextDrawShowForPlayer(igps[i]);
                
TextDrawShowForPlayer(ihoehe[i]);
                
TextDrawShowForPlayer(iurl[i]);
                
SpeedoON[i] = 1;
            }
            
format(str1,sizeof(str1),"~w~~d~Veiculo: ~b~~h~~h~%s",vehName[GetVehicleModel(vehicle)-400]);
            
TextDrawSetString(fahrzeug[i], str1);
            
format(str2,sizeof(str2),"~w~~d~KM/H: ~y~%d",GetPlayerSpeed(itrue));
            
TextDrawSetString(mph[i], str2);
            
format(str3,sizeof(str3),"~w~~d~Combustivel: ~g~~h~%d%%"Gas[vehicle]);
            
TextDrawSetString(combustivelt[i], str3);
            if(
IsACopCar(newcar) || IsAExCar(newcar) || IsAnAmbulanceCar(newcar) || IsAPoliciaCivilCar(newcar) || IsAPFCar(newcar) || IsAROTAsCar(newcar) || IsAGOVCar(newcar))
            {
            
format(str4,sizeof(str4),"~w~~d~Blindagem: ~r~~h~Sim");
            }
            else
            {
            
format(str4,sizeof(str4),"~w~~d~Lataria: ~r~~h~%0.0f%%"Speedo_HP/10);
            }
            
TextDrawSetString(zustand[i], str4);
            
format(str5,sizeof(str5),"~w~~d~GPS: ~p~~h~%s"ReturnPlayerZone(i));
            
TextDrawSetString(gps[i], str5);
            
format(str6,sizeof(str6),"~w~~d~Altura: ~p~~h~%.1f"Speedo_Z);
            
TextDrawSetString(hoehe[i], str6);
            
format(str7,sizeof(str7),URLTHIAGO);
            
TextDrawSetString(url[i], str7);
        }
        
SavePlayerPos[i][sX] = Speedo_XSavePlayerPos[i][sY] = Speedo_YSavePlayerPos[i][sZ] = Speedo_Z;
    }
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(!
IsPlayerInAnyVehicle(i))
        {
            
TextDrawHideForPlayer(ibox[i]);
            
TextDrawHideForPlayer(ifahrzeug[i]);
            
TextDrawHideForPlayer(imph[i]);
            
TextDrawHideForPlayer(icombustivelt[i]);
            
TextDrawHideForPlayer(izustand[i]);
            
TextDrawHideForPlayer(igps[i]);
            
TextDrawHideForPlayer(ihoehe[i]);
            
TextDrawHideForPlayer(iurl[i]);
            
SpeedoON[i] = 0;
        }
        if(
spawnado[i] == 1)
        {
            if(
SpeedoON[i] >= 1)
            {
                
TextDrawHideForPlayer(iforum[i]);
            }
            if(
SpeedoON[i] <= 0)
            {
                
TextDrawShowForPlayer(iforum[i]);
            }
        }
    }

ERROS
PHP код:
C:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(4) : warning 216nested comment
C
:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\pawno\include\servermoneyGM.inc(84) : warning 201redefinition of constant/macro (symbol "OnGameModeInit")
C:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(37267) : warning 219local variable "Nome" shadows a variable at a preceding level
C
:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(52783) : warning 219local variable "Nick" shadows a variable at a preceding level
C
:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(53362) : warning 235: public function lacks forward declaration (symbol "VeloThiago")
C:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(53376) : error 017undefined symbol "SpeedoON"
C:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(53376) : warning 215expression has no effect
C
:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(53376) : error 001expected token";"but found "]"
C:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(53376) : error 029invalid expressionassumed zero
C
:\Users\Samsung 2 Gustavo\Desktop\sps ultima versao SF\gamemodes\SPS.pwn(53376) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

Reply
#2

teste assim:
pawn Код:
forward VeloThiago();
public VeloThiago()
{
    new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
    new Float:Speedo_HP;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        new vehicle = GetPlayerVehicleID(i);
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
        {
            GetPlayerPos(i, Speedo_X, Speedo_Y, Speedo_Z);
            GetPlayerVehicleID(i);
            new newcar = GetPlayerVehicleID(i);
            GetVehicleHealth(GetPlayerVehicleID(i), Speedo_HP);
            new str[128];
            if(SpeedoON[i] == 0)
            {
                TextDrawShowForPlayer(i, box[i]);
                TextDrawShowForPlayer(i, fahrzeug[i]);
                TextDrawShowForPlayer(i, mph[i]);
                TextDrawShowForPlayer(i, combustivelt[i]);
                TextDrawShowForPlayer(i, zustand[i]);
                TextDrawShowForPlayer(i, gps[i]);
                TextDrawShowForPlayer(i, hoehe[i]);
                TextDrawShowForPlayer(i, url[i]);
                SpeedoON[i] = 1;
            }
            format(str, sizeof(str),"~w~~d~Veiculo: ~b~~h~~h~%s", vehName[GetVehicleModel(vehicle)-400]);
            TextDrawSetString(fahrzeug[i], str);
            format(str,sizeof(str),"~w~~d~KM/H: ~y~%d",GetPlayerSpeed(i, true));
            TextDrawSetString(mph[i], str);
            format(str, sizeof(str),"~w~~d~Combustivel: ~g~~h~%d%%", Gas[vehicle]);
            TextDrawSetString(combustivelt[i], str);
            if(IsACopCar(newcar) || IsAExCar(newcar) || IsAnAmbulanceCar(newcar) || IsAPoliciaCivilCar(newcar) || IsAPFCar(newcar) || IsAROTAsCar(newcar) || IsAGOVCar(newcar))
            {
            format(str,sizeof(str),"~w~~d~Blindagem: ~r~~h~Sim");
            }
            else
            {
                format(str, sizeof(str),"~w~~d~Lataria: ~r~~h~%0.0f%%", Speedo_HP/10);
            }
            TextDrawSetString(zustand[i], str);
            format(str, sizeof(str),"~w~~d~GPS: ~p~~h~%s", ReturnPlayerZone(i));
            TextDrawSetString(gps[i], str);
            format(str, sizeof(str),"~w~~d~Altura: ~p~~h~%.1f", Speedo_Z);
            TextDrawSetString(hoehe[i], str);
            format(str, sizeof(str), URLTHIAGO);
            TextDrawSetString(url[i], str);
        }
        SavePlayerPos[i][sX] = Speedo_X;
        SavePlayerPos[i][sY] = Speedo_Y;
        SavePlayerPos[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, mph[i]);
            TextDrawHideForPlayer(i, combustivelt[i]);
            TextDrawHideForPlayer(i, zustand[i]);
            TextDrawHideForPlayer(i, gps[i]);
            TextDrawHideForPlayer(i, hoehe[i]);
            TextDrawHideForPlayer(i, url[i]);
            SpeedoON[i] = 0;
        }
        if(spawnado[i] == 1)
        {
            if(SpeedoON[i] >= 1)
            {
                TextDrawHideForPlayer(i, forum[i]);
            }
            if(SpeedoON[i] <= 0)
            {
                TextDrawShowForPlayer(i, forum[i]);
            }
        }
    }
}
foi adicionado forward q estava faltando a variavel SpeedoON nao estб sendo reconhecida declare ela antes do velocimento deve resolver o problema a linha estava errada vc estava usando , deve se usar ;
pawn Код:
SavePlayerPos[i][sX] = Speedo_X, SavePlayerPos[i][sY] = Speedo_Y, SavePlayerPos[i][sZ] = Speedo_Z;
troquei por:
pawn Код:
SavePlayerPos[i][sX] = Speedo_X;
        SavePlayerPos[i][sY] = Speedo_Y;
        SavePlayerPos[i][sZ] = Speedo_Z;
Reply
#3

Код:
(53376) : error 001: expected token: ";", but found "]"
Na linha decima - 53375 , subistitua no final o ] Por ;

Код:
(53376) : error 017: undefined symbol "SpeedoON"
Voce nao criou a define que ira definir o que siginifica SpeedoON
Reply
#4

Aprenda a programar, depois tente fazer alguma coisa, pufffttt.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)