public OnPlayerBenchPress( playerid, reps )
{
printf( "ID %i has just benched, increasing his current reps to %i.", playerid, reps );
}
public OnPlayerStartBenchPress( playerid, result )
{
switch( result )
{
case 0:
{
SendClientMessage( playerid, 0x0, "You're not allowed to bench, someone is currently using it!" );
}
case 1:
{
SendClientMessage( playerid, 0x0, "{FFFFFF}You're now starting to bench, use the spacebar to increase the power bar." );
}
}
}
public OnPlayerExitBenchPress( playerid, reps )
{
printf( "Player %i has stopped bench pressing, and has done %i reps!", playerid, reps );
}
OnPlayerBenchPress( playerid, reps ) - Called when someone does a bench rep.
OnPlayerStartBenchPress( playerid, result ) - Called when someone starts to bench-press
OnPlayerExitBenchPress( playerid, reps ) - Called when a player stops bench-pressing.
OnPlayerStartBenchPress ( result ) 0 - Failure. 1 - Success.
Cyanide - Project Launcher & Developer Grim_ - Testing. ****** - YSI. Toribio - Progress Bar. SA-MP Team - San Andreas Multiplayer Modification.
Thank you very much sir!
You can use 1 progress bar FOR ALL PLAYERS ![]() |
No problem.
If I used one progress bar and multiple players are benching at once, it would cause a serious dysfunction. If you take a look at the progress include that I used for the filterscript, and looked at the source, you'll notice that it's not based off of clientids. Also, the parameters of the functions regarding value update clearly show it's not based off of clientids. |
It wont. I'm using two gauges for my server : Fuel, and vehicle health. There are ~100 online players. And you know what? I use only TWO Progress bars.
It has been tested, don't worry I know what i'm talking. |
stock Bar:CreateProgressBar(Float:x, Float:y, Float:width=55.5, Float:height=3.2, color, Float:max=100.0)
{
new
barid;
for(barid = 0; barid < sizeof Bars; ++barid)
if(!Bars[barid][pb_created]) break;
if(Bars[barid][pb_created] || barid == sizeof Bars)
return INVALID_BAR_ID;
new Text:in_t = Bars[barid][pb_t1] = TextDrawCreate(x, y, "_");
TextDrawUseBox (in_t, 1);
TextDrawTextSize (in_t, x + width, 0.0);
TextDrawLetterSize (in_t, 1.0, height / 10);
TextDrawBoxColor (in_t, 0x00000000 | (color & 0x000000FF));
in_t = Bars[barid][pb_t2] = TextDrawCreate(x + 1.2, y + 2.15, "_");
TextDrawUseBox (in_t, 1);
TextDrawTextSize (in_t, x + width - 2.0, 0.0);
TextDrawLetterSize (in_t, 1.0, height / 10 - 0.35);
TextDrawBoxColor (in_t, (color & 0xFFFFFF00) | (0x66 & ((color & 0x000000FF) / 2)));
in_t = Bars[barid][pb_t3] = TextDrawCreate(x + 1.2, y + 2.15, "_");
TextDrawTextSize (in_t, pb_percent(x, width, max, 1.0), 0.0);
TextDrawLetterSize (in_t, 1.0, height / 10 - 0.35);
TextDrawBoxColor (in_t, color);
Bars[barid][pb_x] = x;
Bars[barid][pb_y] = y;
Bars[barid][pb_w] = width;
Bars[barid][pb_h] = height;
Bars[barid][pb_m] = max;
Bars[barid][pb_color] = color;
Bars[barid][pb_created] = true;
return Bar:barid;
}
stock SetProgressBarValue(Bar:barid, Float:value)
{
if(barid == INVALID_BAR_ID || Bar:MAX_BARS < barid < Bar:-1)
return 0;
if(Bars[_:barid][pb_created])
{
value =
(value < 0.0) ? (0.0) : (value > Bars[_:barid][pb_m]) ? (Bars[_:barid][pb_m]) : (value);
TextDrawUseBox(Bars[_:barid][pb_t3], value > 0.0);
Bars[_:barid][pb_v] = value;
TextDrawTextSize(Bars[_:barid][pb_t3],
pb_percent(Bars[_:barid][pb_x], Bars[_:barid][pb_w], Bars[_:barid][pb_m], value), 0.0);
return 1;
}
return 0;
}
stock UpdateProgressBar(Bar:barid, playerid=INVALID_PLAYER_ID)
{
if(playerid == INVALID_PLAYER_ID)
{
return ShowProgressBarForAll(barid);
} else {
return ShowProgressBarForPlayer(playerid, barid);
}
}
stock ShowProgressBarForPlayer(playerid, Bar:barid)
{
if(IsPlayerConnected(playerid) && barid != INVALID_BAR_ID && Bar:-1 < barid < Bar:MAX_BARS)
{
if(!Bars[_:barid][pb_created])
return 0;
TextDrawShowForPlayer(playerid, Bars[_:barid][pb_t1]);
TextDrawShowForPlayer(playerid, Bars[_:barid][pb_t2]);
TextDrawShowForPlayer(playerid, Bars[_:barid][pb_t3]);
return 1;
}
return 0;
}
SetProgressBarValue(HealthBar, VehicleHealth);
UpdateProgressBar(HealthBar, playerid);