hi I need help I made /fill amount and if I type /fill it fills up vehicle to 100.0 not the amount
PHP код:
if(strcmp(cmd, "/fill", true) == 0) //this
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: /fill [ammount]");
return 1;
}
new fuel;
new vehicleid = GetPlayerVehicleID(playerid);
fuel = strval(tmp); // this?
if(fuel>1000)return SendClientMessage(playerid,COLOR_RED,"Nu poti alimenta vehicolul!");//this line was needed
if(!IsAtGasStation(playerid))
{
return SendClientMessage(playerid, -1, "Nu esti la Benzinarie!");
}
if(!IsPlayerInAnyVehicle(playerid))
{
return SendClientMessage(playerid, -1, "Nu esti in vehicul!");
}
if(engineOn[playerid] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|| Trebuie sa ai motorul oprit! ||");
return 1;
}
if(IsRefilling[playerid])
{
return SendClientMessage(playerid, -1, "Faci plinul..");
}
if(GetPlayerCash(playerid) < 120)
{
return SendClientMessage(playerid, -1, "Nu ai destui bani!");
}
if(VehicleFuel[vehicleid] == 1000)//strange lets update com e on svr!
{
return SendClientMessage(playerid, -1, "Vehicolul este plin de combustibil"); // i have 99.9 and message appears.
}
GivePlayerCash(playerid,-50);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
TextDrawSetString(Text:Values[playerid][2], "Refilling...");
RefillingTimer[playerid] = SetTimerEx("Refilling", 100, true, "iiiiiiiii", playerid, vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
IsRanOutOfFuel[vehicleid] = true;
IsRefilling[playerid] = true;
return 1;
}
PHP код:
public Refilling(playerid, vehicleid, engine, lights, alarm, doors, bonnet, boot, objective)
{
if(!IsPlayerInAnyVehicle(playerid))
{
IsRefilling[playerid] = false;
KillTimer(RefillingTimer[playerid]);
}
if(VehicleFuel[vehicleid] == 1000)
{
SendClientMessage(playerid,COLOR_RED,"Ai facut plinul de 150Lei, Poti pleca!");
IsRefilling[playerid] = false;
IsRanOutOfFuel[vehicleid] = false;
printf("vehREFILL");
KillTimer(RefillingTimer[playerid]);
return 1;
}
IsRefilling[playerid] = true;
new TD_String[25];
VehicleFuel[vehicleid]+=1;//cause i multiple 100 to 1000 there is comming a 0 extra
new SecondFuel = VehicleFuel[vehicleid] % 10,
FirstFuel = (VehicleFuel[vehicleid] - SecondFuel) / 10;
format(TD_String, 25, "%i.%i", FirstFuel,SecondFuel);//i have 99.8 i go
TextDrawSetString(Text:Values[playerid][2], TD_String);//playerid?yea
return 1;
}