Progress bar not working correctly
#1

So im using the progress bar include to create some some, im working on a mechanic repair bar.
The mechanic asks someone to repair, the user accepts then a bar will come up, after it fills the car will be
repaired and the money taken from the user and added to mechanic. This is where iv set the repair stuff up.
Everything is working fine, the first time. But if I ask the player to do it a second time. The bar shows back up,
but no money is taken or given. Not too sure whats going on.

pawn Код:
forward RepairBarTimer(playerid);//playerid == playerb
public RepairBarTimer(playerid)
{
    //new playerb = BuyModFrom[playerid], price = BuyModPrice[playerid];
    new playerb = SellModTo[playerid], price = BuyModPrice[playerid]; //BuyModPrice[playerid]
    new string[128];
    if(GetProgressBarValue(RepairBar[playerid]) >= 100)
    {
            HideProgressBarForPlayer(playerid, RepairBar[playerid]);
            //HideProgressBarForPlayer(playerid, RepairBar[playerid]);
            RepairVehicle(GetPlayerVehicleID(playerb));
            PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
            PlayerPlaySound(playerb,1133,0.0,0.0,0.0);
            format(string, sizeof(string), "* %s has repaired the vehicle for $%d.", RPN(playerid), price);
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            GiveZaiatMoney(playerid, -price);
            GiveZaiatMoney(playerb, price);
            PlayerInfo[playerid][pJobSkill][JOB_MECHANIC] ++;
            SellModTo[playerid] = -1;
            BuyModFrom[playerb] = -1;
            BuyModPrice[playerb] = 0;
            BeenOfferedMod[playerb] = 0;
            SetProgressBarValue(RepairBar[playerid], 0);
            format(string, sizeof(string), "* You have repaired %s's vehicle for {0cff00}$%d.", RPN(playerb),price);
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, sizeof(string), "* Your vehicle has been repaired by %s for {0cff00}$%d.", RPN(playerid),price);
            SendClientMessage(playerb, COLOR_WHITE, string);
    }
    else
    {
        SetProgressBarValue(RepairBar[playerid], GetProgressBarValue(RepairBar[playerid])+1);
        UpdateProgressBar(RepairBar[playerid], playerid);
        SetTimerEx("RepairBarTimer", 100, false, "i", playerid);
    }
    return 1;
}
please disregard comments.
Reply
#2

What Gamemode u use for this bar?
Reply
#3

Nevermind I am a total idiot and was making a very dumb mistake. This code works exactly as it should.
Anyways, Roleplay.
Though everythings fine now. Thanks though.
edit: I hate when this happens, I try and try to get it working. Then I search then net for fixes. Finally I come to post here and BAM i figure out what the problem was.. Damnit :/ Sorry guys..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)