PlayerBar:CreatePlayerProgressBar(playerid, Float:x, Float:y, Float:width = 55.5, Float:height = 3.2, colour, Float:max = 100.0, direction = BAR_DIRECTION_RIGHT);
//Creates a progress bar for a player.
DestroyPlayerProgressBar(playerid, PlayerBar:barid);
//Destroys a player's progress bar.
ShowPlayerProgressBar(playerid, PlayerBar:barid);
//Shows a player's progress bar to them.
HidePlayerProgressBar(playerid, PlayerBar:barid);
//Hides a player's progress bar from them.
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(playerid, SomeX, SomeY, SomeZ, .direction = BAR_DIRECTION_LEFT); //Create the bar
SetPlayerProgressBarMaxValue(playerid, HealthBar[playerid], 100.0);
SetPlayerProgressBarColour(playerid, HealthBar[playerid], 0xFF0000AA);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyPlayerProgressBar(playerid, HealthBar[playerid]);
return 1;
}
public OnPlayerUpdate(playerid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
SetPlayerProgressBarValue(playerid, HealthBar[playerid], HP);
return 1;
}
PlayerBar:Bomb[MAX_PLAYERS];
CMD:wbomb(playerid, parmas[])
{
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(playerid, 1.5, -1954.2892, 291.3032, 41.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(playerid, HBCP[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(playerid, 74.00, 330.00, 61.50, 3.50, -1061109590, BAR_DIRECTION_RIGHT);
SetPlayerProgressBarMaxValue(playerid, Bomb[playerid], 100.0);
ShowPlayerProgressBar(playerid, Bomb[playerid]);
HTimer[WANG] = SetTimerEx("wangbomb",120000,false,"i",playerid);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/eg5ozskbs1/10*******.com_Bomb-Has-Been-Planted-Sound-Effect-CSGO_llCmtgvIqcY.mp3");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "[BOMB]: You are not on the bomb checkpoint!");
}
return 1;
}
forward wangbomb(playerid);
public wangbomb(playerid)
{
KillTimer(HTimer[WANG]);
SetPlayerProgressBarValue(playerid, Bomb[playerid], 0.0);
HidePlayerProgressBar(playerid, Bomb[playerid]);
HBombed[WANG] = 1;
HtCB[WANG] = gTeam[playerid];
HUnderBomb[WANG] = 0;
CreateExplosion(-1954.2892, 291.3032, 41.0471, 0, 40.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;
}
// new variable
new HTimerCount;
// when declaring timer
HTimerCount = 1;
HTimer[WANG] = SetTimerEx("wangbomb",1000,true,"i",playerid);
if (HTimerCount == 12) //12 seconds
{
}
else
{
}
HTimerCount++;
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 Код:
(when to destroy timer and stuff) pawn Код:
pawn Код:
pawn Код:
|