[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(playerid, newstate, oldstate)
{
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
        
        new 
vehicleid = GetPlayerVehicleID(playerid);
        new 
engine, lights, alarm, doors, bonnet, boot, objective;
        
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        if(
IsABike(vehicleid)) SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
        if(!
IsABike(vehicleid))
        {   
            
VelocimetroUpdate[playerid] = SetTimerEx("UpdateVehicleHud", 1000, true, "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", 5000, true, "ii", playerid, vehicleid);
                }
            }
        }
    }
    else
    {
        for(new 
i = 0; i < sizeof(CarroHUD); i++) PlayerTextDrawHide(playerid, CarroHUD[playerid][i]);
        
KillTimer(GasolinaTimer[playerid]);
        
KillTimer(VelocimetroUpdate[playerid]);
    }
    return 
1;
} 
PHP Code:
public UpdateVehicleHud(playerid)
{
    new 
str[34];
    new 
vehicleid = GetPlayerVehicleID(playerid);
    
format(str, sizeof(str), "Vehicle Health: ~g~%.0f%", GetVehicleHealthEx(vehicleid));
    
PlayerTextDrawSetString(playerid, CarroHUD[playerid][1], str);
    if(
vInfo[vehicleid][vHasEngine] == true) PlayerTextDrawSetString(playerid, CarroHUD[playerid][2], "Engine: ~g~Yes");
    else if(
vInfo[vehicleid][vHasEngine] == false) PlayerTextDrawSetString(playerid, CarroHUD[playerid][2], "Engine: ~r~No");
    for(new 
i = 0; i < sizeof(CarroHUD); i++) PlayerTextDrawShow(playerid, CarroHUD[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(playerid, vehicleid)
{
    return 
1;
} 
?
Reply
#4

Quote:
Originally Posted by CZ
View Post
PHP Code:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    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 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(576) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(984) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1059) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1339) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1368) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1526) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\DOF2.inc(1667) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\YSI\y_iterate.inc(696) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\YSI\y_iterate.inc(820) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\progress.inc(229) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\mSelection.inc(656) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\JP\Desktop\SAMP_SV\pawno\include\pause.inc(41) : warning 219: local variable "i" shadows a variable at a preceding level
LOGIN
.pwn(2416) : warning 219: local variable "i" shadows a variable at a preceding level
LOGIN
.pwn(2700) : warning 219: local variable "i" shadows a variable at a preceding level
LOGIN
.pwn(2700) : error 001: expected token: "]", but found "-identifier-"
LOGIN.pwn(2700) : error 029: invalid expression, assumed zero
LOGIN
.pwn(2700) : error 029: invalid expression, assumed zero
LOGIN
.pwn(2700) : fatal error 107: too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB 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: 1 Guest(s)