[Ajuda] Velocimetro nгo desaparece apуs sair do veнculo
#1

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
Reply
#2

faz um debug..
Reply
#3

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

?
Reply
#4

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++)
Reply
#5

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
Reply
#6

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
Reply
#7

o problema nгo e no gm e nas includes '-'
Reply
#8

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

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 .
Reply
#10

tente hidetextdrawm em onplayerexitvehicle
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)