The thing about GUIs is that you create them first, then update/edit them later. I.e:
PHP Code:
//#CLIENTSIDE
function onCreated() {
createGUI();
setTimer(0.05);
}
function createGUI() {
for (temp.i = 0; temp.i < player.fullhearts; temp.i++) {
new GuiShowImgCtrl("GUIHearts_" @ temp.i) {
// hearts and stuff
}
}
this.lastfullhearts = player.fullhearts;
}
function onTimeout() {
// Check for change in full hearts
if (this.lastfullhearts != player.fullhearts) {
// Re-create GUI
createGUI();
}
// Update hearts
for (temp.i = 0; temp.i < player.fullhearts; temp.i++) {
// Toggle Heart Visibility
(@"GUIHearts_" @ temp.i).visible = (player.hearts >= temp.i);
}
setTimer(0.05);
}