ItsMods
Anti camp script - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: Anti camp script (/Thread-Anti-camp-script.html)



Anti camp script - Justin - 08-30-2011

One of the many, but here's mine:
Code:
onPlayerSpawn() { if(getdvarint("scr_anticamp") == 0) return; wait 5; //spawn wait self thread AntiCamp(); } AntiCamp() { level endon( "game_ended" ); self endon("disconnect"); self endon("joined_spectators"); self endon ( "death" ); DefaultCampTime = getdvarint("scr_maxcamptime"); //10 MaxCampTime = DefaultCampTime; MinCampTime = getdvarint("scr_mincamptime"); //6 CampDistance = getdvarint("scr_campdistance"); //50 CampPunishTime = getdvarint("scr_camppunishtime"); //5 CampResetTime = (getdvarint("scr_campresettime") - 1) * 1000; //16 LastCampTime = 0; if(!isdefined(self.pers["camppunishment"])) self.pers["camppunishment"] = 0; L = 0; s = 0; for(c=0;;c++) { old = self.origin; wait 1; new = self.origin; L = distance( new, old ); if( L > CampDistance ) c = 0; else if( s > (CampPunishTime - 1) ) { self.pers["camppunishment"]++; //some punishment based on how much times already got punished? self punish(); s = 0; c = 0; } if(c > (MaxCampTime - 1)) { if(s < CampPunishTime) { iprintln(self, " is Camping!"); //ping him on radar? self iprintlnbold( "^1Stop Camping!" ); self iprintlnbold( "^1" + (CampPunishTime - s) + "^7 seconds remaining before punishment" ); } LastCampTime = gettime(); s++; } else s = 0; if(s == 1 && MaxCampTime > MinCampTime) MaxCampTime--; //decrease next camp time. if( MaxCampTime != DefaultCampTime && ( getTime() - LastCampTime ) > CampResetTime ) MaxCampTime = DefaultCampTime; //reset camp time } } punish() { level endon( "game_ended" ); self endon("disconnect"); self endon("joined_spectators"); self endon ( "death" ); originX = self.origin[0]; originY = self.origin[1]; camparea = getdvarint( "scr_camparea" ); //120 up = originY + camparea; right = originX - camparea; left = originX + camparea; down = originY - camparea; self iprintlnbold( " " ); self iprintlnbold( " " ); self iprintlnbold( " " ); self iprintlnbold( "Move out of your camp area!" ); self iprintlnbold( "^1Your weapons are disabled while inside." ); self disableweapons(); while( self isInSpace(up, right, left, down) ) wait .05; self enableweapons(); self iprintlnbold( " " ); self iprintlnbold( " " ); self iprintlnbold( " " ); } isInSpace(front, right, left, rear, bottom, ceiling) { if( isdefined( bottom ) && isdefined( ceiling )) if(self.origin[1] < front && self.origin[1] > rear && self.origin[0] > right && self.origin[0] < left && self.origin[2] < ceiling && self.origin[2] > bottom ) return true; if(self.origin[1] < front && self.origin[1] > rear && self.origin[0] > right && self.origin[0] < left ) return true; return false; }



RE: Anti camp script - iAegle - 08-30-2011

it only works on the first spawn ..


RE: Anti camp script - Pozzuh - 08-30-2011

(08-30-2011, 20:02)iAegle Wrote: it only works on the first spawn ..

It's a code snippet.. not a fully working code

derp



RE: Anti camp script - Justin - 08-30-2011

(08-30-2011, 20:02)iAegle Wrote: it only works on the first spawn ..

You just got to thread onPlayerSpawn when player is spawned.. How hard can that be xD




RE: Anti camp script - iAegle - 08-30-2011

(08-30-2011, 20:06)Justin Wrote:
(08-30-2011, 20:02)iAegle Wrote: it only works on the first spawn ..

You just got to thread onPlayerSpawn when player is spawned.. How hard can that be xD

I know, just saying Superman

nice script, personally I would give them a Kill waypoint