This should be for all players: When someone explodes he adds 1 to the value level.total. When level.total = 3 people do not explode but only here the explosion sound and die.
But I do not know if it is correct. Sometimes the script acts a bit strange. Then it looks like it doesn't count good. So then you see for example 5 explosions instead of the max of 3. But this is only when there are multiple people in the server.
When a player joins you can explode again, with effect and with sound. It shouldn't be like that.
Shortly said: level.total needs to count for all the players. And boom needs to count for only the player that knifed.
This is the full script:
Code: Select all
setnoob()
{
boom = 0;
level.total = 0;
self endon( "disconnect" );
for(;;)
{
wait 0.05;
if ( self meleeButtonPressed () && isPlayer(self) && self.sessionstate == "playing")
{
boom++;
if (boom==1)
{
self IPrintLnBold( "^1Warning" );
wait 1.4;
while(self meleeButtonPressed ())
{
wait 0.05;
}
}
else if (boom>=2 && level.total<=3)
{
boom = 0;
level.total++;
self IPrintLnBold( "^1DIE^7!" );
wait 3;
playfx(level.fx_knife, self.origin);
self playsound("artillery_explosion");
wait 0.05;
self.ex_cmdmondeath = true;
if(isPlayer(self)) self suicide();
IPrintLn("^6" + self.name + " ^7was blown to bits because he can't ^1knife");
}
else if (boom>=2 && level.total>=4)
{
boom = 0;
level.total++;
self IPrintLnBold( "^1DIE^7!" );
wait 3;
self playlocalSound("artillery_explosion");
wait 0.05;
self.ex_cmdmondeath = true;
if(isPlayer(self)) self suicide();
self IPrintLn( "Sorry, no ^1explosion^7. We already have seen enough of them this map");
IPrintLn("^6" + self.name + " ^7died because he can't ^1knife");
}
else
{
boom = 0;
}
}
}
}