AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   No Base Camping (https://forums.alliedmods.net/showthread.php?t=94025)

endeffects 06-05-2009 15:57

No Base Camping
 
Hi guys, i modified a small plugin to get rid of the ct base campers
on assault maps but it don't works well.

the idea is that the plugin checks the positions of each ct for the first 100s
if the player moved over the half of the map the plugin stops the check
for the current round, if the player don't moved over this fenceline the player
get killed.

for sure this needs more improvements but for now i need
some help to get the basics to work. right now it seems like
that it can't calculate the middle of the map correctly and
maybe some more bugs are available too. any ideas whats wrong here?



Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#define MINNUM  2
new CTspawn_loc[3]
new Tspawn_loc[3]
new bool:bCrossedFenceLine[33]
new bool:PunishCampers = false
public plugin_init()
{
 register_plugin("No BaseCamp","1.0","")
 new mapname[32]
 get_mapname(mapname,31)
 
 register_logevent("change_status", 2, "1=Round_Start")
 
 set_task(0.1,"spawn_locs")
}
public client_putinserver(id)
{
 set_task(2.0,"prethink",id,"",0,"b")
 bCrossedFenceLine[id] = false
}
public client_disconnect(id)
{
 remove_task(id)
 bCrossedFenceLine[id] = false
}
 
public change_status()
{
 PunishCampers = false
 remove_task(199)
 
 for(new i=1;i<33;i++)
 {
  bCrossedFenceLine[i] = false
 }
 
 set_task(100.0,"start_punishment",199)
}
public start_punishment()
{
 PunishCampers = true
}
public prethink(id)
{
 //new  = get_timeleft()
 
 if( is_user_alive(id) || bCrossedFenceLine[id] == true )
 {
  new origin[3]
  get_user_origin(id,origin)
  new team[32]
  get_user_team(id,team,31)
  new teamnum=1
  if(containi(team,"CT")!=-1 || containi(team,"Counter")!=-1)
  {
  teamnum=2
  }
  //if( (get_distance(origin,CTspawn_loc)<get_distance(origin,Tspawn_loc) && teamnum==1) || (get_distance(origin,Tspawn_loc)<get_distance(origin,CTspawn_loc) && teamnum==2) )
  if( get_distance(origin,CTspawn_loc)>get_distance(origin,Tspawn_loc) && teamnum==1 )
  {
  bCrossedFenceLine[id] = true
  }
  if( PunishCampers == true )
  {
  if( bCrossedFenceLine[id] == true )
  {
    remove_task(id)
  } else {
    user_kill(id)
    remove_task(id)
  }
  }
 } else {
  remove_task(id)
 }
}
public spawn_locs()
{
 new ent1 = find_ent_by_class(0,"info_player_start")
 new ent2 = find_ent_by_class(0,"info_player_deathmatch")
 if(!ent1)
 {
  log_amx("No info_player_start found")
 }
 if(!ent2)
 {
  log_amx("No info_player_deathmatch found")
 }
 new Float:CTspawn_loc_F[3]
 new Float:Tspawn_loc_F[3]
 entity_get_vector(ent1,EV_VEC_origin,CTspawn_loc_F)
 entity_get_vector(ent2,EV_VEC_origin,Tspawn_loc_F)
 CTspawn_loc[0] = floatround(CTspawn_loc_F[0])
 CTspawn_loc[1] = floatround(CTspawn_loc_F[1])
 CTspawn_loc[2] = floatround(CTspawn_loc_F[2])
 Tspawn_loc[0] = floatround(Tspawn_loc_F[0])
 Tspawn_loc[1] = floatround(Tspawn_loc_F[1])
 Tspawn_loc[2] = floatround(Tspawn_loc_F[2])
}


endeffects 06-07-2009 04:29

Re: No Base Camping
 
nobody an idea how to fix this? =(


All times are GMT -4. The time now is 14:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.