SA-MP Forums Archive
stock return floats - 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: stock return floats (/showthread.php?tid=459573)



stock return floats - horsemeat - 23.08.2013

I am have trouble with this function here. I probably don't have the correct way of returing the float it is giving me a warning

Код:
C:\Users\joshua\Desktop\sampserver\filterscripts\jbcars2.pwn(3342) : warning 208: function with tag result used before definition, forcing reparse
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2013, ITB CompuPhase


1 Warning.
pawn Код:
//all variables have been defined
stock Float:TakeGasOutOfRefinery(playerid,refineryid,Float:ammountofgas)//mark
{
    new numofoilstorage,Float:fuel;
    for(new count;count < MAX_OILPUMPS;count++)
    {
        if((oilstoragestate[count][refineryid])==1)
        {
            numofoilstorage ++;
        }
    }
    new Float:splitgas = ammountofgas / numofoilstorage;
    new Float:passon;
    for(new count;count < MAX_OILPUMPS;count++)
    {
        if((oilstoragestate[count][refineryid])==1)
        {
            new Float:currentsplitgas = splitgas;
            if((passon) > 0)
            {
                currentsplitgas = currentsplitgas + passon;
                passon = 0;
            }
            if((oilstoragefuel[count][refineryid])<currentsplitgas)
            {
                passon = splitgas - oilstoragefuel[count][refineryid];
            }
            else
            {
                oilstoragefuel[count][refineryid] = oilstoragefuel[count][refineryid] - currentsplitgas;
                fuel = fuel + currentsplitgas;
            }
        }
    }
    if((passon)> 0)
    {
        new str[256];
        format(str,sizeof(str),"you could not take %fL of fuel becuse the refinery does not have anymore",passon);
        SendClientMessage(playerid, RED , str);
    }
    return fuel;
}



Re: stock return floats - Konstantinos - 23.08.2013

Add TakeGasOutOfRefinery function before the part you're using it or just add
pawn Код:
forward Float:TakeGasOutOfRefinery(playerid,refineryid,Float:ammountofgas);
under the includes/defines.


Re: stock return floats - horsemeat - 24.08.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Add TakeGasOutOfRefinery function before the part you're using it or just add
pawn Код:
forward Float:TakeGasOutOfRefinery(playerid,refineryid,Float:ammountofgas);
under the includes/defines.
Thanks