#1

why
Код:
#define MAX_HEALTH 100
#define MAX_ARMOR 99
Код:
 new PlayerBar:Bar0[MAX_PLAYERS];
 new PlayerBar:Bar1[MAX_PLAYERS];
Код:
Bar0[playerid] = CreatePlayerProgressBar(playerid, 194.000000, 398.000000, 53.000000, 4.199999, -16776961, MAX_HEALTH, BAR_DIRECTION_RIGHT);
Bar1[playerid] = CreatePlayerProgressBar(playerid, 194.000000, 385.000000, 53.000000, 4.699999, -1, MAX_ARMOR, BAR_DIRECTION_RIGHT);

Код:
SetTimerEx("UpdateBars", 1, true,"i",playerid);
Код:
forward UpdateBars(playerid);
public UpdateBars(playerid)
{
	 new Float:Health;
	 new Float:Armor;
     GetPlayerHealth(playerid, Health);
	 GetPlayerArmour(playerid, Armor);
	 SetPlayerProgressBarValue(playerid, PlayerBar:Bar0[playerid], Health);
	 SetPlayerProgressBarValue(playerid, PlayerBar:Bar1[playerid], Armor);
	 if(Armor >= MAX_ARMOR+1) return SetPlayerArmour(playerid, MAX_ARMOR), UpdateBars(playerid);
	 if(Health >= MAX_HEALTH+1) return SetPlayerHealth(playerid, MAX_HEALTH), UpdateBars(playerid);
	 return 1;
}

Код:
[07:17:37] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[07:17:37] [debug]  Stack pointer (STK) is 0xBB3B5C, heap pointer (HEA) is 0xBB3B20
[07:17:37] [debug] AMX backtrace:
[07:17:37] [debug] #0 00000680 in ?? (1128398848, 1112801280, 1120403456, 1120403456, 0) from GamMode.amx
[07:17:37] [debug] #1 00006ea4 in ?? (0, 0, 1120403456) from GamMode.amx
[07:17:37] [debug] #2 0066f744 in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #3 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #4 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #5 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #6 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #7 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #8 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #9 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #10 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #11 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #12 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #13 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #14 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #15 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #16 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #17 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #18 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #19 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #20 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #21 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #22 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #23 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #24 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #25 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #26 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #27 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #28 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #29 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #30 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #31 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #32 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #33 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #34 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #35 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #36 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #37 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #38 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #39 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #40 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #41 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #42 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #43 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #44 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #45 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #46 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #47 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #48 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #49 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #50 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #51 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #52 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #53 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #54 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #55 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #56 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #57 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #58 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #59 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #60 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #61 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #62 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #63 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #64 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #65 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #66 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #67 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #68 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #69 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #70 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #71 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #72 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #73 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #74 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #75 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #76 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #77 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #78 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #79 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #80 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #81 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #82 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #83 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #84 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #85 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #86 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #87 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #88 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #89 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #90 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #91 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #92 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #93 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #94 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #95 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #96 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #97 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #98 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #99 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] #100 0066f8cc in public UpdateBars (0) from GamMode.amx
[07:17:37] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[07:17:37] [debug]  Stack pointer (STK) is 0xBB3B5C, heap pointer (HEA) is 0xBB3B20
[07:17:37] [debug] AMX backtrace:
[07:17:37] [debug] #0 00000680 in ?? (1128398848, 1112801280, 1120403456, 1120403456, 0) from GamMode.amx
Код:
[07:17:54] [warning] client exceeded 'ackslimit' 127.0.0.1:49507 (7218) Limit: 5000/sec
Reply
#2

Maybe 1ms timer causing that warning.
My suggestion is increase the timer interval or just use OnPlayer(Take/Give)Damage callback to update health/armour bars.
Reply
#3

Quote:
Originally Posted by X337
Посмотреть сообщение
Maybe 1ms timer causing that warning.
My suggestion is increase the timer interval or just use OnPlayer(Take/Give)Damage callback to update health/armour bars.
??
Reply
#4

Quote:
Originally Posted by Swans
Посмотреть сообщение
??
He's saying
Код:
SetTimerEx("UpdateBars", 1, true,"i",playerid);
is too short... try 1000, or on an event that the progress bar will change on.
Reply
#5

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
He's saying
Код:
SetTimerEx("UpdateBars", 1, true,"i",playerid);
is too short... try 1000, or on an event that the progress bar will change on.
working thank you !
Reply
#6

Just be careful, as timers and incorrect checks on things such as OnPlayerKeyStateChange, and OnPlayerUpdate can result in too many checks being done in a very short time.

This will spam the client with packets, dropping the player themselves, and cause server wide disconnects if it is bad enough.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)