SORRY DOUBLE POST.
Personally scripted by *Switch for use only on Vega United.
The problem is whenever you die, a little watermark appears and you press Space bar to revive, this worked fine. But switch came back and altered the script and now it doesn't let you respawn. You must reconnect to the server to revive. This is extremely annoying, and many of our players have stopped coming because of this reason. Help is appreciated, please and thank you in advance.
I tried to fix it by altering this code, but I think I did more harm than good?
PHP Code:
layer = 4;
red = green = blue = 0;
mode = 1;
alpha = 0.7;
}
with (findImg(201)) {
text = "Press spacebar to revive.";
x = GraalControl.width/2; y = GraalControl.height/2+GraalControl.height/3.5;
layer = 4;
style = "c";
red = green = blue = 1;
zoom = GraalControl.width/600;
}
}
else {
hideImgs(200, 201);
}
}
function GraalControl.onResize() {
if (clientr.health_current == null) {
with (findImg(200)) {
polygon = {GraalControl.width/2-GraalControl.width/5, GraalControl.height/2+GraalControl.height/4,
GraalControl.width/2+GraalControl.width/5, GraalControl.height/2+GraalControl.height/4,
Here's the full code.
PHP Code:
function onActionServerside(cmd, p1, p2) {
if (cmd == "setstats") {
clientr.health_current = clientr.health_max = 100;
clientr.armor_current = clientr.armor_max = 0;
onHeal(player.account);
}
if (cmd == "hurt") {
if (!player.level.isnopkzone) {
if (clientr.armor_current > 0) {
if (clientr.armor_current >= p1) {
clientr.armor_current -= p1;
if (clientr.armor_current = 0) {
clientr.armor_max = 0;
}
player.ani = "hurt";;
scheduleEvent(1, "Unhurt", player.account);
}
else {
temp.remain = p1-clientr.armor_current;
clientr.armor_current = clientr.armor_max = 0;
clientr.health_current -= temp.remain;
if (clientr.health_current <= 0) {
clientr.health_current = 0;
death(p2);
}
}
}
else if (clientr.health_current > 0) {
if (clientr.health_current > p1) {
clientr.health_current -= p1;
player.ani = "hurt";
scheduleEvent(1, "Unhurt", player.account);
}
else {
clientr.health_current = 0;
death(p2);
}
}
}
}
else if (cmd == "respawn") {
onHeal(player.account);
}
triggerClient("gui", this.name);
}
function onUnhurt(pl) {
if (player.ani == "hurt") {
player.ani = "idle";
}
}
function death(pl) {
player.ani = "dead";
freezePlayer2();
clientr.deaths++;
clientr.dead = true;
player.chat = "" @findPlayer(pl).communityname@ "!";
findPlayer(pl).clientr.kills++;
findPlayer(pl).chat = "" @player.communityname@ "!";
}
function onHeal(pl) {
findPlayer(pl).ani = "idle";
clientr.dead = false;
findPlayer(pl).clientr.health_current = findPlayer(pl).clientr.health_max;
findPlayer(pl).unfreezePlayer();
findPlayer(pl).setLevel2("overworld_ad-ae.nw", 9.375, 62.5);
findPlayer(pl).triggerClient("gui", this.name);
}
//#CLIENTSIDE
function onCreated() {
Health = this;
if (clientr.health_current == null) {
triggerServer("gui", this.name, "setstats");
}
}
function GraalControl.onKeyPressed(code, key, scan) {
if (clientr.health_current == null) {
if (scan == 0) {
triggerServer("gui", this.name, "respawn");
}
}
}
function onActionClientside() {
HUD.findImg(201).width = ((clientr.health_current/clientr.health_max)*82)/16;
if (clientr.health_current > 0) {
HUD.findImg(201).alpha = 1;
}
else {
HUD.findImg(201).alpha = 0;
}
HUD.findImg(202).text = clientr.health_current@ "/" @clientr.health_max;
HUD.findImg(203).width = ((clientr.health_current/clientr.health_max)*82)/16;
if (clientr.armor_current > 0) {
HUD.findImg(203).alpha = 1;
}
else {
HUD.findImg(203).alpha = 0;
}
HUD.findImg(204).text = (clientr.armor_current == null?"0/0":clientr.armor_current@ "/"@ clientr.armor_max);
if (clientr.health_current == null) {
with (findImg(200)) {
polygon = {GraalControl.width/2-GraalControl.width/5, GraalControl.height/2+GraalControl.height/4,
GraalControl.width/2+GraalControl.width/5, GraalControl.height/2+GraalControl.height/4,
GraalControl.width/2+GraalControl.width/5, GraalControl.height/2+GraalControl.height/3,
GraalControl.width/2-GraalControl.width/5, GraalControl.height/2+GraalControl.height/3};
layer = 4;
red = green = blue = 0;
mode = 1;
alpha = 0.7;
}
with (findImg(201)) {
text = "Press spacebar to revive.";
x = GraalControl.width/2; y = GraalControl.height/2+GraalControl.height/3.5;
layer = 4;
style = "c";
red = green = blue = 1;
zoom = GraalControl.width/600;
}
}
else {
hideImgs(200, 201);
}
}
function GraalControl.onResize() {
if (clientr.health_current == null) {
with (findImg(200)) {
polygon = {GraalControl.width/2-GraalControl.width/5, GraalControl.height/2+GraalControl.height/4,
GraalControl.width/2+GraalControl.width/5, GraalControl.height/2+GraalControl.height/4,
GraalControl.width/2+GraalControl.width/5, GraalControl.height/2+GraalControl.height/3,
GraalControl.width/2-GraalControl.width/5, GraalControl.height/2+GraalControl.height/3};
layer = 4;
red = green = blue = 0;
mode = 1;
alpha = 0.7;
}
with (findImg(201)) {
text = "Press spacebar to revive.";
x = GraalControl.width/2; y = GraalControl.height/2+GraalControl.height/3.5;
layer = 4;
style = "c";
red = green = blue = 1;
zoom = GraalControl.width/600;
}
}
}
function onActionProjectile(b, dmg, pl) {
if (b == "bullet") {
triggerServer("gui", this.name, "hurt", dmg, pl);
}
}