SA-MP Forums Archive
[Ajuda] Velocimetro nгo desaparece apуs sair do veнculo - 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] Velocimetro nгo desaparece apуs sair do veнculo (/showthread.php?tid=591247)



Velocimetro nгo desaparece apуs sair do veнculo - JPedro - 10.10.2015

O Velocimetro/Textdraw nгo estб desaparecendo apуs sair do veнculo

PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
        
        new 
vehicleid GetPlayerVehicleID(playerid);
        new 
enginelightsalarmdoorsbonnetbootobjective;
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        if(
IsABike(vehicleid)) SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
        if(!
IsABike(vehicleid))
        {   
            
VelocimetroUpdate[playerid] = SetTimerEx("UpdateVehicleHud"1000true"i"playerid);
            if(
vInfo[vehicleid][vHasEngine] == true)
            {  
                if(
vInfo[vehicleid][vFuel] <= 0)
                {    
                    
KillTimer(GasolinaTimer[playerid]);
                    
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
                }
                if(
vInfo[vehicleid][vFuel] > 0)
                {  
                    
GasolinaTimer[playerid] = SetTimerEx("GasolinaTime"5000true"ii"playeridvehicleid);
                }
            }
        }
    }
    else
    {
        for(new 
0sizeof(CarroHUD); i++) PlayerTextDrawHide(playeridCarroHUD[playerid][i]);
        
KillTimer(GasolinaTimer[playerid]);
        
KillTimer(VelocimetroUpdate[playerid]);
    }
    return 
1;

PHP Code:
public UpdateVehicleHud(playerid)
{
    new 
str[34];
    new 
vehicleid GetPlayerVehicleID(playerid);
    
format(strsizeof(str), "Vehicle Health: ~g~%.0f%"GetVehicleHealthEx(vehicleid));
    
PlayerTextDrawSetString(playeridCarroHUD[playerid][1], str);
    if(
vInfo[vehicleid][vHasEngine] == truePlayerTextDrawSetString(playeridCarroHUD[playerid][2], "Engine: ~g~Yes");
    else if(
vInfo[vehicleid][vHasEngine] == falsePlayerTextDrawSetString(playeridCarroHUD[playerid][2], "Engine: ~r~No");
    for(new 
0sizeof(CarroHUD); i++) PlayerTextDrawShow(playeridCarroHUD[playerid][i]);
    return 
1;

Quem puder ajudar ai agradeзo, й uma coisa boba sу que eu nгo estou conseguindo arrumar :P


Re: Velocimetro nгo desaparece apуs sair do veнculo - s4kuL - 10.10.2015

faz um debug..


Re: Velocimetro nгo desaparece apуs sair do veнculo - CZ - 10.10.2015

PHP Code:
public OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;

?


Re: Velocimetro nгo desaparece apуs sair do veнculo - n0minal - 10.10.2015

Quote:
Originally Posted by CZ
View Post
PHP Code:
public OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;

?
OnPlayerStateChange й mais seguro, pois se vocк for removido de um veнculo a OnPlayerExitVehicle nгo й chamada, jб o state dele vai mudar de STATE_DRIVER pra STATE_ONFOOT.

@Tуpico:

Code:
for(new i = 0; i < sizeof(CarroHUD); i++)
Substitua por

Code:
for(new i = 0; i < sizeof(CarroHUD[playerid]); i++)



Re: Velocimetro nгo desaparece apуs sair do veнculo - CZ - 10.10.2015

Quote:
Originally Posted by ipsLeon
View Post
OnPlayerStateChange й mais seguro, pois se vocк for removido de um veнculo a OnPlayerExitVehicle nгo й chamada, jб o state dele vai mudar de STATE_DRIVER pra STATE_ONFOOT.

@Tуpico:

Code:
for(new i = 0; i < sizeof(CarroHUD); i++)
Substitua por

Code:
for(new i = 0; i < sizeof(CarroHUD[playerid]); i++)
Hum vlw


Re: Velocimetro nгo desaparece apуs sair do veнculo - JPedro - 10.10.2015

Quote:
Originally Posted by ipsLeon
View Post
OnPlayerStateChange й mais seguro, pois se vocк for removido de um veнculo a OnPlayerExitVehicle nгo й chamada, jб o state dele vai mudar de STATE_DRIVER pra STATE_ONFOOT.

@Tуpico:

Code:
for(new i = 0; i < sizeof(CarroHUD); i++)
Substitua por

Code:
for(new i = 0; i < sizeof(CarroHUD[playerid]); i++)
Nгo funcionou =/

PHP Code:
C:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(467) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(576) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(984) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1059) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1339) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1368) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1526) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1667) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\YSI\y_iterate.inc(696) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\YSI\y_iterate.inc(820) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\progress.inc(229) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\mSelection.inc(656) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\pause.inc(41) : warning 219local variable "i" shadows a variable at a preceding level
LOGIN
.pwn(2416) : warning 219local variable "i" shadows a variable at a preceding level
LOGIN
.pwn(2700) : warning 219local variable "i" shadows a variable at a preceding level
LOGIN
.pwn(2700) : error 001expected token"]"but found "-identifier-"
LOGIN.pwn(2700) : error 029invalid expressionassumed zero
LOGIN
.pwn(2700) : error 029invalid expressionassumed zero
LOGIN
.pwn(2700) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors
.
[
Finished in 0.8s with exit code 1



Re: Velocimetro nгo desaparece apуs sair do veнculo - Madhrer - 10.10.2015

o problema nгo e no gm e nas includes '-'


Re: Velocimetro nгo desaparece apуs sair do veнculo - blastdap - 11.10.2015

Algum bracket "{" ta fora do lugar, pra dar erros nas includes.


Re: Velocimetro nгo desaparece apуs sair do veнculo - rjjj - 11.10.2015

Esta nгo й uma expressгo vбlida na linguagem Pawn, o que faz com que gere erros de compilaзгo :


Code:
sizeof(CarroHUD[playerid])

O correto seria:


Code:
sizeof(CarroHUD[])

Ou simplesmente o uso direto do tamanho da segunda dimensгo da array CarroHUD.




Espero ter ajudado .


Re: Velocimetro nгo desaparece apуs sair do veнculo - zPawnu - 11.11.2015

tente hidetextdrawm em onplayerexitvehicle