Warning Message - Make me confused
#1

Hello again, i create a thread on this morning twice..
sorry for that

btw, i have an 202 Warning Message.
pawn Код:
public MainTimer()
{
    new string[128];
    new Float:x, Float:y, Float:z;

    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
                new vehicleid = GetPlayerVehicleID(i);
                if(!IsBicycle(vehicleid) && Fuel[vehicleid] > 0)
                {
                    Fuel[vehicleid] -= GetPlayerSpeed(i)/1000.0; // << This is the warning! I tried to fix it and that wasn't change anything :s
                    if(Fuel[vehicleid] <= 0)
                    {
                        ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
                        GameTextForPlayer(i, "~r~out of fuel", 3000, 3);
                        SendClientMessage(i, COLOR_RED, "This vehicle is out of fuel!");
                    }
                }
            }
            if(RefuelTime[i] > 0 && GetPVarInt(i, "FuelStation"))
            {
                new vehicleid = GetPlayerVehicleID(i);
                Fuel[vehicleid] += 2.0;
                RefuelTime[i]--;
                if(RefuelTime[i] == 0)
                {
                    if(Fuel[vehicleid] >= 100.0) Fuel[vehicleid] = 100.0;
                    new stationid = GetPVarInt(i, "FuelStation");
                    new cost = floatround(Fuel[vehicleid]-GetPVarFloat(i, "Fuel"))*FUEL_PRICE;
                    if(GetPlayerState(i) != PLAYER_STATE_DRIVER || Fuel[vehicleid] >= 100.0 || GetPlayerMoney(i) < cost
                    || !IsPlayerInRangeOfPoint(i, 10.0, FuelStationPos[stationid][0], FuelStationPos[stationid][1], FuelStationPos[stationid][2]))
                    {
                        if(GetPlayerMoney(i) < cost) cost = GetPlayerMoney(i);
                        GivePlayerMoney(i, -cost);
                        format(string, sizeof(string), "~r~-$%d", cost);
                        GameTextForPlayer(i, string, 2000, 3);
                        format(string, sizeof(string), "You pay $%d for fuel", cost);
                        SendClientMessage(i, COLOR_WHITE, string);
                        SetPVarInt(i, "FuelStation", 0);
                        SetPVarFloat(i, "Fuel", 0.0);
                    }
                    else
                    {
                        RefuelTime[i] = 5;
                        format(string, sizeof(string), "~w~refueling...~n~~r~-$%d", cost);
                        GameTextForPlayer(i, string, 2000, 3);
                    }
                }
            }
            if(TrackCar[i])
            {
                GetVehiclePos(TrackCar[i], x, y, z);
                SetPlayerCheckpoint(i, x, y, z, 3);
            }
        }
    }
}
This the warning :

Код:
warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
I hope someone can help me ^_^
Reply
#2

Fuel is float ?
pawn Код:
new Float:Fuel[MAX_PLAYERS];
Reply
#3

Check this one. Does this work for you.

pawn Код:
public MainTimer()
{
    new string[128];
    new Float:x, Float:y, Float:z;
    new Float:Fuel[MAX_PLAYERS];
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
                new vehicleid = GetPlayerVehicleID(i);
                if(!IsBicycle(vehicleid) && Fuel[vehicleid] > 0)
                {
                    Fuel[vehicleid] -= GetPlayerSpeed(i)/1000.0; // << This is the warning! I tried to fix it and that wasn't change anything :s
                    if(Fuel[vehicleid] <= 0)
                    {
                        ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
                        GameTextForPlayer(i, "~r~out of fuel", 3000, 3);
                        SendClientMessage(i, COLOR_RED, "This vehicle is out of fuel!");
                    }
                }
            }
            if(RefuelTime[i] > 0 && GetPVarInt(i, "FuelStation"))
            {
                new vehicleid = GetPlayerVehicleID(i);
                Fuel[vehicleid] += 2.0;
                RefuelTime[i]--;
                if(RefuelTime[i] == 0)
                {
                    if(Fuel[vehicleid] >= 100.0) Fuel[vehicleid] = 100.0;
                    new stationid = GetPVarInt(i, "FuelStation");
                    new cost = floatround(Fuel[vehicleid]-GetPVarFloat(i, "Fuel"))*FUEL_PRICE;
                    if(GetPlayerState(i) != PLAYER_STATE_DRIVER || Fuel[vehicleid] >= 100.0 || GetPlayerMoney(i) < cost
                    || !IsPlayerInRangeOfPoint(i, 10.0, FuelStationPos[stationid][0], FuelStationPos[stationid][1], FuelStationPos[stationid][2]))
                    {
                        if(GetPlayerMoney(i) < cost) cost = GetPlayerMoney(i);
                        GivePlayerMoney(i, -cost);
                        format(string, sizeof(string), "~r~-$%d", cost);
                        GameTextForPlayer(i, string, 2000, 3);
                        format(string, sizeof(string), "You pay $%d for fuel", cost);
                        SendClientMessage(i, COLOR_WHITE, string);
                        SetPVarInt(i, "FuelStation", 0);
                        SetPVarFloat(i, "Fuel", 0.0);
                    }
                    else
                    {
                        RefuelTime[i] = 5;
                        format(string, sizeof(string), "~w~refueling...~n~~r~-$%d", cost);
                        GameTextForPlayer(i, string, 2000, 3);
                    }
                }
            }
            if(TrackCar[i])
            {
                GetVehiclePos(TrackCar[i], x, y, z);
                SetPlayerCheckpoint(i, x, y, z, 3);
            }
        }
    }
}
Reply
#4

Can you show which line is?
Reply
#5

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Fuel is float ?
pawn Код:
new Float:Fuel[MAX_PLAYERS];
pawn Код:
new Float:Fuel[MAX_VEHICLES] = {100.0, ...};
yea, its float.

____________________________________________

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Check this one. Does this work for you.
Код:
new Float:Fuel[MAX_PLAYERS];   
Fuel[vehicleid] -= GetPlayerSpeed(i)/1000.0; // << This is the warning! I tried to fix it and that wasn't change anything :s
MAX_PLAYER = Vehicle ID?
Reply
#6

Check above. I fixed the code and gave it to you.
Reply
#7

Try this
pawn Код:
Fuel[vehicleid] -= GetPlayerSpeed(i)/1000;
or

Show ' GetPlayerSpeed '
Reply
#8

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Check above. I fixed the code and gave it to you.
Код:
warning 219: local variable "Fuel" shadows a variable at a preceding level
warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
There is.
Reply
#9

Quote:
Originally Posted by Tama
Посмотреть сообщение
Код:
warning 219: local variable "Fuel" shadows a variable at a preceding level
warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
There is.
Test this particular. I hope i had pawno working at my PC.
pawn Код:
public MainTimer()
{
    new string[128];
    new Float:x, Float:y, Float:z;
    new Fuel[MAX_VEHICLES];
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
                new vehicleid = GetPlayerVehicleID(i);
                if(!IsBicycle(vehicleid) && Fuel[vehicleid] > 0)
                {
                    Fuel[vehicleid] -= GetPlayerSpeed(i); // I Hope it works now.
                    if(Fuel[vehicleid] <= 0)
                    {
                        ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
                        GameTextForPlayer(i, "~r~out of fuel", 3000, 3);
                        SendClientMessage(i, COLOR_RED, "This vehicle is out of fuel!");
                    }
                }
            }
            if(RefuelTime[i] > 0 && GetPVarInt(i, "FuelStation"))
            {
                new vehicleid = GetPlayerVehicleID(i);
                Fuel[vehicleid] += 2.0;
                RefuelTime[i]--;
                if(RefuelTime[i] == 0)
                {
                    if(Fuel[vehicleid] >= 100.0) Fuel[vehicleid] = 100.0;
                    new stationid = GetPVarInt(i, "FuelStation");
                    new cost = floatround(Fuel[vehicleid]-GetPVarFloat(i, "Fuel"))*FUEL_PRICE;
                    if(GetPlayerState(i) != PLAYER_STATE_DRIVER || Fuel[vehicleid] >= 100.0 || GetPlayerMoney(i) < cost
                    || !IsPlayerInRangeOfPoint(i, 10.0, FuelStationPos[stationid][0], FuelStationPos[stationid][1], FuelStationPos[stationid][2]))
                    {
                        if(GetPlayerMoney(i) < cost) cost = GetPlayerMoney(i);
                        GivePlayerMoney(i, -cost);
                        format(string, sizeof(string), "~r~-$%d", cost);
                        GameTextForPlayer(i, string, 2000, 3);
                        format(string, sizeof(string), "You pay $%d for fuel", cost);
                        SendClientMessage(i, COLOR_WHITE, string);
                        SetPVarInt(i, "FuelStation", 0);
                        SetPVarFloat(i, "Fuel", 0.0);
                    }
                    else
                    {
                        RefuelTime[i] = 5;
                        format(string, sizeof(string), "~w~refueling...~n~~r~-$%d", cost);
                        GameTextForPlayer(i, string, 2000, 3);
                    }
                }
            }
            if(TrackCar[i])
            {
                GetVehiclePos(TrackCar[i], x, y, z);
                SetPlayerCheckpoint(i, x, y, z, 3);
            }
        }
    }
}
OR

Show us the function "GetPlayerSpeed();"
Reply
#10

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Try this
pawn Код:
Fuel[vehicleid] -= GetPlayerSpeed(i)/1000;
or

Show ' GetPlayerSpeed '
lol?

i just forget add this

pawn Код:
stock GetPlayerSpeedx(playerid, bool:kmh = true)
{
    new
        Float:xx,
        Float:yy,
        Float:zz,
        Float:pSpeed;

    if(IsPlayerInAnyVehicle(playerid))
    {
        GetVehicleVelocity(GetPlayerVehicleID(playerid),xx,yy,zz);
    }
    else
    {
        GetPlayerVelocity(playerid,xx,yy,zz);
    }

    pSpeed = floatsqroot((xx * xx) + (yy * yy) + (zz * zz));
    return kmh ? floatround((pSpeed * 165.12)) : floatround((pSpeed * 103.9));
}
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Thanks for that , you remind me ^_^
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)