Problem with fuel system using dialogs -
MrTinder - 27.10.2013
Hm..I starting writing a fuel system but in this code:
Код:
if(dialogid == 154)
{
new string[256], vehicleid = GetPlayerVehicleID(playerid);
if(VehicleFuel[vehicleid]+inputtext > 100) return SendClientMessage(playerid, COLOR_GREY, "Неможе да заредиш повече от 100 литра.");
VehicleFuel[vehicleid] += inputtext;
GivePlayerMoney(playerid, -inputtext*2.80);
format(string, sizeof(string), "Ти зареди твоята кола с %d литра за %d$.", inputtext, inputtext*2.80)
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
i get this errors:
Код:
D:\Сървъри\SAMP сървър\gamemodes\4vendeta.pwn(953) : error 033: array must be indexed (variable "inputtext")
D:\Сървъри\SAMP сървър\gamemodes\4vendeta.pwn(954) : error 033: array must be indexed (variable "inputtext")
D:\Сървъри\SAMP сървър\gamemodes\4vendeta.pwn(955) : error 033: array must be indexed (variable "inputtext")
D:\Сървъри\SAMP сървър\gamemodes\4vendeta.pwn(956) : error 033: array must be indexed (variable "inputtext")
AW: Problem with fuel system using dialogs -
ikbenremco - 27.10.2013
Replace all inputtext with :
PHP код:
strval(inputtext);
Re: Problem with fuel system using dialogs -
MrTinder - 27.10.2013
I add new Float:fuelprice but i get again
Код:
D:\Сървъри\SAMP сървър\gamemodes\4vendeta.pwn(956) : warning 213: tag mismatch
line 956:
Код:
GivePlayerMoney(playerid, -fuelprice);
Re: Problem with fuel system using dialogs -
MrTinder - 27.10.2013
can someone help me?
Re: Problem with fuel system using dialogs - Patrick - 27.10.2013
Show us the line above this line
pawn Код:
GivePlayerMoney(playerid, -fuelprice);
or show us how you define
fuelprince
Re: Problem with fuel system using dialogs -
MrTinder - 27.10.2013
here it is:
Код:
fuelprice = strval(inputtext)*2.8;
GivePlayerMoney(playerid, -fuelprice);
format(string, sizeof(string), "Ти зареди твоята кола с %d литра за %d$.", strval(inputtext), fuelprice);
Re: Problem with fuel system using dialogs -
EiresJason - 27.10.2013
GivePlayerMoney can only give integers. You can't give someone a Float.
Like:
pawn Код:
GivePlayerMoney(playerid,5);//correct
GivePlayerMoney(playerid,5.5); //wrong
Try this:
pawn Код:
if(dialogid == 154)
{
new string[256], vehicleid = GetPlayerVehicleID(playerid);
new units = strval(inputtext);
if(VehicleFuel[vehicleid]+units > 100) return SendClientMessage(playerid, COLOR_GREY, "Неможе да заредиш повече от 100 литра.");
VehicleFuel[vehicleid] += units;
GivePlayerMoney(playerid, -units*3); //i rounded it up to $3.
format(string, sizeof(string), "Ти зареди твоята кола с %d литра за %d$.", units, units*3)
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
Re: Problem with fuel system using dialogs -
MrTinder - 27.10.2013
tnx ^^