Help with include.
#1

Hello all, I saw an include called "Progress V2"(Correct me if I am wrong).

So i need help in knowing how do i make the progress bars, and its co-ordinates, I need to know that how can we script according to the time, like I need it for 5 seconds only. So how do I do it?

Thanks.

regards,
DeeadPool
Reply
#2

PHP код:
PlayerBar:CreatePlayerProgressBar(playeridFloat:xFloat:yFloat:width 55.5Float:height 3.2colourFloat:max 100.0direction BAR_DIRECTION_RIGHT);
//Creates a progress bar for a player. 
If you want it for 5 seconds only you could create a function that has a timer of 5 seconds and show the progress bar, then once those 5 seconds are over hide the progress bar.

PHP код:
DestroyPlayerProgressBar(playeridPlayerBar:barid);
//Destroys a player's progress bar.
ShowPlayerProgressBar(playeridPlayerBar:barid);
//Shows a player's progress bar to them.
HidePlayerProgressBar(playeridPlayerBar:barid);
//Hides a player's progress bar from them. 
Reply
#3

All that information is on the forum page of the include. Also, as you can see this function has a tag: "PlayerBar", meaning new variables should contain that tag as well.
Example:

PHP код:
new PlayerBar:HealthBar[MAX_PLAYERS]; //Create the variable; notice that I am using an array (MAX_PLAYERS); If you won't do this, you can only have one bar on this variable, and that would make it useless to use per-player
public OnPlayerConnect(playerid)
{
    
HealthBar[playerid] = CreatePlayerProgressBar(playeridSomeXSomeYSomeZ, .direction BAR_DIRECTION_LEFT); //Create the bar
    
SetPlayerProgressBarMaxValue(playeridHealthBar[playerid], 100.0);
    
SetPlayerProgressBarColour(playeridHealthBar[playerid], 0xFF0000AA);
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
DestroyPlayerProgressBar(playeridHealthBar[playerid]);
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    new 
Float:HP;
    
GetPlayerHealth(playeridHP);
    
SetPlayerProgressBarValue(playeridHealthBar[playerid], HP);
    return 
1;

Reply
#4

Thank you all.

But how can I make it for a timer?
Reply
#5

Quote:
Originally Posted by DeeadPool
Посмотреть сообщение
Thank you all.

But how can I make it for a timer?
By starting a timer? https://sampwiki.blast.hk/wiki/SetTimer, https://sampwiki.blast.hk/wiki/SetTimerEx, https://sampwiki.blast.hk/wiki/KillTimer

Hide or destroy the progress bar when the public function executes. Or update the timer with proportional incremental values if that's how you want it. Then hide it when it's full.

For creating progress bars: http://forum.sa-mp.com/showpost.php?...7&postcount=10
Reply
#6

Can you please create one demo script for me? I tryed a lot but I am not able to do it. +REP
Reply
#7

No, sorry. The purpose of this section is to request help on code you create, not to request code to be made for you. Post what you have tried.
Reply
#8

This what i tried:-

At top of the script:-
PHP код:
PlayerBar:Bomb[MAX_PLAYERS]; 
The script:-
PHP код:
CMD:wbomb(playeridparmas[])
{
   
if(
gTeam[playerid] == TEAM_DEFENDERS) return SendClientMessage(playerid, -1" What are you doing soldier! You have to protect the bomb sites not to destroy them!");
if(
IsPlayerInRangeOfPoint(playerid1.5, -1954.2892291.303241.0471))
  {
    
     if(
IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,-1,"You cant plant bomb while youre On Vehicle!");
     if(
HtCB[WANG] == gTeam[playerid])return SendClientMessage(playerid,-1,"This bomb area already bombed by your Team!");
     if(
HUnderBomb[WANG] == 1)return SendClientMessage(playerid,-1,"This area is already bombed by someone else!");
     if(!
IsPlayerInDynamicCP(playeridHBCP[WANG]))return SendClientMessage(playerid,-1,"You are not on bomb CP!");
     
HIsPlayerBombing[WANG] = 1;
     
HBombed[WANG] = 0;
     
HUnderBomb[WANG] = 1;
     
SendClientMessageToAll(COLOR_ORANGE"[BOMB]: {FFFFFF}Bomb has been planted at {FF0000}'Wang Cars'{FFFFFF}. Defenders go defuse it before it's to late!");
     
Bomb[playerid] = CreatePlayerProgressBar(playerid74.00330.0061.503.50, -1061109590BAR_DIRECTION_RIGHT);
     
SetPlayerProgressBarMaxValue(playeridBomb[playerid], 100.0);
     
ShowPlayerProgressBar(playeridBomb[playerid]);
     
HTimer[WANG] = SetTimerEx("wangbomb",120000,false,"i",playerid);
     
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.000000);
     for(new 
0MAX_PLAYERSi++)
   {
     
PlayAudioStreamForPlayer(i"http://k003.kiwi6.com/hotlink/eg5ozskbs1/10*******.com_Bomb-Has-Been-Planted-Sound-Effect-CSGO_llCmtgvIqcY.mp3");
   }
   }
else
  {
    
SendClientMessage(playeridCOLOR_RED"[BOMB]: You are not on the bomb checkpoint!");
  }
 return 
1;
}
forward wangbomb(playerid);
public 
wangbomb(playerid)
{
KillTimer(HTimer[WANG]);
SetPlayerProgressBarValue(playeridBomb[playerid], 0.0);
HidePlayerProgressBar(playeridBomb[playerid]);
HBombed[WANG] = 1;
HtCB[WANG] = gTeam[playerid];
HUnderBomb[WANG] = 0;
CreateExplosion(-1954.2892291.303241.0471040.0);
SendClientMessage(playerid,-1,"Congratulation, you have Bombed this zone! ans earned 10 score and $2000");
SendClientMessageToAll(COLOR_ORANGE"[BOMB]:{FFFFFF} The bomb successfully exploded at {FF0000}'Wang Cars'{FFFFFF}. Good Job Attackers!");
GivePlayerMoney(playerid,2000);
SetPlayerScore(playerid,GetPlayerScore(playerid)+10);
return 
1;

The bar is created, but the value in the bar does not decrease, and simply when the timer ends, it gets destoyed, just tell me how do I decrease the value according to the timer
Reply
#9

You have to set the timer on repeat on a smaller relevant interval.

And a new variable to count the number of times the timer is being called, as to record the countdown.
pawn Код:
// new variable
new HTimerCount;

// when declaring timer
HTimerCount = 1;
HTimer[WANG] = SetTimerEx("wangbomb",1000,true,"i",playerid);
SO your "wangbomb" have to be modified with a count check:
(when to destroy timer and stuff)
pawn Код:
if (HTimerCount == 12) //12 seconds
{
}
How to update progress bar:
pawn Код:
else
{
}
And you also need to increase the variable count "HTimerCount": (this goes outside of the if-else)
pawn Код:
HTimerCount++;
Reply
#10

Quote:
Originally Posted by Gammix
Посмотреть сообщение
You have to set the timer on repeat on a smaller relevant interval.

And a new variable to count the number of times the timer is being called, as to record the countdown.
pawn Код:
// new variable
new HTimerCount;

// when declaring timer
HTimerCount = 1;
HTimer[WANG] = SetTimerEx("wangbomb",1000,true,"i",playerid);
SO your "wangbomb" have to be modified with a count check:
(when to destroy timer and stuff)
pawn Код:
if (HTimerCount == 12) //12 seconds
{
}
How to update progress bar:
pawn Код:
else
{
}
And you also need to increase the variable count "HTimerCount": (this goes outside of the if-else)
pawn Код:
HTimerCount++;
@Gammix I am not able to get you, can show make a proper example for me?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)