Need help about the progressbars :) [+REP]
#1

At this /robbank

I want the progress bar work. The timer should be 60 seconds, after the 60 seconds. The robtimer should work.

Код:
RobbingTimer[playerid] = SetTimerEx("robtimer", 300000, false, "i", playerid);
Код:
CMD:robbank(playerid, params[])
{
        if(robpossible == 1) //If the bank can be robbed we continue below
        {
                if(IsPlayerInRangeOfPoint(playerid, 2.0, 2319.2310,-2.0349,26.7496))
                {//Next thing we do is, we check if we are at the bank interior ^^
                
                    if(PlayerInfo[playerid][pWantedLevel] >= 3) return SendClientMessage(playerid, COLOR_GRAD2, "You already have 3+ star! You cant do /robbank this moment");
                    if(AdminDuty[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "You cant rob bank while on duty ^^");
                    if(IsACop(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "Sorry!! Cops cannot /robbank");
                    
                    robpossible = 0; //Then we set the bank so it cannot be robbed
                    SetTimer("waittimer", 900000, false); //Normal Mode 5 minutes
                    //SetTimer("waittimer", 65000, false); //Test Mode 65 seconds
                   
                    /* We also run another timer(1 minute) for the function that is
                    actually going to give us the money and a user friendly message.
                    */
                    /*
                    Add a function that would notify the police.
                    */

                    SendClientMessageToAll(COLOR_GREEN,"[BREAKING NEWS] Bank is being robbed, do not come near the bank!");
			        SendClientMessageToAll(0x0080FFFF, "Alerting all POLICE to come at bank As Soon as possible!!!");
			        SendClientMessageToAll(0x0080FFFF, "Lahat ng police PUMUNTA sa BANK ngayon din!!!");

                    SendClientMessage(playerid, 0xFF0000FF, "You are robbing the bank, the police has been notified!");
            		SendClientMessage(playerid, 0x008000FF, "You gotta stay 5 minutes before you get the moneys!!!");
            		
            		/*++PlayerInfo[playerid][pCrimes];
            		++PlayerInfo[playerid][pCrimes];
            		++PlayerInfo[playerid][pCrimes];
            		
					SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);
					SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);
					SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);*/
					
					PlayerInfo[playerid][pCrimes] = 3;
					SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWantedLevel] = 3);
					
					GameTextForPlayer(playerid, "~r~ALERT: BANK IS BEING ROB!", 3, 5000);
				 	//SetTimer("robtimer", 300000, false);
				 	
				 	RobbingTimer[playerid] = SetTimerEx("robtimer", 300000, false, "i", playerid);
				 	
				 	RobberBusted[playerid] = 0;
				 	pBankRobbing[playerid] = 1;
				 	
				 	new RobBankProgress: RobBankProgress = CreateProgressBar(221.00, 147.00, 194.50, 3.50, 16711935, 100.0);
					

                 } else return SendClientMessage(playerid, COLOR_WHITE, "You are not in BANK SAFE!!");
        } else {
            SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now! Already rob or waiting for cool down");
        }
        return 1;
}
How? Thanks

I really promise i will give a +rep
Reply
#2

Here you go:
pawn Код:
new PlayerBar:RobBankProgress[MAX_PLAYERS];
new RobbingTimer[MAX_PLAYERS];
new bankUpdater[MAX_PLAYERS];
new Robbing[MAX_PLAYERS];

forward RobBankProgress(playerid);
public RobBankProgress(playerid)
{
     if(Robbing[playerid] == 1)
    {
        KillTimer(RobbingTimer[playerid]);
        bankUpdater[playerid] = SetTimerEx("robtimer", 300000, false, "i", playerid);
        RobBankProgress = CreateProgressBar(221.00, 147.00, 194.50, 3.50, 16711935, 100.0);
        Robbing[playerid] -= 5;
        SetPlayerProgressBarValue(playerid, RobBankProgress[playerid], Robbing[playerid]);
        UpdatePlayerProgressBar(playerid, RobBankProgress[playerid]);
        ShowPlayerProgressBar(playerid, RobBankProgress[playerid]);
    }
    else if(Robbing[playerid] == 0)
    {
        KillTimer(RobbingTimer[playerid]);
        DestroyProgressBar(RobBankProgress[playerid]);
    }
    return 1;
}
Dont give relp before its works not.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)