[Cerere Plugin] Arunca armele

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 915
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 69 times
Been thanked: 136 times

22 Feb 2021, 09:56

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <cstrike>

#define PLUGIN "dropweapons"
#define VERSION "1.0"
#define AUTHOR "lexzor"

#if AMXX_VERSION_NUM < 183
	#define MAX_NAME_LENGTH 33
#endif

#define ACCES ADMIN_LEVEL_H

const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("amx_drop", "dropweap")
}

public dropweap(id)
{
	if(!(get_user_flags(id) & ACCES))
	{
		client_print(id, print_chat, "Trebuie sa fii admin pentru a folosi aceasta comanda!")
		return PLUGIN_HANDLED
	}
	new arg[MAX_NAME_LENGTH], name[MAX_NAME_LENGTH]
	read_argv(1, arg, charsmax(arg))
	static player; player = cmd_target(id, arg, CMDTARGET_NO_BOTS)
	
	if((player && cs_get_user_team(player) == CS_TEAM_CT) && is_user_alive(player))
	{
		drop_weapons (player, 1)
		drop_weapons (player, 2)
		get_user_name(player, name, charsmax(name))
		client_print(id, print_chat, "Ai aruncat armele jucatorului %s", name)
	}
	
	else if (player && (cs_get_user_team(player) != CS_TEAM_CT) && is_user_alive(player)) 
		client_print(id, print_chat, "Jucatorul nu este la echipa Counter-Terrorists!")
	
	else if (player && !is_user_alive(player)) 
		client_print(id, print_chat, "Jucatorul trebuie sa fie in viata!")
	
	else if (!player) 
		client_print(id, print_chat, "Jucatorul nu exista!")
	
	return 0
	
}

stock drop_weapons(id, dropwhat)
{
	static Weapons[32], Num, i, WeaponID;
	Num = 0;
	get_user_weapons(id, Weapons, Num);
	for(i = 0; i < Num; i ++)
	{
		WeaponID = Weapons[i];
		if((dropwhat == 1 && ((1 << WeaponID) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1 << WeaponID) & SECONDARY_WEAPONS_BIT_SUM )))
		{
			static DropName[32], WeaponEntity;
			get_weaponname(WeaponID, DropName, charsmax(DropName));
			WeaponEntity = fm_find_ent_by_owner(-1, DropName, id);
			set_pev(WeaponEntity, pev_iuser1, cs_get_user_bpammo (id, WeaponID));
			engclient_cmd(id, "drop", DropName);
			cs_set_user_bpammo(id, WeaponID, 0);
		}
	}
}
Last edited by lexz on 22 Feb 2021, 11:35, edited 1 time in total.
RoyalServer 2
User avatar
EnTeR_
Membru, skill +2
Membru, skill +2
Posts: 577
Joined: 13 Sep 2014, 16:36
Detinator Steam: Da
Fond eXtream: 0
Has thanked: 3 times
Been thanked: 29 times

22 Feb 2021, 10:45

Vedeti ca toti ati confundat read_argv cu read_args.
Discord: eyekon13
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 915
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 69 times
Been thanked: 136 times

22 Feb 2021, 11:36

problema a fost ca am gresit parametrii la read_argv. de data asta va merge, incearca din nou
Shadows Adi
Membru, skill +1
Membru, skill +1
Posts: 349
Joined: 26 Jan 2020, 18:52
Detinator Steam: Da
CS Status: 0x416469
SteamID: shadowsadi120
Fond eXtream: 0
Has thanked: 14 times
Been thanked: 50 times

22 Feb 2021, 17:33

EnTeR_ wrote:
22 Feb 2021, 10:45
Vedeti ca toti ati confundat read_argv cu read_args.
read_argv() returneaza argumentele din comanda, de exemplu: amx_kick "Adi", aceasta nativa va citi doar "Adi"
read_args() returneaza intreaga comanda + argumentele acesteia, exemplu: amx_kick "Adi", aceasta nativa va returna "amx_kick Adi"

Ai testat codul dat de catre mine?
Shadows Adi wrote:
22 Feb 2021, 08:41
Poftim:

Code: Select all

/* Sublime AMXX Editor v4.2 */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN  "Drop Weapons"
#define VERSION "1.0"
#define AUTHOR  "Shadows Adi"

new const g_szWeaponName[][] =
{
	"weapon_p228",
	"weapon_scout",
	"weapon_hegrenade",
	"weapon_xm1014",
	"weapon_c4",
	"weapon_mac10",
	"weapon_aug",
	"weapon_smokegrenade",
	"weapon_elite",
	"weapon_fiveseven",
	"weapon_ump45",
	"weapon_sg550",
	"weapon_galil",
	"weapon_famas",
	"weapon_usp",
	"weapon_glock18",
	"weapon_awp",
	"weapon_mp5navy",
	"weapon_m249",
	"weapon_m3",
	"weapon_m4a1",
	"weapon_tmp",
	"weapon_g3sg1",
	"weapon_flashbang",
	"weapon_deagle",
	"weapon_sg552",
	"weapon_ak47",
	"weapon_knife",
	"weapon_p90"
};

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_concmd("amx_drop", "concmd_drop")
}

public concmd_drop(id)
{
	new szArg[MAX_NAME_LENGTH], iTarget, CsTeams:iTeam
	read_argv(1, szArg, charsmax(szArg))
	remove_quotes(szArg)

	iTarget = cmd_target(id, szArg, CMDTARGET_ONLY_ALIVE)

	if(iTarget)
	{
		new szName[MAX_NAME_LENGTH]
		get_user_name(iTarget, szName, charsmax(szName))
		iTeam = cs_get_user_team(iTarget)

		switch(iTeam)
		{
			case CS_TEAM_CT:
			{
				for(new i; i < sizeof(g_szWeaponName); i++)
				{
					client_cmd(iTarget, "drop", g_szWeaponName[i])
				}
				console_print(id, "Ai aruncat armele jucatorului ^"%s^"", szName)
				goto _return
			}
			default:
			{
				console_print(id, "Jucatorul ^"%s^" nu este in echipa CT.", szName)
				goto _return
			}
		}
	}
	else
	{
		console_print(id, "Jucatorul ^"%s^" nu poate fi gasit.", szArg)
		goto _return
	}

	_return:
	return PLUGIN_HANDLED
}
User avatar
EnTeR_
Membru, skill +2
Membru, skill +2
Posts: 577
Joined: 13 Sep 2014, 16:36
Detinator Steam: Da
Fond eXtream: 0
Has thanked: 3 times
Been thanked: 29 times

22 Feb 2021, 18:02

Shadows Adi wrote:
22 Feb 2021, 17:33
EnTeR_ wrote:
22 Feb 2021, 10:45
Vedeti ca toti ati confundat read_argv cu read_args.
read_argv() returneaza argumentele din comanda, de exemplu: amx_kick "Adi", aceasta nativa va citi doar "Adi"
read_args() returneaza intreaga comanda + argumentele acesteia, exemplu: amx_kick "Adi", aceasta nativa va returna "amx_kick Adi"

Ai testat codul dat de catre mine?
Shadows Adi wrote:
22 Feb 2021, 08:41
Poftim:

Code: Select all

/* Sublime AMXX Editor v4.2 */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN  "Drop Weapons"
#define VERSION "1.0"
#define AUTHOR  "Shadows Adi"

new const g_szWeaponName[][] =
{
	"weapon_p228",
	"weapon_scout",
	"weapon_hegrenade",
	"weapon_xm1014",
	"weapon_c4",
	"weapon_mac10",
	"weapon_aug",
	"weapon_smokegrenade",
	"weapon_elite",
	"weapon_fiveseven",
	"weapon_ump45",
	"weapon_sg550",
	"weapon_galil",
	"weapon_famas",
	"weapon_usp",
	"weapon_glock18",
	"weapon_awp",
	"weapon_mp5navy",
	"weapon_m249",
	"weapon_m3",
	"weapon_m4a1",
	"weapon_tmp",
	"weapon_g3sg1",
	"weapon_flashbang",
	"weapon_deagle",
	"weapon_sg552",
	"weapon_ak47",
	"weapon_knife",
	"weapon_p90"
};

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_concmd("amx_drop", "concmd_drop")
}

public concmd_drop(id)
{
	new szArg[MAX_NAME_LENGTH], iTarget, CsTeams:iTeam
	read_argv(1, szArg, charsmax(szArg))
	remove_quotes(szArg)

	iTarget = cmd_target(id, szArg, CMDTARGET_ONLY_ALIVE)

	if(iTarget)
	{
		new szName[MAX_NAME_LENGTH]
		get_user_name(iTarget, szName, charsmax(szName))
		iTeam = cs_get_user_team(iTarget)

		switch(iTeam)
		{
			case CS_TEAM_CT:
			{
				for(new i; i < sizeof(g_szWeaponName); i++)
				{
					client_cmd(iTarget, "drop", g_szWeaponName[i])
				}
				console_print(id, "Ai aruncat armele jucatorului ^"%s^"", szName)
				goto _return
			}
			default:
			{
				console_print(id, "Jucatorul ^"%s^" nu este in echipa CT.", szName)
				goto _return
			}
		}
	}
	else
	{
		console_print(id, "Jucatorul ^"%s^" nu poate fi gasit.", szArg)
		goto _return
	}

	_return:
	return PLUGIN_HANDLED
}
Păi argumentele din comanda, nu avea ce cauta id acolo si nici remove_qoutes, în fine vad ca ai modificat.
Discord: eyekon13
Ykaru
Membru, skill 0
Membru, skill 0
Posts: 98
Joined: 29 Jul 2019, 01:33
Detinator Steam: Da
CS Status: Ha ?
Detinator server CS: BB.LALEAGANE.RO
Fond eXtream: 0
Has thanked: 15 times

23 Feb 2021, 01:22

lexz wrote:
22 Feb 2021, 09:56

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <cstrike>

#define PLUGIN "dropweapons"
#define VERSION "1.0"
#define AUTHOR "lexzor"

#if AMXX_VERSION_NUM < 183
	#define MAX_NAME_LENGTH 33
#endif

#define ACCES ADMIN_LEVEL_H

const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("amx_drop", "dropweap")
}

public dropweap(id)
{
	if(!(get_user_flags(id) & ACCES))
	{
		client_print(id, print_chat, "Trebuie sa fii admin pentru a folosi aceasta comanda!")
		return PLUGIN_HANDLED
	}
	new arg[MAX_NAME_LENGTH], name[MAX_NAME_LENGTH]
	read_argv(1, arg, charsmax(arg))
	static player; player = cmd_target(id, arg, CMDTARGET_NO_BOTS)
	
	if((player && cs_get_user_team(player) == CS_TEAM_CT) && is_user_alive(player))
	{
		drop_weapons (player, 1)
		drop_weapons (player, 2)
		get_user_name(player, name, charsmax(name))
		client_print(id, print_chat, "Ai aruncat armele jucatorului %s", name)
	}
	
	else if (player && (cs_get_user_team(player) != CS_TEAM_CT) && is_user_alive(player)) 
		client_print(id, print_chat, "Jucatorul nu este la echipa Counter-Terrorists!")
	
	else if (player && !is_user_alive(player)) 
		client_print(id, print_chat, "Jucatorul trebuie sa fie in viata!")
	
	else if (!player) 
		client_print(id, print_chat, "Jucatorul nu exista!")
	
	return 0
	
}

stock drop_weapons(id, dropwhat)
{
	static Weapons[32], Num, i, WeaponID;
	Num = 0;
	get_user_weapons(id, Weapons, Num);
	for(i = 0; i < Num; i ++)
	{
		WeaponID = Weapons[i];
		if((dropwhat == 1 && ((1 << WeaponID) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1 << WeaponID) & SECONDARY_WEAPONS_BIT_SUM )))
		{
			static DropName[32], WeaponEntity;
			get_weaponname(WeaponID, DropName, charsmax(DropName));
			WeaponEntity = fm_find_ent_by_owner(-1, DropName, id);
			set_pev(WeaponEntity, pev_iuser1, cs_get_user_bpammo (id, WeaponID));
			engclient_cmd(id, "drop", DropName);
			cs_set_user_bpammo(id, WeaponID, 0);
		}
	}
}
Merge, mersi.
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: Petal [Bot] and 20 guests