Problem with fuel system - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with fuel system (
/showthread.php?tid=505847)
Problem with fuel system -
MrTinder - 10.04.2014
It charges only 1L in the car..
Код:
if(dialogid == 154)
{
if(response)
{
new vehicleid = GetPlayerVehicleID(playerid), oldfuel, moneytake = strlen(inputtext)*3;
if(VehicleFuel[vehicleid] == 100) return SendClientMessage(playerid, COLOR_GREEN, "Резервоара на превозното средство е пълен.");
if(strlen(inputtext) < 0 || strlen(inputtext) > 100) return SendClientMessage(playerid, COLOR_GREEN, "Не можеш да заредиш повече от 100 литра.");
if(VehicleFuel[vehicleid]+strlen(inputtext) > 100) return SendClientMessage(playerid, COLOR_GREEN, "Не можеш да заредиш повече от 100 литра.");
oldfuel = VehicleFuel[vehicleid];
VehicleFuel[vehicleid] = oldfuel+strlen(inputtext);
GivePlayerMoney(playerid, moneytake);
}
}
Re: Problem with fuel system -
Conradus - 10.04.2014
Strval is used to get the length of a string. To convert the string to an integer (for calculations) use strval.
So in your case just replace strlen(inputtext) with strval(inputtext).
Re: Problem with fuel system -
MrTinder - 10.04.2014
Thanks bro =]