Hey Guys
I make now a sd mod.
and want make a anticampermod.
When you camp 20 sec or 15 sec.
You will be dead.
killtube can help me?
Printable View
Hey Guys
I make now a sd mod.
and want make a anticampermod.
When you camp 20 sec or 15 sec.
You will be dead.
killtube can help me?
For standaloneCode:antiCamp()
{
self endon("killed_player");
count = 0;
time = 15;
for(;;)
{
origin = self.origin;
wait 1;
if(self.origin == origin)
count++;
else
count = 0;
if(count == time)
self suicide();
}
}
Code:init()
{
thread onPlayerConnect();
}
onPlayerConnect()
{
level endon("intermission");
for(;;)
{
level waittill("connecting", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon("disconnect");
level endon("intermission");
for(;;)
{
self waittill("spawned_player");
self thread antiCamp();
}
}
I don't got much time, i could answer tommorow.
But just work with self.campingPos = self.origin; and then check the distance within time.
Try adding this:
Code:
antiCamp()
{
self endon("killed_player");
count = 0;
time = 15;
for(;;)
{
origin = self.origin;
wait 1;
if(self.origin == origin && self.sessionstate != "spectator")
count++;
else
count = 0;
if(count == time)
self suicide();
}
}
Weird, still same
Well if you credit, u can use mine. I never used it, but when i tested it, it worked.
Its longer but it kills camper that camps in a small area.
May you need to fix the campdistance.
If u want to enable the timer, delete the // at "self thread campHudTimer ....
Spoiler:
Download: Click Me
Only an unimportant remark:
If the player has left, you dont destroy the camptimer hud and it will reserve space in the memory. (if i am right.. :D)
Maybe this script will work better
Code:antiCamp()
{
self endon("killed_player");
self endon("disconnect");
self notify("antiCamp");
self endon("antiCamp");
if(self.sessionstate != "playing")
return;
count = 0;
time = 15;
dmg = 5;
for(;;)
{
origin = self.origin;
wait 1;
if(self.origin == origin && self.sessionstate == "playing")
count++;
else
count = 0;
if(count >= time)
self thread [[level.callbackPlayerDamage]]( self, self, dmg , 1, "MOD_EXPLOSIVE", "none", self.origin, (0,0,0), "none", 0 );
}
}