28.07.2012, 14:09
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.
please disregard comments.
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;
}