Yosmany
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;
//#include maps\mp\gametypes\_hud_message;
init()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon("disconnect");
level endon("game_ended");
for(;;)
{
self waittill("spawned_player");
self thread watch_anti_camp();
// Will appear each time when the player spawn, that's just an exemple.
//self iprintln("Black Ops 2 - GSC Studio | Project : ^2Anticamp MW3");
}
}
watch_anti_camp()
{
self endon("disconnect");
self endon("death");
self endon("joined_spectators");
level endon("destroy_bar");
level endon("game_ended");
//if(getintdvar("scr_anticamp"!=1)
//return;
self.camping = 0;
if(!isDefined(self.bar))
{
self.bar = self maps\mp\gametypes\_hud_util::createBar((1,1,1), 64, 8);
self.bar maps\mp\gametypes\_hud_util::setPoint("CENTER", undefined, 0, 230);
}
while(isAlive(self))
{
oldorg = self.origin;
wait .1;
if(distance(oldorg, self.origin) < 3.5)
self.camping += 0.015;
else
self.camping -= 0.0055;
if(self.camping > 1)
self.camping = 1;
else if(self.camping < 0)
self.camping = 0;
self.bar maps\mp\gametypes\_hud_util::updateBar(self.camping);
if(self.camping == 1)
{
self iprintlnbold("^2Move ^7or you will be ^1killed!");
oldorg = self.origin;
wait 5;
if(distance(oldorg, self.origin) < 150)
{
self.bar maps\mp\gametypes\_hud_util::updateBar(0);
self.bar destroy();
self suicide();
level notify("destroy_bar");
}
}
}
}