[Help]The /refuel I'ts Infinte
#1

Help me Forum Samp i have a problem When a User, use /refuel .... The Tank Refuel perfectly, But The cost of the Refuel Neverends

Example :

your tank has been filling its cost is $ 100
your tank has been filling its cost is $ 100
your tank has been filling its cost is $ 100
your tank has been filling its cost is $ 100
your tank has been filling its cost is $ 100

Never end !!


( is a problem Of Gas Station )

Sorry for My Bad English Guys :3


I can Give Images Later
Reply
#2

Post code
Reply
#3

We can't help you without the code.
Reply
#4

Do you have it in a loop? If so remove it and put it outside the loop
Reply
#5

You expect us to help you with guessing your code in advance? No one will steal your code and put it in his mode.

Show us the loop.
Reply
#6

There "new"

pawn Код:
new RefuelingVehicle[MAX_PLAYERS];
new RefuelingVehiclePrice[MAX_PLAYERS];
new RefuelingVehicleTimer[MAX_PLAYERS];
pawn Код:
stock StopRefueling(playerid)
{
    GivePlayerCash(playerid, -100);
    SendFormattedMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $100.");

    new mypoint = -1;
    for (new i=0; i<MAX_POINTS; i++)
    {
        if(strcmp(Points[i][Name], "Fossil Fuel Company", true) == 0)
        {
            mypoint = i;
        }
    }
    for(new i = 0; i < sizeof(FamilyInfo); i++)
    {
        if(strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0)
        {
            FamilyInfo[i][FamilyBank] = FamilyInfo[i][FamilyBank]+(RefuelingVehiclePrice[playerid]/10);
        }
    }

    RefuelingVehicle[playerid] = 0; RefuelingVehiclePrice[playerid] = 0; KillTimer(RefuelingVehicleTimer[playerid] = 6000);
    return true;
}
( I think that is the problem ( No have "Return" )


pawn Код:
IsAtFuelStation(playerid)
{
    new Float:X, Float:Y, Float:Z;
    GetObjectPos(Carrier[0], X, Y, Z);
    if(IsPlayerInRangeOfPoint(playerid,10,1595.5406, 2198.0520, 10.3863) || IsPlayerInRangeOfPoint(playerid,10,2202.0649, 2472.6697, 10.5677) ||
    IsPlayerInRangeOfPoint(playerid,10,2115.1929, 919.9908, 10.5266) || IsPlayerInRangeOfPoint(playerid,10,2640.7209, 1105.9565, 10.5274) ||
    IsPlayerInRangeOfPoint(playerid,10,608.5971, 1699.6238, 6.9922) || IsPlayerInRangeOfPoint(playerid,10,618.4878, 1684.5792, 6.9922) ||
    IsPlayerInRangeOfPoint(playerid,10,2146.3467, 2748.2893, 10.5245) || IsPlayerInRangeOfPoint(playerid,10,-1679.4595, 412.5129, 6.9973) ||
    IsPlayerInRangeOfPoint(playerid,10,-1327.5607, 2677.4316, 49.8093) || IsPlayerInRangeOfPoint(playerid,10,-1470.0050, 1863.2375, 32.3521) ||
    IsPlayerInRangeOfPoint(playerid,10,-2409.2200, 976.2798, 45.2969) || IsPlayerInRangeOfPoint(playerid,10,-2244.1396, -2560.5833, 31.9219) ||
    IsPlayerInRangeOfPoint(playerid,10,-1606.0544, -2714.3083, 48.5335) || IsPlayerInRangeOfPoint(playerid,10,1937.4293, -1773.1865, 13.3828) ||
    IsPlayerInRangeOfPoint(playerid,10,-91.3854, -1169.9175, 2.4213) || IsPlayerInRangeOfPoint(playerid,10,1383.4221, 462.5385, 20.1506) ||
    IsPlayerInRangeOfPoint(playerid,10,660.4590, -565.0394, 16.3359) || IsPlayerInRangeOfPoint(playerid,10,1381.7206, 459.1907, 20.3452) ||
    IsPlayerInRangeOfPoint(playerid,10,-1605.7156, -2714.4573, 48.5335) || IsPlayerInRangeOfPoint(playerid,20,1882.2546,-2393.9824,16.5144) ||
    IsPlayerInRangeOfPoint(playerid,10,1386.5360,-271.5511,-0.4857) || IsPlayerInRangeOfPoint(playerid,10,2017.3016,-229.9219,-0.2183) ||
    IsPlayerInRangeOfPoint(playerid,10,279.1325,1940.4025,17.6406) || IsPlayerInRangeOfPoint(playerid,250,X, Y, Z))
    {   return true; }
    return false;
}
[pawn] RefuelingVehicle[playerid] = 0; FuelBar[playerid] = INVALID_BAR_ID; [pawn]

pawn Код:
RefuelingVehicle[playerid] = 0; FuelBar[playerid] = INVALID_BAR_ID;
    RefuelingVehiclePrice[playerid] = 0; HouseOffer[playerid] = 999; House[playerid] = 0; HousePrice[playerid] = 0;
pawn Код:
CMD:refuel(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine == VEHICLE_PARAMS_ON) return SendClientMessageEx(playerid, COLOR_RED, "You need to shut off the engine before filling up (/car engine).");
        if(!IsAtFuelStation(playerid)) return SendClientMessageEx(playerid, COLOR_RED, "You're not at a fuel station.");
        if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
        if(VehicleFuel[vehicleid] >= 100.0) return SendClientMessageEx(playerid, COLOR_RED, "This vehicle's tank is already full.");
        if(RefuelingVehicle[playerid] == 1) return SendClientMessageEx(playerid, COLOR_RED, "You are refilling your vehicle's tank.");
        SendClientMessageEx(playerid, COLOR_WHITE, "Refueling your vehicle's tank, please wait.");
        RefuelingVehicle[playerid] = 1;
        RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, true, "i", playerid);
    }
    return 1;
}
This is All Coding Of have "Refuel" XD function
Reply
#7

RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, true, "i", playerid);

to

RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, false, "i", playerid);

https://sampwiki.blast.hk/wiki/SetTimer
Reply
#8

Not Friend... I changed it But other problem The Car Never Refuel....

Example

the car have 50 % of Gas

/refuel

The car are Refueling.. Please Wait......

And No Upload Gas Status.... Always in 50% ( On the example)
Reply
#9

I will reactivate Topic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)