Post: help with my script
01-03-2017, 07:00 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); OK so im working on a*slither.io*gamemode but want it to add health to the player once they get a kill or even damge the other snake
    monitorForDeath()
{
level endon("game_ended");
self endon("disconnect");
foreach(player in level.players)
{
self waittill( "damage", damage, attacker );
if (isDefined(attacker) && isPlayer(attacker))
{
if ( smeansofdeath == "MOD_MELEE" || smeansofdeath == "MOD_TRIGGER_HURT" )
{
attacker.health += level.playerMaxHealth + self.SlitherEatenSlitherCount * level.healthBonusPerKilledSnake;
}
}
}
}

thats how i have it but it wont add the health and when it does it only works for one player and when a player dies it drops there health down to like 31 lol its weird but if you know the issue please help

The following user groaned marmar19 for this awful post:

anthonything
01-03-2017, 07:46 AM #2
Luckeyy
Retired - Lead Content Manager
Originally posted by marmar19 View Post
OK so im working on a*slither.io*gamemode but want it to add health to the player once they get a kill or even damge the other snake
    monitorForDeath()
{
level endon("game_ended");
self endon("disconnect");
foreach(player in level.players)
{
self waittill( "damage", damage, attacker );
if (isDefined(attacker) && isPlayer(attacker))
{
if ( smeansofdeath == "MOD_MELEE" || smeansofdeath == "MOD_TRIGGER_HURT" )
{
attacker.health += level.playerMaxHealth + self.SlitherEatenSlitherCount * level.healthBonusPerKilledSnake;
}
}
}
}

thats how i have it but it wont add the health and when it does it only works for one player and when a player dies it drops there health down to like 31 lol its weird but if you know the issue please help


Thread Moved - Call of Duty: Black Ops 2 GSC Mods and Scripts Questions

The following user groaned Luckeyy for this awful post:

anthonything
01-03-2017, 09:03 PM #3
Originally posted by anthonything View Post
This code make 0 sense. The waittill in the loop will cause a waittill for damage, yet it is inside of a foreach players loop? Then, you reference a local variable that is non existent, evidently copied from somewhere you wont credit in the release, but you expect help? ahahahaha. That is about as much help as I feel like giving you. Leech.


they are defined in the init

    init()
{
assertFreeForAll();

precacheModel("p6_dogtags");

level.enableInformationBar = true;
level.SlitherMoveSpeedMultiplier = 7;
level.SlitherCountdownTime = 10;
level.SlitherCloneWaitingTime = 0.2;
level.SlitherMovementSpeedDecreasePerEatanSlither = 0.05;
level.healthBonusPerKilledSnake = 150;
level.SlitherEatenSlitherCount = 0;

level thread onPlayerConnect();
level thread startGamemode_Slither();

if(level.enableInformationBar)
{
level thread drawInformationBar();
}
}

onPlayerConnect()
{
while(true)
{
level waitTill("connected", player);

if(player isHost())
{
player thread flashKillFeed();
}

player thread onPlayerSpawned();
player thread lifeHUD();
}
}

onPlayerSpawned()
{
self endon("disconnect");
level endon("game_ended");
self notify("menuresponse", "changeclass", "class_smg");
for(;Winky Winky
{
self waittill("spawned_player");
while(true)
{
self thread doWeapon("knife_ballistic_mp");
self setClientThirdPerson(true);
self thread animateKingSnakeCentipede();
self thread keepEnablingUAV();
wait 0.05;
self thread forceProne();
self thread spawnDogTagOnDeath();
self setSlitherMovementSpeed(1);
self thread monitorSprinting();
if(!isDefined(level.isFirstSpawn))
{
level.isFirstSpawn = false;
level thread overflowFix();
self thread monitorForDeath();
}
self.playerMaxHealth = self.health;
}
}
}


and what have a copied from ive made three new gamemodes ? but ok and so itd be like this then ?

    monitorForDeath()
{
level endon("game_ended");
self endon("disconnect");
for(;Winky Winky
{
self waittill("damage", damage, attacker, direction, point, type, tagname, modelname, partname, weaponname);
if (isDefined(attacker) && isPlayer(attacker))
{
if ( smeansofdeath == "MOD_MELEE" || smeansofdeath == "MOD_TRIGGER_HURT" )
{
attacker.health += level.playerMaxHealth * level.healthBonusPerKilledSnake;
}
}
}
}
Last edited by marmar19 ; 01-03-2017 at 09:50 PM.

The following user groaned marmar19 for this awful post:

anthonything
01-03-2017, 10:35 PM #4
Originally posted by anthonything View Post
You copied so hard you didnt even see the variable i was talking about ahahahahaha. I cant right now, I just cant.


Ight keep of my topic if you're not gonna help? i'm still confused lol havent copied shit, so again unless you're gonna help move around bum

The following user groaned marmar19 for this awful post:

anthonything
01-17-2017, 03:28 PM #5
matrixmods
Pokemon Trainer
Originally posted by marmar19 View Post
they are defined in the init

    init()
{
assertFreeForAll();

precacheModel("p6_dogtags");

level.enableInformationBar = true;
level.SlitherMoveSpeedMultiplier = 7;
level.SlitherCountdownTime = 10;
level.SlitherCloneWaitingTime = 0.2;
level.SlitherMovementSpeedDecreasePerEatanSlither = 0.05;
level.healthBonusPerKilledSnake = 150;
level.SlitherEatenSlitherCount = 0;

level thread onPlayerConnect();
level thread startGamemode_Slither();

if(level.enableInformationBar)
{
level thread drawInformationBar();
}
}

onPlayerConnect()
{
while(true)
{
level waitTill("connected", player);

if(player isHost())
{
player thread flashKillFeed();
}

player thread onPlayerSpawned();
player thread lifeHUD();
}
}

onPlayerSpawned()
{
self endon("disconnect");
level endon("game_ended");
self notify("menuresponse", "changeclass", "class_smg");
for(;Winky Winky
{
self waittill("spawned_player");
while(true)
{
self thread doWeapon("knife_ballistic_mp");
self setClientThirdPerson(true);
self thread animateKingSnakeCentipede();
self thread keepEnablingUAV();
wait 0.05;
self thread forceProne();
self thread spawnDogTagOnDeath();
self setSlitherMovementSpeed(1);
self thread monitorSprinting();
if(!isDefined(level.isFirstSpawn))
{
level.isFirstSpawn = false;
level thread overflowFix();
self thread monitorForDeath();
}
self.playerMaxHealth = self.health;
}
}
}


and what have a copied from ive made three new gamemodes ? but ok and so itd be like this then ?

    monitorForDeath()
{
level endon("game_ended");
self endon("disconnect");
for(;Winky Winky
{
self waittill("damage", damage, attacker, direction, point, type, tagname, modelname, partname, weaponname);
if (isDefined(attacker) && isPlayer(attacker))
{
if ( smeansofdeath == "MOD_MELEE" || smeansofdeath == "MOD_TRIGGER_HURT" )
{
attacker.health += level.playerMaxHealth * level.healthBonusPerKilledSnake;
}
}
}
}


Not sure if this would make a difference but you are only changing the .health element of a player and not the .maxhealth so with that it probably cant go over 100. Not 100% but could help

The following user groaned matrixmods for this awful post:

anthonything

Copyright © 2025, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo