Plugin Anti-CAMP (EROARE COMPILARE)

Tutoriale scripting, cod si portiuni de cod.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
zLow69
Membru, skill 0
Membru, skill 0
Posts: 5
Joined: 08 Oct 2019, 20:14
Detinator Steam: Da
CS Status: Uite stau
Detinator server CS: Fury.PubZone.RO
SteamID: zlow411
Fond eXtream: 0
Location: Undeva cu barca
Contact:

08 Oct 2019, 20:19

Buna seara , am gasit pe net un sma de la un vechi si foarte bun anti-camp pentru modul furien , si se pare ca nu merge la compilare.
Mi-l puteti rezolva ? Si sa-mi spuneti cum i-ati facut acei argument type mismatch (argument 4) , argument type mismatch (argument 1) , va rog ?
| Afiseaza codul
#include <amxmodx>
#include <csx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>

#define PLUGIN "Furien AntiCamp"
#define VERSION "1.0"
// Extras din Furien V3.0 creat de Aragon*
#define AUTHOR "DaNNe."

#define TASKID_CHECKCAMPING		858

new bool:BombPlanted, bool:ChangeLevel = false, StandardDeviation[33], MapHasBomb = false, Meter[33], CheckCampingTime[33]
new CoordsBody[33][4][3], CoordsEyes[33][4][3]
new cvar_anticamp, cvar_camp_limit, cvar_metter_showspec

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	cvar_anticamp = register_cvar("furien50_anticamp", "1"); //----| Anti-Camp | 1 -> ON | 2 -> OFF |----//
	cvar_camp_limit = register_cvar("furien50_camp_limit", "15");  //----| Limita de camp |----//
	cvar_metter_showspec = register_cvar("furien50_metter_display_spec", "0"); //----| Vezi camp meter pe jucatorul pe care esti spec |----//
	
	register_logevent("LOGEVENT_RoundStart", 2, "1=Round_Start");
	register_logevent("LOGEVENT_RoundEnd", 2, "1=Round_End");
	
	new Bomb1 = engfunc(EngFunc_FindEntityByString,-1, "classname", "func_bomb_target");
	new Bomb2 = engfunc(EngFunc_FindEntityByString,-1, "classname", "info_bomb_target");
	if(is_valid_ent(Bomb1) || is_valid_ent(Bomb2))
		MapHasBomb = true
}

public server_changelevel() {
	ChangeLevel = true
}

public LOGEVENT_RoundStart() {
	if(get_pcvar_num(cvar_anticamp)) {
		for(new id = 0; id <= 32; id++) {
			Meter[id] = 0;
			CheckCampingTime[id] = 0;
		}
		set_task(0.5, "TASK_CheckCamping", TASKID_CHECKCAMPING, _, _, "b");
		if(MapHasBomb)
			BombPlanted = false;
	}
}

public LOGEVENT_RoundEnd() {
	remove_task(TASKID_CHECKCAMPING);
}

public TASK_CheckCamping() {
	new Players[32], Num;
	get_players(Players, Num, "ch");
	
	if(Num == 1 || BombPlanted || get_cvar_float("mp_timelimit") && !get_timeleft() || ChangeLevel)
		return;
	
	new PrevMeter, bool:PunishCamper;
	
	get_players(Players, Num, "ah");
	for(new index = 0; index < Num; ++index) {
		new id = Players[index];
		
		if(get_user_team(id) == 2 && !(get_user_flags(id) & ADMIN_IMMUNITY) && fm_get_user_maxspeed(id) > 2.0) {
			coords_insert(id, 0);
			CheckCampingTime[id] ++
			
			if(CheckCampingTime[id] > 2) {
				StandardDeviation[id] = coords_standard_deviation(id);
				CheckCampingTime[id] = 0
			}
			PrevMeter = Meter[id];
			
			Meter[id] += ((100 - StandardDeviation[id]) / get_pcvar_num(cvar_camp_limit));
			
			Meter[id] = clamp(Meter[id], 0, 100);
			
			if(Meter[id] < PrevMeter && Meter[id] < 80)
				Meter[id] -= (PrevMeter - Meter[id]) / 3;
			
			(Meter[id] >= 100) ? (PunishCamper = true) : (PunishCamper = false)					
			
			if(PunishCamper) {
				user_silentkill(id);
				ColorChat(id, "!g[FURIENLIFE-AFK]!y Ai primit slay pentru ca ai stat 15 sec pe loc!");
			}
			
			if(Meter[id]) {
				new r, g, b;
				
				if(Meter[id] > 90)
					r = 255;
				else if(Meter[id] > 80) {
					r = 255; 
					g = 100;
				}
				else if(Meter[id] > 60) {
					r = 255;
					g = 255;
				}
				else if(Meter[id] > 50) 
					g = 255; 
				else 
					b = 255;
				
				new Message[64];
				formatex(Message,sizeof(Message)-1,"CAMP: %i%%", Meter[id]);
				
				HudMessage(id, Message, r, g, b, -1.0, 0.85, _, _, 0.5);
				
				if(get_pcvar_num(cvar_metter_showspec)) {
					new Players[32], Num, Spectator;
					get_players(Players, Num, "bch");
					for(new index = 0; index < Num; ++index) {
						Spectator = Players[index];
						
						if(pev(Spectator, pev_iuser2) == id) {
							new Message[64];
							formatex(Message,sizeof(Message)-1,"CAMP: %i%%", Meter[id]);
							
							HudMessage(Spectator, Message, r, g, b, -1.0, 0.85, _, _, 0.5);
						}				
					}
				}
			}
		}
	}
}

public bomb_planted(planter) {
	BombPlanted = true
	ColorChat(0, "!g[FURIENLIFE-Bomb]!y Bomba a fost plantata!");
	ColorChat(0, "!g[FURIENLIFE]!y Protectia anti-camp a fost dezactivata!");
}

public bomb_defused(defuser) {
	BombPlanted = false;
}

public bomb_explode(planter,defuser)  {
	BombPlanted = false;
}

stock coords_standard_deviation(id) {
	new Sum, Avg, Variance, VarianceTot;
	new CoordID, VectorID;
	
	for(CoordID = 0; CoordID < 3; ++CoordID) {
		Sum = 0;
		Variance = 0;
		
		for(VectorID = 0; VectorID < 4; ++VectorID)
			Sum += CoordsBody[id][VectorID][CoordID];
		
		Avg = Sum / 4;
		
		for(VectorID = 0; VectorID < 4; ++VectorID)
			Variance += power(CoordsBody[id][VectorID][CoordID] - Avg, 2);
		
		Variance = Variance /(4- 1);
		
		VarianceTot += Variance;
	}
	
	return sqroot(VarianceTot);
}

stock coords_insert(id, CoordType) {
	for(new VectorID = 4 - 1; VectorID > 0;--VectorID) {	
		for(new CoordID = 0; CoordID < 3; ++CoordID) {
			if(CoordType == 0)
				CoordsBody[id][VectorID][CoordID] = CoordsBody[id][VectorID - 1][CoordID];
			else
				CoordsEyes[id][VectorID][CoordID] = CoordsEyes[id][VectorID - 1][CoordID];
		}
	}
	
	if(is_user_connected(id)) {
		if(CoordType == 0)
			get_user_origin(id, CoordsBody[id][0], 0);
		else
			get_user_origin(id, CoordsEyes[id][0], 3);
	}
}

#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

stock HudMessage(const id, const message[], red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 0.01, Float:holdtime = 3.0, Float:fadeintime = 0.01, Float:fadeouttime = 0.01) {
	new count = 1, players[32];
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {
				new color = pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))				
				message_begin(MSG_ONE_UNRELIABLE, SVC_DIRECTOR, _, players);
				write_byte(strlen(message) + 31);
				write_byte(DRC_CMD_MESSAGE);
				write_byte(effects);
				write_long(color);
				write_long(_:x);
				write_long(_:y);
				write_long(_:fadeintime);
				write_long(_:fadeouttime);
				write_long(_:holdtime);
				write_long(_:fxtime);
				write_string(message);
				message_end();
			}
		}
	}
}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
				write_byte(players);
				write_string(msg);
				message_end();
			}
		}
	} 
}
User avatar
DevilBoy.eXe
Moderator ajutator
Moderator ajutator
Posts: 1374
Joined: 05 Jun 2016, 22:04
Detinator Steam: Da
Detinator server CS: GO.WARED.RO
SteamID: DevilBoy_eXe
Reputatie: Moderator ajutator
Fond eXtream: -1
Location: beyond the time
Has thanked: 6 times
Been thanked: 16 times
Contact:

08 Oct 2019, 21:17

Netestat
| Afiseaza codul
#include <amxmodx>
#include <csx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>

#define PLUGIN "Furien AntiCamp"
#define VERSION "1.0"
// Extras din Furien V3.0 creat de Aragon*
#define AUTHOR "DaNNe."

#define TASKID_CHECKCAMPING		858

new bool:BombPlanted, bool:ChangeLevel = false, StandardDeviation[33], MapHasBomb = false, Meter[33], CheckCampingTime[33]
new CoordsBody[33][4][3], CoordsEyes[33][4][3]
new cvar_anticamp, cvar_camp_limit, cvar_metter_showspec

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	cvar_anticamp = register_cvar("furien50_anticamp", "1"); //----| Anti-Camp | 1 -> ON | 2 -> OFF |----//
	cvar_camp_limit = register_cvar("furien50_camp_limit", "15");  //----| Limita de camp |----//
	cvar_metter_showspec = register_cvar("furien50_metter_display_spec", "0"); //----| Vezi camp meter pe jucatorul pe care esti spec |----//
	
	register_logevent("LOGEVENT_RoundStart", 2, "1=Round_Start");
	register_logevent("LOGEVENT_RoundEnd", 2, "1=Round_End");
	
	new Bomb1 = engfunc(EngFunc_FindEntityByString,-1, "classname", "func_bomb_target");
	new Bomb2 = engfunc(EngFunc_FindEntityByString,-1, "classname", "info_bomb_target");
	if(is_valid_ent(Bomb1) || is_valid_ent(Bomb2))
		MapHasBomb = true
}

public server_changelevel() {
	ChangeLevel = true
}

public LOGEVENT_RoundStart() {
	if(get_pcvar_num(cvar_anticamp)) {
		for(new id = 0; id <= 32; id++) {
			Meter[id] = 0;
			CheckCampingTime[id] = 0;
		}
		set_task(0.5, "TASK_CheckCamping", TASKID_CHECKCAMPING, _, _, "b");
		if(MapHasBomb)
			BombPlanted = false;
	}
}

public LOGEVENT_RoundEnd() {
	remove_task(TASKID_CHECKCAMPING);
}

public TASK_CheckCamping() {
	new Players[32], Num;
	get_players(Players, Num, "ch");
	
	if(Num == 1 || BombPlanted || get_cvar_float("mp_timelimit") && !get_timeleft() || ChangeLevel)
		return;
	
	new PrevMeter, bool:PunishCamper;
	
	get_players(Players, Num, "ah");
	for(new index = 0; index < Num; ++index) {
		new id = Players[index];
		
		if(get_user_team(id) == 2 && !(get_user_flags(id) & ADMIN_IMMUNITY) && fm_get_user_maxspeed(id) > 2.0) {
			coords_insert(id, 0);
			CheckCampingTime[id] ++
			
			if(CheckCampingTime[id] > 2) {
				StandardDeviation[id] = coords_standard_deviation(id);
				CheckCampingTime[id] = 0
			}
			PrevMeter = Meter[id];
			
			Meter[id] += ((100 - StandardDeviation[id]) / get_pcvar_num(cvar_camp_limit));
			
			Meter[id] = clamp(Meter[id], 0, 100);
			
			if(Meter[id] < PrevMeter && Meter[id] < 80)
				Meter[id] -= (PrevMeter - Meter[id]) / 3;
			
			(Meter[id] >= 100) ? (PunishCamper = true) : (PunishCamper = false)					
			
			if(PunishCamper) {
				user_silentkill(id);
				ColorChat(id, "!g[FURIENLIFE-AFK]!y Ai primit slay pentru ca ai stat 15 sec pe loc!");
			}
			
			if(Meter[id]) {
				new r, g, b;
				
				if(Meter[id] > 90)
					r = 255;
				else if(Meter[id] > 80) {
					r = 255; 
					g = 100;
				}
				else if(Meter[id] > 60) {
					r = 255;
					g = 255;
				}
				else if(Meter[id] > 50) 
					g = 255; 
				else 
					b = 255;
				
				new Message[64];
				formatex(Message,sizeof(Message)-1,"CAMP: %i%%", Meter[id]);
				
				HudMessage(id, Message, r, g, b, -1.0, 0.85, _, _, 0.5);
				
				if(get_pcvar_num(cvar_metter_showspec)) {
					new Players[32], Num, Spectator;
					get_players(Players, Num, "bch");
					for(new index = 0; index < Num; ++index) {
						Spectator = Players[index];
						
						if(pev(Spectator, pev_iuser2) == id) {
							new Message[64];
							formatex(Message,sizeof(Message)-1,"CAMP: %i%%", Meter[id]);
							
							HudMessage(Spectator, Message, r, g, b, -1.0, 0.85, _, _, 0.5);
						}				
					}
				}
			}
		}
	}
}

public bomb_planted(planter) {
	BombPlanted = true
	ColorChat(0, "!g[FURIENLIFE-Bomb]!y Bomba a fost plantata!");
	ColorChat(0, "!g[FURIENLIFE]!y Protectia anti-camp a fost dezactivata!");
}

public bomb_defused(defuser) {
	BombPlanted = false;
}

public bomb_explode(planter,defuser)  {
	BombPlanted = false;
}

stock coords_standard_deviation(id) {
	new Sum, Avg, Variance, VarianceTot;
	new CoordID, VectorID;
	
	for(CoordID = 0; CoordID < 3; ++CoordID) {
		Sum = 0;
		Variance = 0;
		
		for(VectorID = 0; VectorID < 4; ++VectorID)
			Sum += CoordsBody[id][VectorID][CoordID];
		
		Avg = Sum / 4;
		
		for(VectorID = 0; VectorID < 4; ++VectorID)
			Variance += power(CoordsBody[id][VectorID][CoordID] - Avg, 2);
		
		Variance = Variance /(4- 1);
		
		VarianceTot += Variance;
	}
	
	return sqroot(VarianceTot);
}

stock coords_insert(id, CoordType) {
	for(new VectorID = 4 - 1; VectorID > 0;--VectorID) {	
		for(new CoordID = 0; CoordID < 3; ++CoordID) {
			if(CoordType == 0)
				CoordsBody[id][VectorID][CoordID] = CoordsBody[id][VectorID - 1][CoordID];
			else
				CoordsEyes[id][VectorID][CoordID] = CoordsEyes[id][VectorID - 1][CoordID];
		}
	}
	
	if(is_user_connected(id)) {
		if(CoordType == 0)
			get_user_origin(id, CoordsBody[id][0], 0);
		else
			get_user_origin(id, CoordsEyes[id][0], 3);
	}
}

#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

stock HudMessage(const id, const message[], red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 0.01, Float:holdtime = 3.0, Float:fadeintime = 0.01, Float:fadeouttime = 0.01) {
	new count = 1, players[32];
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(id)) {
				new color = pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))				
				message_begin(MSG_ONE_UNRELIABLE, SVC_DIRECTOR, _, id);
				write_byte(strlen(message) + 31);
				write_byte(DRC_CMD_MESSAGE);
				write_byte(effects);
				write_long(color);
				write_long(_:x);
				write_long(_:y);
				write_long(_:fadeintime);
				write_long(_:fadeouttime);
				write_long(_:holdtime);
				write_long(_:fxtime);
				write_string(message);
				message_end();
			}
		}
	}
}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(id)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, id);
				write_byte(id);
				write_string(msg);
				message_end();
			}
		}
	} 
}
Image
zLow69
Membru, skill 0
Membru, skill 0
Posts: 5
Joined: 08 Oct 2019, 20:14
Detinator Steam: Da
CS Status: Uite stau
Detinator server CS: Fury.PubZone.RO
SteamID: zlow411
Fond eXtream: 0
Location: Undeva cu barca
Contact:

10 Oct 2019, 13:47

Sa scoateti protectia de la admini , si nu apare mesajul dupa ce e plantata bomba , "Protectia Anti-Camp a fost dezactivata" , si sa apara la toti , Jucatorul x a luat slay pentru ca a facut camp
Cine mi le face pe toate are 5Euro paysafecard de la mine !
zLow69
Membru, skill 0
Membru, skill 0
Posts: 5
Joined: 08 Oct 2019, 20:14
Detinator Steam: Da
CS Status: Uite stau
Detinator server CS: Fury.PubZone.RO
SteamID: zlow411
Fond eXtream: 0
Location: Undeva cu barca
Contact:

10 Oct 2019, 20:41

Am rezolvat-o singur , mersi
Post Reply

Return to “Scripting”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests