SA-MP Forums Archive
Problem with fuel system using dialogs - 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 using dialogs (/showthread.php?tid=472210)



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 ^^