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;
}
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;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
PHP Code:
|
for(new i = 0; i < sizeof(CarroHUD); i++)
for(new i = 0; i < sizeof(CarroHUD[playerid]); i++)
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++) Code:
for(new i = 0; i < sizeof(CarroHUD[playerid]); i++) |
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++) Code:
for(new i = 0; i < sizeof(CarroHUD[playerid]); i++) |
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]
sizeof(CarroHUD[playerid])
sizeof(CarroHUD[])