[Help] - Fuel system
#1

I created some basic fuel system, and maked that on timer it goes -1, but it doesn't work.

Command /carengine(with timer)

Код:
YCMD:carengine(playerid, params[], help)
{
	#pragma unused help
	new odabir, lights, alarm, doors, bonnet, boot, objective;
	new vehicle = GetPlayerVehicleID(playerid);
	new	modelid = GetVehicleModel(vehicle);
	if(sscanf(params, "u", odabir)) return scm(playerid, color_red, "[GREЉKA]"col_white" - Koriљtenje komande: /carengine [1-upali/2-ugasi]");
   	if(IsABike(modelid) || IsAPlane(modelid) || IsABoat(modelid) || IsATrain(modelid)) return scm(playerid, color_red, "[GREЉKA]"col_white" - Nepoznata akcija.");
	if(odabir == 1)
	{
	    vEngine[vehicle] = 1;
		SetVehicleParamsEx(vehicle,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
		TrosGoriva[vehicle] = SetTimer("TrosenjeGoriva", 100000, true);
	}
	else if(odabir == 2)
	{
		vEngine[vehicle] = 2;
		SetVehicleParamsEx(vehicle,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
		KillTimer(TrosGoriva[vehicle]);
	}
	return 1;
}
[font="verdana"][size="2"]Timer:
Код:
public TrosenjeGoriva(vehicleid)
{
	vGas[vehicleid] =- 1;
	return 1;
}
[font="verdana"][size="2"]OnPlayerUpdate(speedo)
Код:
public OnPlayerUpdate(playerid)
{
    new vehicleid, modelid, Float:speed_x, Float:speed_y, Float:speed_z, Float:final_speed, speed_string[256], final_speed_int;
	vehicleid = GetPlayerVehicleID(playerid);
	modelid = GetVehicleModel(vehicleid);
	if(vehicleid != 0 && !IsABike(modelid))
	{
		GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
		final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
		final_speed_int = floatround(final_speed,floatround_round);
	    format(speed_string,512,"~b~Brzina:~w~ %i KM/H~n~~b~Vozilo:~w~ %s~n~~b~Gorivo:~w~ %d litara.",final_speed_int, CarNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400], vGas[vehicleid]);
		TextDrawSetString(Speedo[playerid], speed_string);
	}
	else
	{
		TextDrawSetString(Speedo[playerid], " ");
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)