Problem with fuel system using dialogs
#1

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")
Reply
#2

Replace all inputtext with :

PHP код:
strval(inputtext); 
Reply
#3

I add new Float:fuelprice but i get again

Код:
D:\Сървъри\SAMP сървър\gamemodes\4vendeta.pwn(956) : warning 213: tag mismatch
line 956:

Код:
GivePlayerMoney(playerid, -fuelprice);
Reply
#4

can someone help me?
Reply
#5

Show us the line above this line
pawn Код:
GivePlayerMoney(playerid, -fuelprice);
or show us how you define fuelprince
Reply
#6

here it is:

Код:
		fuelprice = strval(inputtext)*2.8;
        GivePlayerMoney(playerid, -fuelprice);
		format(string, sizeof(string), "Ти зареди твоята кола с %d литра за %d$.", strval(inputtext), fuelprice);
Reply
#7

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;
    }
Reply
#8

tnx ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)