|
|
#281 | |
|
Banned
![]() Join Date: Apr 2009
Location: England
Posts: 4,013
Reputation: 701
|
Quote:
![]() As for updating it, if this is XP related then just check it whenever you give or take XP from a player, there's no point running the check all the time. For instance, in my game I have a function called GiveExp(playerid, amount, etc...) whenever this is called it shows the textdraw with the amount etc, updates the player variable then right at the end it performs a rank check to see if the new XP amount levels the player up! And this function is called whenever I give XP, that means no direct variable setting otherwise the player won't know (as he won't see the textdraw) and the bar won't update. I recommend you use this method instead of a timer!
|
|
|
|
|
|
|
#282 | |
|
Big Clucker
![]() ![]() Join Date: Jan 2010
Location: Turkey
Posts: 86
Reputation: 5
|
Quote:
I will do like you said,i have GivePlayerExp(playerid,xp) func too.It's easy to make
|
|
|
|
|
|
|
#283 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 305
Reputation: 38
|
Ok ths for script
and goodgame maybe you will post a tutoriral about how to use it EDIT: when i try the old version 26 errors i Tried the next version 26 errors and again 26 errors Code:
D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(17) : error 017: undefined symbol "_progress_version" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(34) : error 017: undefined symbol "MAX_BARS" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(34) : error 009: invalid array size (negative, zero or out of bounds) D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(74) : error 017: undefined symbol "pb_x" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(75) : error 017: undefined symbol "pb_y" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(76) : error 017: undefined symbol "pb_w" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(77) : error 017: undefined symbol "pb_h" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(78) : error 017: undefined symbol "pb_color" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(83) : error 017: undefined symbol "pb_x" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(83) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(84) : error 017: undefined symbol "pb_y" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(84) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(85) : error 017: undefined symbol "pb_w" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(85) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(86) : error 017: undefined symbol "pb_h" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(86) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(87) : error 017: undefined symbol "pb_color" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(92) : error 017: undefined symbol "pb_x" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(92) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(93) : error 017: undefined symbol "pb_y" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(93) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(94) : error 017: undefined symbol "pb_w" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(94) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(95) : error 017: undefined symbol "pb_h" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(95) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(96) : error 017: undefined symbol "pb_color" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(111) : error 017: undefined symbol "DestroyProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(166) : error 017: undefined symbol "CreateProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(166) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(167) : error 017: undefined symbol "SetProgressBarValue" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(168) : error 017: undefined symbol "ShowProgressBarForPlayer" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(204) : error 017: undefined symbol "DestroyProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(217) : error 017: undefined symbol "CreateProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(222) : error 017: undefined symbol "SetProgressBarValue" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(223) : error 017: undefined symbol "ShowProgressBarForPlayer" Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 26 Errors. Code:
/**
* Progress Bar Creator
* Copyright 2007-2010 Infernus' Group,
* Flávio Toribio (flavio_toribio@hotmail.com)
*
* This is an add-on for the include Progress Bar
* http://forum.sa-mp.com/index.php?topic=138556
*/
#include <a_samp>
#include <progress>
#if !defined SetPVarInt
#error Version 0.3 R7 or higher of SA:MP Server requiered
#endif
#if _progress_version < 0x1310
#error Version 1.3.1 or higher of progress.inc required
#endif
#define DIALOG_BAR 1834
#define DIALOG_COLOR 1835
#define DIALOG_DONE 1836
#define ITEM_MOVE 0
#define ITEM_RESIZE 1
#define ITEM_COLOR 2
#define ITEM_DONE 3
#define MOVE_NONE 0
#define MOVE_POSITION 1
#define MOVE_SIZE 2
static Bars[MAX_BARS][e_bar];
public OnFilterScriptInit()
{
for(new i = 0; i < MAX_PLAYERS; ++i) if(IsPlayerConnected(i))
{
OnPlayerSpawn(i);
}
print("Progress Bar Creator by Flavio Toribio loaded");
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < MAX_PLAYERS; ++i) if(IsPlayerConnected(i))
{
OnPlayerDisconnect(i, 0);
if(GetPVarInt(i, "MovingBar"))
{
TogglePlayerControllable(i, true);
}
if(GetPVarInt(i, "CreatingBar"))
{
DeletePVar(i, "BarID");
DeletePVar(i, "MovingBar");
DeletePVar(i, "CreatingBar");
}
}
print("Progress Bar Creator by Flavio Toribio unloaded");
return 1;
}
public OnPlayerSpawn(playerid)
{
SendClientMessage(playerid, 0xFFF000AA, "Use /bar to start making a progress bar!");
return 1;
}
GetVars(index, &Float:x, &Float:y, &Float:w, &Float:h, &color)
{
x = Bars[index][pb_x];
y = Bars[index][pb_y];
w = Bars[index][pb_w];
h = Bars[index][pb_h];
color = Bars[index][pb_color];
}
UpdateVars(index, Float:x, Float:y, Float:w, Float:h, color)
{
Bars[index][pb_x] = x;
Bars[index][pb_y] = y;
Bars[index][pb_w] = w;
Bars[index][pb_h] = h;
Bars[index][pb_color] = color;
}
DeleteVars(index)
{
Bars[index][pb_x] = 0.0;
Bars[index][pb_y] = 0.0;
Bars[index][pb_w] = 0.0;
Bars[index][pb_h] = 0.0;
Bars[index][pb_color] = 0;
}
public OnPlayerUpdate(playerid)
{
if(GetPVarInt(playerid, "MovingBar"))
{
new keys, ud, lr;
GetPlayerKeys(playerid, keys, ud, lr);
new Bar:barid = Bar:GetPVarInt(playerid, "BarID");
new Float:x, Float:y, Float:w, Float:h, color;
if(ud || lr)
{
DestroyProgressBar(barid);
GetVars(_:barid, x, y, w, h, color);
DeleteVars(_:barid);
if(ud == KEY_UP)
{
if(GetPVarInt(playerid, "MovingBar") == MOVE_POSITION)
{
y -= keys & KEY_SPRINT ? 2.0 : 1.0;
if(y < 0.0) y = 0.0;
}
else if(GetPVarInt(playerid, "MovingBar") == MOVE_SIZE)
{
h -= keys & KEY_SPRINT ? 2.0 : 1.0;
if(h < 1.5) h = 1.5;
}
}
else if(ud == KEY_DOWN)
{
if(GetPVarInt(playerid, "MovingBar") == MOVE_POSITION)
{
y += keys & KEY_SPRINT ? 2.0 : 1.0;
if(y > 480.0) y = 480.0;
}
else if(GetPVarInt(playerid, "MovingBar") == MOVE_SIZE)
{
h += keys & KEY_SPRINT ? 2.0 : 1.0;
if(h > 480.0) h = 480.0;
}
}
if(lr == KEY_LEFT)
{
if(GetPVarInt(playerid, "MovingBar") == MOVE_POSITION)
{
x -= keys & KEY_SPRINT ? 2.0 : 1.0;
if(x < 0.0) x = 0.0;
}
else if(GetPVarInt(playerid, "MovingBar") == MOVE_SIZE)
{
w -= keys & KEY_SPRINT ? 2.0 : 1.0;
if(w < 1.5) w = 1.5;
}
}
else if(lr == KEY_RIGHT)
{
if(GetPVarInt(playerid, "MovingBar") == MOVE_POSITION)
{
x += keys & KEY_SPRINT ? 2.0 : 1.0;
if(x > 640.0) x = 640.0;
}
else if(GetPVarInt(playerid, "MovingBar") == MOVE_SIZE)
{
w += keys & KEY_SPRINT ? 2.0 : 1.0;
if(w > 640.0) w = 640.0;
}
}
barid = CreateProgressBar(x, y, w, h, color, 100.0);
SetProgressBarValue(barid, 50.0);
ShowProgressBarForPlayer(playerid, barid);
UpdateVars(_:barid, x, y, w, h, color);
SetPVarInt(playerid, "BarID", _:barid);
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if(GetPVarInt(playerid, "MovingBar"))
{
TogglePlayerControllable(playerid, true);
SetPVarInt(playerid, "MovingBar", MOVE_NONE);
SendClientMessage(playerid, 0xFFF000AA, "Now you can use /bar again to modify or finalize it.");
}
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPVarInt(playerid, "MovingBar"))
{
TogglePlayerControllable(playerid, true);
SetPVarInt(playerid, "MovingBar", MOVE_NONE);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(GetPVarInt(playerid, "CreatingBar") == 1)
{
DestroyProgressBar(Bar:GetPVarInt(playerid, "BarID"));
DeleteVars(GetPVarInt(playerid, "BarID"));
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/bar", true))
{
if(GetPVarInt(playerid, "CreatingBar") == 0)
{
new Bar:barid;
if((barid = CreateProgressBar(320.0, 240.0, 56.50, 3.39, 0xFF0000FF, 100.0)) == INVALID_BAR_ID)
{
SendClientMessage(playerid, 0xFF0000AA, "Internal error occurred when creating progress bar.");
return 1;
}
SetProgressBarValue(barid, 50.0);
ShowProgressBarForPlayer(playerid, barid);
TogglePlayerControllable(playerid, false);
UpdateVars(_:barid, 320.0, 240.0, 55.5, 3.2, 0xFF0000FF);
SetPVarInt(playerid, "MovingBar", MOVE_POSITION);
SetPVarInt(playerid, "CreatingBar", 1);
SetPVarInt(playerid, "BarID", _:barid);
SendClientMessage(playerid, 0xFFF000AA, "Use the arrow keys to move the bar arround the screen.");
SendClientMessage(playerid, 0xFFF000AA, "Keep pressing 'Sprint' key to move faster.");
SendClientMessage(playerid, 0xFFF000AA, "Press the 'Enter car' key when done.");
}
else
{
ShowPlayerDialog(playerid, DIALOG_BAR, DIALOG_STYLE_LIST, "Progress Bar", "Change Position\nChange Size\nChange Color\nI'm done, save bar!", "OK", "Cancel");
}
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_BAR)
{
if(response)
{
if(listitem == ITEM_MOVE)
{
SetPVarInt(playerid, "MovingBar", MOVE_POSITION);
TogglePlayerControllable(playerid, false);
SendClientMessage(playerid, 0xFFF000AA, "Use the arrow keys to move the bar arround the screen.");
SendClientMessage(playerid, 0xFFF000AA, "Keep pressing 'Sprint' key to move faster.");
SendClientMessage(playerid, 0xFFF000AA, "Press the 'Enter car' key when done.");
}
else if(listitem == ITEM_RESIZE)
{
SetPVarInt(playerid, "MovingBar", MOVE_SIZE);
TogglePlayerControllable(playerid, false);
SendClientMessage(playerid, 0xFFF000AA, "Use the arrow keys to resize the bar.");
SendClientMessage(playerid, 0xFFF000AA, "Keep pressing 'Sprint' key to resize faster.");
SendClientMessage(playerid, 0xFFF000AA, "Press the 'Enter car' key when done.");
}
else if(listitem == ITEM_COLOR)
{
ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_INPUT, "Change Color", "Type the color in hexadecimal format.\nExample: 0xFFF000FF\nRemember the alpha parameter (the last 2 numbers),\nthey define the transparency.\nIf you have doubts, use an external Color Picker.", "OK", "Cancel");
}
else if(listitem == ITEM_DONE)
{
ShowPlayerDialog(playerid, DIALOG_DONE, DIALOG_STYLE_INPUT, "Saving Bar", "Type the file name which you want to save the bar;\nYou don't need to specify the extension;\nThe default one is .txt;\nThe file will be created in the scriptfiles folder;\nAny file with the same name will be replaced automatically.", "Save", "Cancel");
}
}
}
else if(dialogid == DIALOG_COLOR)
{
SetProgressBarColor(Bar:GetPVarInt(playerid, "BarID"), hexstr(inputtext));
UpdateProgressBar(Bar:GetPVarInt(playerid, "BarID"), playerid);
Bars[GetPVarInt(playerid, "BarID")][pb_color] = hexstr(inputtext);
}
else if(dialogid == DIALOG_DONE)
{
new File:file, name[32], line[128], barid;
if(strlen(inputtext) > 32 - 4)
{
strdel(inputtext, 32 - 4, strlen(inputtext));
}
format(name, sizeof name, "%s.txt", inputtext);
if(!(file = fopen(name, io_write)))
{
SendClientMessage(playerid, 0xFF0000AA, "There was an error on file writing, try again.");
ShowPlayerDialog(playerid, DIALOG_DONE, DIALOG_STYLE_INPUT, "Saving Bar", "Type the file name which you want to save the bar;\nYou don't need to specify the extension;\nThe default one is .txt;\nThe file will be created in the scriptfiles folder;\nAny file with the same name will be replaced automatically.", "Save", "Cancel");
return 1;
}
barid = GetPVarInt(playerid, "BarID");
format(line, sizeof line, "new Bar:bar = CreateProgressBar(%.2f, %.2f, %.2f, %.2f, %d, 100.0);\r\n",
Bars[barid][pb_x], Bars[barid][pb_y], Bars[barid][pb_w], Bars[barid][pb_h], Bars[barid][pb_color]);
fwrite(file, line);
fwrite(file, "ShowProgressBarForAll(bar);\r\n");
fwrite(file, "\r\nNow, take a look at the official SA:MP forum topic to know how to use this:\r\n\r\nhttp://forum.sa-mp.com/index.php?topic=138556\r\n");
fclose(file);
DeleteVars(barid);
DestroyProgressBar(Bar:barid);
DeletePVar(playerid, "BarID");
DeletePVar(playerid, "MovingBar");
DeletePVar(playerid, "CreatingBar");
SendClientMessage(playerid, 0xFFFF00AA, "All done! Now take a look at your file to see the result!");
SendClientMessage(playerid, 0xFFFFFFAA, "You can create another progress bar now.");
}
return 1;
}
stock hexstr(string[])
{
new ret, val, i;
if(string[0] == '0' && (string[1] == 'x' || string[1] == 'X')) i = 2;
while(string[i])
{
ret <<= 4;
val = string[i++] - '0';
if(val > 0x09) val -= 0x07;
if(val > 0x0F) val -= 0x20;
if(val < 0x01) continue;
if(val < 0x10) ret += val;
}
return ret;
}
Code:
/**
* Progress Bar 1.3.1.0
* Copyright 2007-2010 Infernus' Group,
* Flávio Toribio (flavio_toibio@hotmail.com)
*
* Updated by Southclaw for use with the PlayerTextDraws of 0.3e
*
*/
#if defined _playerprogress_included
#endinput
#endif
#if !defined _samp_included
#tryinclude <a_samp>
#if !defined _samp_included
#error could not locate a_samp.inc file, please check your server includes
#endif
#endif
#tryinclude <foreach>
#define _playerprogress_included
#define _playerprogress_version 0x1310
#define MAX_PLAYER_BARS (MAX_PLAYER_TEXT_DRAWS / 3)
#define INVALID_PLAYER_BAR_VALUE (Float:0xFFFFFFFF)
#define INVALID_PLAYER_BAR_ID (PlayerBar:-1)
#define pb_percent(%1,%2,%3,%4) ((%1 - 6.0) + ((((%1 + 6.0 + %2 - 2.0) - %1) / %3) * %4))
//pb_percent(x, width, max, value)
/* Pawno/Infernus Pawn Editor function list
native PlayerBar:CreatePlayerProgressBar(playerid, Float:x, Float:y, Float:width=55.5, Float:height=3.2, color, Float:max=100.0);
native DestroyPlayerProgressBar(playerid, PlayerBar:barid);
native ShowPlayerProgressBar(playerid, PlayerBar:barid);
native HidePlayerProgressBar(playerid, PlayerBar:barid);
native SetPlayerProgressBarValue(playerid, PlayerBar:barid, Float:value);
native Float:GetPlayerProgressBarValue(playerid, PlayerBar:barid);
native SetPlayerProgressBarMaxValue(playerid, PlayerBar:barid, Float:max);
native SetPlayerProgressBarColor(playerid, PlayerBar:barid, color);
native UpdatePlayerProgressBar(playerid, PlayerBar:barid);
*/
forward PlayerBar:CreatePlayerProgressBar(playerid, Float:x, Float:y, Float:width=55.5, Float:height=3.2, color, Float:max=100.0);
forward Float:GetPlayerProgressBarValue(playerid, PlayerBar:barid);
enum e_pbar
{
Float:ppb_x,
Float:ppb_y,
Float:ppb_w,
Float:ppb_h,
Float:ppb_m,
Float:ppb_v,
PlayerText:ppb_t1,
PlayerText:ppb_t2,
PlayerText:ppb_t3,
ppb_color,
bool:ppb_created
}
static PlayerBars[MAX_PLAYERS][MAX_PLAYER_BARS][e_pbar];
stock PlayerBar:CreatePlayerProgressBar(playerid, Float:x, Float:y, Float:width=55.5, Float:height=3.2, color, Float:max=100.0)
{
new
barid;
for(barid = 0; barid < MAX_PLAYER_BARS; ++barid) // Changed from `Bars` to `MAX_PLAYER_BARS` rather than getting the size of the second cell
if(!PlayerBars[playerid][barid][ppb_created]) break;
if(PlayerBars[playerid][barid][ppb_created] || barid == MAX_PLAYER_BARS)
return INVALID_PLAYER_BAR_ID;
new PlayerText:in_t = PlayerBars[playerid][barid][ppb_t1] = CreatePlayerTextDraw(playerid, x, y, "_");
PlayerTextDrawUseBox (playerid, in_t, 1);
PlayerTextDrawTextSize (playerid, in_t, x + width, 0.0);
PlayerTextDrawLetterSize (playerid, in_t, 1.0, height / 10);
PlayerTextDrawBoxColor (playerid, in_t, 0x00000000 | (color & 0x000000FF));
in_t = PlayerBars[playerid][barid][ppb_t2] = CreatePlayerTextDraw(playerid, x + 1.2, y + 2.15, "_");
PlayerTextDrawUseBox (playerid, in_t, 1);
PlayerTextDrawTextSize (playerid, in_t, x + width - 2.0, 0.0);
PlayerTextDrawLetterSize (playerid, in_t, 1.0, height / 10 - 0.35);
PlayerTextDrawBoxColor (playerid, in_t, (color & 0xFFFFFF00) | (0x66 & ((color & 0x000000FF) / 2)));
in_t = PlayerBars[playerid][barid][ppb_t3] = CreatePlayerTextDraw(playerid, x + 1.2, y + 2.15, "_");
PlayerTextDrawTextSize (playerid, in_t, pb_percent(x, width, max, 1.0), 0.0);
PlayerTextDrawLetterSize (playerid, in_t, 1.0, height / 10 - 0.35);
PlayerTextDrawBoxColor (playerid, in_t, color);
PlayerBars[playerid][barid][ppb_x] = x;
PlayerBars[playerid][barid][ppb_y] = y;
PlayerBars[playerid][barid][ppb_w] = width;
PlayerBars[playerid][barid][ppb_h] = height;
PlayerBars[playerid][barid][ppb_m] = max;
PlayerBars[playerid][barid][ppb_color] = color;
PlayerBars[playerid][barid][ppb_created] = true;
return PlayerBar:barid;
}
stock DestroyPlayerProgressBar(playerid, PlayerBar:barid)
{
if(barid != INVALID_PLAYER_BAR_ID && PlayerBar:-1 < barid < PlayerBar:MAX_PLAYER_BARS)
{
if(!PlayerBars[playerid][_:barid][ppb_created])
return 0;
PlayerTextDrawDestroy(playerid, PlayerBars[playerid][_:barid][ppb_t1]);
PlayerTextDrawDestroy(playerid, PlayerBars[playerid][_:barid][ppb_t2]);
PlayerTextDrawDestroy(playerid, PlayerBars[playerid][_:barid][ppb_t3]);
PlayerBars[playerid][_:barid][ppb_t1] = PlayerText:0;
PlayerBars[playerid][_:barid][ppb_t2] = PlayerText:0;
PlayerBars[playerid][_:barid][ppb_t3] = PlayerText:0;
PlayerBars[playerid][_:barid][ppb_x] = 0.0;
PlayerBars[playerid][_:barid][ppb_y] = 0.0;
PlayerBars[playerid][_:barid][ppb_w] = 0.0;
PlayerBars[playerid][_:barid][ppb_h] = 0.0;
PlayerBars[playerid][_:barid][ppb_m] = 0.0;
PlayerBars[playerid][_:barid][ppb_v] = 0.0;
PlayerBars[playerid][_:barid][ppb_color] = 0;
PlayerBars[playerid][_:barid][ppb_created] = false;
return 1;
}
return 0;
}
stock ShowPlayerProgressBar(playerid, PlayerBar:barid)
{
if(IsPlayerConnected(playerid) && barid != INVALID_PLAYER_BAR_ID && PlayerBar:-1 < barid < PlayerBar:MAX_PLAYER_BARS)
{
if(!PlayerBars[playerid][_:barid][ppb_created])
return 0;
PlayerTextDrawShow(playerid, PlayerBars[playerid][_:barid][ppb_t1]);
PlayerTextDrawShow(playerid, PlayerBars[playerid][_:barid][ppb_t2]);
PlayerTextDrawShow(playerid, PlayerBars[playerid][_:barid][ppb_t3]);
return 1;
}
return 0;
}
stock HidePlayerProgressBar(playerid, PlayerBar:barid)
{
if(IsPlayerConnected(playerid) && barid != INVALID_PLAYER_BAR_ID && PlayerBar:-1 < barid < PlayerBar:MAX_PLAYER_BARS)
{
if(!PlayerBars[playerid][_:barid][ppb_created])
return 0;
PlayerTextDrawHide(playerid, PlayerBars[playerid][_:barid][ppb_t1]);
PlayerTextDrawHide(playerid, PlayerBars[playerid][_:barid][ppb_t2]);
PlayerTextDrawHide(playerid, PlayerBars[playerid][_:barid][ppb_t3]);
return 1;
}
return 0;
}
stock SetPlayerProgressBarValue(playerid, PlayerBar:barid, Float:value)
{
if(barid == INVALID_PLAYER_BAR_ID || PlayerBar:MAX_PLAYER_BARS < barid < PlayerBar:-1)
return 0;
if(PlayerBars[playerid][_:barid][ppb_created])
{
value =
(value < 0.0) ? (0.0) : (value > PlayerBars[playerid][_:barid][ppb_m]) ? (PlayerBars[playerid][_:barid][ppb_m]) : (value);
PlayerTextDrawUseBox(playerid, PlayerBars[playerid][_:barid][ppb_t3], value > 0.0);
PlayerBars[playerid][_:barid][ppb_v] = value;
PlayerTextDrawTextSize(playerid, PlayerBars[playerid][_:barid][ppb_t3],
pb_percent(PlayerBars[playerid][_:barid][ppb_x], PlayerBars[playerid][_:barid][ppb_w], PlayerBars[playerid][_:barid][ppb_m], value), 0.0);
return 1;
}
return 0;
}
stock Float:GetPlayerProgressBarValue(playerid, PlayerBar:barid)
{
if(barid == INVALID_PLAYER_BAR_ID || PlayerBar:MAX_PLAYER_BARS < barid < PlayerBar:-1)
return INVALID_PLAYER_BAR_VALUE;
if(PlayerBars[playerid][_:barid][ppb_created])
return PlayerBars[playerid][_:barid][ppb_v];
return INVALID_PLAYER_BAR_VALUE;
}
stock SetPlayerProgressBarMaxValue(playerid, PlayerBar:barid, Float:max)
{
if(barid == INVALID_PLAYER_BAR_ID || PlayerBar:MAX_PLAYER_BARS < barid < PlayerBar:-1)
return 0;
if(PlayerBars[playerid][_:barid][ppb_created])
{
PlayerBars[playerid][_:barid][ppb_m] = max;
SetPlayerProgressBarValue(playerid, barid, PlayerBars[playerid][_:barid][ppb_v]);
return 1;
}
return 0;
}
stock SetPlayerProgressBarColor(playerid, PlayerBar:barid, color)
{
if(barid == INVALID_PLAYER_BAR_ID || PlayerBar:MAX_PLAYER_BARS < barid < PlayerBar:-1)
return 0;
if(PlayerBars[playerid][_:barid][ppb_created])
{
PlayerBars[playerid][_:barid][ppb_color] = color;
PlayerTextDrawBoxColor(playerid, PlayerBars[playerid][_:barid][ppb_t1], 0x00000000 | (color & 0x000000FF));
PlayerTextDrawBoxColor(PlayerBars[playerid][_:barid][ppb_t2],
(color & 0xFFFFFF00) | (0x66 & ((color & 0x000000FF) / 2)));
PlayerTextDrawBoxColor(playerid, PlayerBars[playerid][_:barid][ppb_t3], color);
return 1;
}
return 0;
}
stock UpdatePlayerProgressBar(playerid, PlayerBar:barid)
{
return ShowPlayerProgressBar(playerid, barid);
}
|
|
|
|
|
|
#284 |
|
Banned
![]() Join Date: Apr 2009
Location: England
Posts: 4,013
Reputation: 701
|
You're using my player version with the editor!
Look at the function names and work it out... Simply use the editor with the global bar system, and name it correctly so the filterscript can include it. |
|
|
|
|
|
#285 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 305
Reputation: 38
|
can you give me the link of the Filterscript but not pastebin because i have a problem with this script
for example when i copy paste a script from site it double the code for example is Code:
if(!IsPlayerAdmin(playerid) ) return 0; if(!IsPlayerAdmin(playerid) ) return 0; // and i get this code again + some errors this was an example Code:
D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(27) : error 017: undefined symbol "MAX_BARS" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(27) : error 009: invalid array size (negative, zero or out of bounds) D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(104) : error 017: undefined symbol "DestroyProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(159) : error 017: undefined symbol "CreateProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(159) : warning 213: tag mismatch D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(160) : error 017: undefined symbol "SetProgressBarValue" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(161) : error 017: undefined symbol "ShowProgressBarForPlayer" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(197) : error 017: undefined symbol "DestroyProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(210) : error 017: undefined symbol "CreateProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(215) : error 017: undefined symbol "SetProgressBarValue" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(216) : error 017: undefined symbol "ShowProgressBarForPlayer" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(271) : error 017: undefined symbol "SetProgressBarColor" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(272) : error 017: undefined symbol "UpdateProgressBar" D:\Servere de samp\Mad Dog Mansion\filterscripts\BarC.pwn(301) : error 017: undefined symbol "DestroyProgressBar" Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 13 Errors. |
|
|
|
|
|
#286 |
|
Banned
![]() Join Date: Apr 2009
Location: England
Posts: 4,013
Reputation: 701
|
Here's an AMX for the editor, this works fine for me so it should be ok for you
![]() http://www.solidfiles.com/d/9929d930f7/ |
|
|
|
|
|
#287 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 305
Reputation: 38
|
it work ths now I'm trying to make a Deathmatch server and i want to make a bar for ammo to weapons
and want to learnying how to use this script
|
|
|
|
|
|
#288 |
|
Little Clucker
![]() Join Date: Jun 2011
Posts: 11
Reputation: 0
|
I LOVE it! Thanks bro
![]() But only one question: Can I also change the background color? |
|
|
|
|
|
#289 |
|
Banned
![]() Join Date: Apr 2009
Location: England
Posts: 4,013
Reputation: 701
|
Check one or two pages back, I think that Kar posted an edit where you could change the colour of both textdraws
|
|
|
|
|
|
#290 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Jun 2012
Location: Argentina
Posts: 369
Reputation: 18
|
Player textdraws DOES NOT need an array. Already tested. A waste of memory without sense.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [BUILT IN-PROGRESS] SA-MP Control Panel | eXchainZ-FoReVeR | Help Archive | 68 | 04/07/2011 11:19 AM |
| My new town(In Progress), preview :-) | Zh3r0 | Screenshots and Videos | 54 | 09/01/2011 10:03 PM |
| very very simple server sided weapons in progress | belhot | Help Archive | 4 | 03/06/2010 10:01 PM |
| Rape in progress messages :P | aNdReSkKkK | Help Archive | 0 | 26/02/2010 11:23 PM |