30.04.2017, 07:05
Topic explains everything. This timer is called every 6 seconds
PHP код:
public timer_update()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
new Float:Velocity[3];
new vid = GetPlayerVehicleID(i);
GetVehicleVelocity(vid, Velocity[0], Velocity[1], Velocity[2]);
if(Velocity[0] == 0 && Velocity[1] == 0 && Velocity[2] == 0) return 0;
if (isrefuelling[i]) return 0;
if (GetPlayerVehicleSeat(i) == 0)
{
if(Engine[i] == 1)
{
fuel[vid] = fuel[vid] - 1;
if (fuel[vid]<1)
{
fuel[vid] = 0;
new veh = GetPlayerVehicleID(i);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4);
Engine[i] = 0;
}
}
}
new string[128];
format(string,sizeof string,"~b~Fuel: ~w~%i%", fuel[vid]);
PlayerTextDrawSetString(i, vehFuel[i],string);
}
return 1;
}