Anim Bug + Need help in progress bar
#1

Deleted.
Reply
#2

Try this instead
pawn Код:
if(IsPlayerInDynamicCP(playerid,WangCarsRobberyCP))
{
    if(WangCarsHasBeenRobbed >= 1) return SCM(playerid,COLOR_RED,"ERROR: This location has been robbed recently. Come back later");

    ApplyAnimation(playerid, "ROB_BANK", "CAT_Safe_Rob", 4.0, 1, 0, 0, 0, 0, 5000, 1); //---This doesn't work :@---
    SetPlayerAttachedObject(playerid, 3, 1550, 1, 0.1, -0.3, 0, 0, 40, 0, 1, 1, 1);
    RobbingWangCars[playerid] =15;
    SCM(playerid,COLOR_PINK,"ROBBERY: You are now robbing Wang car's, please wait until you've finished robbing.");
    return 1;
}
and about the progressbar
pawn Код:
//----------------Robbing Wang Cars----------------------------------------
if(RobbingWangCars[i] > 1)  //When player is robbing
{
RobbingWang[i] --;
WangRobbedRecently =200;
SetProgressBarValue(barid, 15.0);
ShowProgressBarForPlayer(playerid, barid)
}
Reply
#3

Pre-load the animation before.

pawn Код:
stock PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
And you'll have to set the value of the bar with SetProgressBarValue or SetPlayerProgressBarValue (depends on what version of the include you use).
Reply
#4

Deleted.
Reply
#5

I think robbingtime should be a global variable ? Try
pawn Код:
new robbingtime[MAX_PLAYERS];
forward RobberyBar(playerid);
public RobberyBar(playerid)
{
    robbingtime[playerid] ++;
    SetProgressBarValue(MyRobberyBar, robbingtime[playerid]);
    if(robbingtime == 15)
    {
        KillTimer(RobbingTime);
        HideProgressBarForPlayer(playerid,MyRobberyBar);
        HideProgressBarForPlayer(playerid,MyRobberyBar);
        robbingtime[playerid] = 0;
    }
    return 1;
}
Reply
#6

What xVIP3Rx said. Everytime RobberyBar is called, it gets initialized at 0 and then it goes 1. It'll never reach greater value. It should be global and don't forget to reset it too.

pawn Код:
// Let's save few memory:


// global:
new robbingtime[MAX_PLAYERS char];

// OnPlayerConnect:
robbingtime{ playerid } = 0;
pawn Код:
if(RobbingWangCars[i] > 1)  //When player is robbing
{
    RobbingWang[i] --;
    WangRobbedRecently =200;
    robbingtime{ playerid } = 0;
    ShowProgressBarForPlayer(playerid, MyRobberyBar);
    RobbingTime = SetTimerEx("RobberyBar",1000,true,"i",i);
}
pawn Код:
forward RobberyBar(playerid);
public RobberyBar(playerid)
{
    robbingtime{ playerid }++;
    SetProgressBarValue(MyRobberyBar,robbingtime);
    UpdateProgressBar(MyRobberyBar, playerid);
    if(robbingtime{ playerid } == 15)
    {
        robbingtime{ playerid } = 0;
        KillTimer(RobbingTime);
        HideProgressBarForPlayer(playerid,MyRobberyBar);
    }
}
I believe you should use each progress bar per player. MyRobberyBar will update for all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)