10.10.2014, 10:23
Hola, tengo un pequeсo problema, esque el combustible no me baja, ni la barra ni el numero:
Acб la barra:
[/pawn]
SpeedBar2[i] = CreateProgressBar(543.00, 377.00, 85.50, 3.20, -9961217, 100.0);
SetProgressBarMaxValue(SpeedBar2[i], 100);[/pawn]
Acб el update:
timer
el stock
Les agradeceria si me ayudan en esto.
pawn Код:
timer VehicleUpdate[10000]()
{
new engine,lights,alarm,doors,bonnet,boot,objective,modelid;
for(new v = 0; v < MAX_VEHICLES; v++) if(GetVehicleModel(v)){
modelid = GetVehicleModel(v);
GetVehicleParamsEx(v,engine,lights,alarm,doors,bonnet,boot,objective);
switch(modelid){
case 520, 476, 593, 553, 513, 512, 577, 592, 511, 539, 464, 519: VehicleFuel[v] = 100;
case 509, 481, 510: VehicleFuel[v] = 100, arr_Engine{v} = 1, SetVehicleParamsEx(v,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
if(engine == VEHICLE_PARAMS_ON){
if(VehicleFuel[v] > 0 && !IsAHarvest(v)){
VehicleFuel[v]-=1;
if(VehicleFuel[v] <= 0) SetVehicleParamsEx(v,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
if(arr_Engine{v} == 0) SetVehicleParamsEx(v,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
}
}
Acб la barra:
[/pawn]
SpeedBar2[i] = CreateProgressBar(543.00, 377.00, 85.50, 3.20, -9961217, 100.0);
SetProgressBarMaxValue(SpeedBar2[i], 100);[/pawn]
Acб el update:
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new cid = GetPlayerVehicleID(playerid);
SetProgressBarValue(SpeedBar[playerid], VelocidadVehiculo(playerid));
UpdateProgressBar(SpeedBar[playerid], playerid);
SetProgressBarValue(SpeedBar2[playerid], VehicleFuel[cid]);
UpdateProgressBar(SpeedBar2[playerid], playerid);
return 1;
}
return 1;
}
timer
pawn Код:
timer ServerMicrobeat[250]()
{
new
Float: fExpHealth,
Float: fCurrentSpeed,
iVehicle,
arrDamage[4],
arrVehParams[7],
szSpeed[80];
foreach(Player, i){
if(GetPlayerState(i) == PLAYER_STATE_DRIVER){
fCurrentSpeed = player_get_speed(i);
fVehSpeed[i] = fCurrentSpeed;
iVehicle = GetPlayerVehicleID(i);
for(new s=0;s<10;s++){
if(SpikeStrips[s][sX] != 0){
if(VehicleToPoint( 3.0, iVehicle, SpikeStrips[s][sX], SpikeStrips[s][sY], SpikeStrips[s][sZ])){
GetVehicleDamageStatus(iVehicle, arrDamage[0], arrDamage[1], arrDamage[2], arrDamage[3]);
arrDamage[3] = encode_tires(1, 1, 1, 1);
UpdateVehicleDamageStatus(iVehicle, arrDamage[0], arrDamage[1], arrDamage[2], arrDamage[3]);
}
}
}
GetVehicleHealth(iVehicle,fExpHealth);
if(fExpHealth < 350.0 && !IsABike(iVehicle)){
SetVehicleHealth(iVehicle, 251.0);
GetVehicleParamsEx(iVehicle, arrVehParams[0], arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
if(arrVehParams[0] == VEHICLE_PARAMS_ON) SetVehicleParamsEx(iVehicle,VEHICLE_PARAMS_OFF, arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
GameTextForPlayer(i, "~r~Motor quemado!", 2500, 3);
arr_Engine{iVehicle} = 0;
}
TextDrawShowForPlayer(i, santiago7[i] );
TextDrawShowForPlayer(i, santiago5[i] );
TextDrawShowForPlayer(i, santiago1[i] );
TextDrawShowForPlayer(i, santiago2[i] );
TextDrawShowForPlayer(i, santiago3[i] );
TextDrawShowForPlayer(i, santiago4[i] );
TextDrawShowForPlayer(i, santiago6[i] );
ShowProgressBarForPlayer(i, SpeedBar[i]);
ShowProgressBarForPlayer(i, SpeedBar2[i]);
format(szSpeed, sizeof(szSpeed),"%d/100",VehicleFuel[iVehicle]);
TextDrawSetString(santiago7[i], szSpeed);
format(szSpeed, sizeof(szSpeed),"%.0f", fCurrentSpeed);
TextDrawSetString(santiago5[i], szSpeed);
}
}
}
el stock
pawn Код:
stock HideFuel(playerid)
{
HideProgressBarForPlayer(playerid, SpeedBar[playerid]);
HideProgressBarForPlayer(playerid, SpeedBar2[playerid]);
TextDrawHideForPlayer(playerid, santiago1[playerid] );
TextDrawHideForPlayer(playerid, santiago2[playerid] );
TextDrawHideForPlayer(playerid, santiago3[playerid] );
TextDrawHideForPlayer(playerid, santiago4[playerid] );
TextDrawHideForPlayer(playerid, santiago5[playerid] );
TextDrawHideForPlayer(playerid, santiago6[playerid] );
TextDrawHideForPlayer(playerid, santiago7[playerid] );
}
Les agradeceria si me ayudan en esto.