Page 1 of 2

plugin norecoli (rezolvat!)

Posted: 27 Jan 2019, 18:31
by Zppp.Mihai94
Plugin Cerut: no recoli la arme
Descriere (adica ce face el mai exact): salut, vreau si eu un plugin de no-recoli pentru toate armele si sa poata beneficia doar cei care au acces la ADMIN_LEVEL_H, multumesc.
Serverul ruleaza (HLDS/ReHLDS):REHLDS
Versiune AMX Mod X:1.8.3
Modul Serverului: zombie plague

Re: plugin norecoli

Posted: 27 Jan 2019, 18:49
by levin

Re: plugin norecoli

Posted: 28 Jan 2019, 14:39
by LondoN eXtream
| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < engine>

public client_PreThink ( Player )
{
	if ( !( 1 <= Player <= get_maxplayers ( ) ) || !is_user_alive ( Player ) || !( get_user_flags ( Player ) & ADMIN_LEVEL_H ) )
		return;

	entity_set_vector ( Player, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0} );
}

Re: plugin norecoli

Posted: 28 Jan 2019, 18:36
by levin
nu e mai ok în server_frame?

Re: plugin norecoli

Posted: 29 Jan 2019, 13:39
by LondoN eXtream
L E V I N wrote:nu e mai ok în server_frame?
Tot odata la fiecare frame se execută.
Totusi ar fi bun in ham weapon attack pre de setat

Re: plugin norecoli

Posted: 31 Jan 2019, 10:20
by Zppp.Mihai94
se poate face sa fie tinta cat mai fixa? pentru ca tot sare putin cand tragi.

la sursa asta
| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < engine>

public client_PreThink ( Player )
{
	if ( !( 1 <= Player <= get_maxplayers ( ) ) || !is_user_alive ( Player ) || !( get_user_flags ( Player ) & ADMIN_LEVEL_H ) )
		return;

	entity_set_vector ( Player, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0} );
}

este acest plugin dar e ca extra item si se cumpara cu credite, si daca cumperi no-recoli ai la toate armele dar tinta e fixa nu sare de loc se poate face dupa acesta?
| Afiseaza codul
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombie_plague_special>
#include <xs>

new g_norecoil[33]
new Float: cl_pushangle[33][3]
new g_itemid_norecoil, g_maxplayers

const WEAPONS_BITSUM = (1<<CSW_KNIFE|1<<CSW_HEGRENADE|1<<CSW_FLASHBANG|1<<CSW_SMOKEGRENADE|1<<CSW_C4)

public plugin_init()
{
	register_plugin("[ZP] Extra Item: No-Recoli (O Runda)", "0.1.0", "CarsonMotion")

	g_itemid_norecoil = zp_register_extra_item("No-Recoli (O Runda)", 20, ZP_TEAM_HUMAN)

	new weapon_name[24]
	for (new i = 1; i <= 30; i++)
	{
		if (!(WEAPONS_BITSUM & 1 << i) && get_weaponname(i, weapon_name, 23))
		{
			RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Pre")
			RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Post", 1)
		}
	}

	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")

	g_maxplayers = get_maxplayers()
}

public zp_extra_item_selected(player, itemid)
{
	if (itemid == g_itemid_norecoil)
	{
		g_norecoil[player] = true
		client_print(player, print_chat, "[ZP] Ai Cumparat No-Recoli Pentru Arma Ta!")
	}
}

public zp_user_infected_post(id)
	g_norecoil[id] = false

public client_connect(id)
	g_norecoil[id] = false

public event_round_start()
	for (new id = 1; id <= g_maxplayers; id++)
		g_norecoil[id] = false

public fw_Weapon_PrimaryAttack_Pre(entity)
{
	new id = pev(entity, pev_owner)

	if (g_norecoil[id])
	{
		pev(id, pev_punchangle, cl_pushangle[id])
		return HAM_IGNORED;
	}
	return HAM_IGNORED;
}

public fw_Weapon_PrimaryAttack_Post(entity)
{
	new id = pev(entity, pev_owner)

	if (g_norecoil[id])
	{
		new Float: push[3]
		pev(id, pev_punchangle, push)
		xs_vec_sub(push, cl_pushangle[id], push)
		xs_vec_mul_scalar(push, 0.0, push)
		xs_vec_add(push, cl_pushangle[id], push)
		set_pev(id, pev_punchangle, push)
		return HAM_IGNORED;
	}
	return HAM_IGNORED;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

Re: plugin norecoli

Posted: 31 Jan 2019, 11:04
by levin

Code: Select all

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#pragma tabsize 0

new Float: cl_pushangle[33][3]

const WEAPONS_BITSUM = (1<<CSW_KNIFE|1<<CSW_HEGRENADE|1<<CSW_FLASHBANG|1<<CSW_SMOKEGRENADE|1<<CSW_C4)

public plugin_init()
{
	register_plugin("[ZP] Extra Item: No-Recoli (O Runda)", "0.1.0", "CarsonMotion")

	new weapon_name[24]
	for (new i = 1; i <= 30; i++)
	{
		if (!(WEAPONS_BITSUM & 1 << i) && get_weaponname(i, weapon_name, 23))
		{
			RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Pre")
			RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Post", 1)
		}
	}

	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
}

public fw_Weapon_PrimaryAttack_Pre(entity)
{
	if(pev_valid(entity))
	{
	new id = pev(entity, pev_owner)

	if (is_user_alive(id))
	{
		pev(id, pev_punchangle, cl_pushangle[id])
		return HAM_IGNORED;
	}
	}
	return HAM_IGNORED;
}
public fw_Weapon_PrimaryAttack_Post(entity)
{
	if(pev_valid(entity))
	{
	new id = pev(entity, pev_owner)

	if (is_user_alive(id))
	{
		new Float: push[3]
		pev(id, pev_punchangle, push)
		xs_vec_sub(push, cl_pushangle[id], push)
		xs_vec_mul_scalar(push, 0.0, push)
		xs_vec_add(push, cl_pushangle[id], push)
		set_pev(id, pev_punchangle, push)
		return HAM_IGNORED;
	}
	}
	return HAM_IGNORED;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

Re: plugin norecoli

Posted: 31 Jan 2019, 11:27
by Zppp.Mihai94
merge pluginul dar e pentru toti jucatori de pe server, eu as vrea daca se poate sa fie doar pentru cei care detin VIP acces-ul e ADMIN_LEVEL_H

Re: plugin norecoli

Posted: 31 Jan 2019, 18:16
by levin

Code: Select all

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#pragma tabsize 0

#define VIP_ACCESS ADMIN_LEVEL_H //flag t
#define is_vip(%0)	(get_user_flags(%0)&VIP_ACCESS)

new Float: cl_pushangle[33][3]

const WEAPONS_BITSUM = (1<<CSW_KNIFE|1<<CSW_HEGRENADE|1<<CSW_FLASHBANG|1<<CSW_SMOKEGRENADE|1<<CSW_C4)

public plugin_init()
{
   register_plugin("[ZP] Extra Item: No-Recoli (O Runda)", "0.1.0", "CarsonMotion")

   new weapon_name[24]
   for (new i = 1; i <= 30; i++)
   {
      if (!(WEAPONS_BITSUM & 1 << i) && get_weaponname(i, weapon_name, 23))
      {
         RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Pre")
         RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Post", 1)
      }
   }

   register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
}

public fw_Weapon_PrimaryAttack_Pre(entity)
{
   if(pev_valid(entity))
   {
   new id = pev(entity, pev_owner)

   if (is_user_alive(id)&&is_vip(id))
   {
      pev(id, pev_punchangle, cl_pushangle[id])
      return HAM_IGNORED;
   }
   }
   return HAM_IGNORED;
}
public fw_Weapon_PrimaryAttack_Post(entity)
{
   if(pev_valid(entity))
   {
   new id = pev(entity, pev_owner)

   if (is_user_alive(id)&&is_vip(id))
   {
      new Float: push[3]
      pev(id, pev_punchangle, push)
      xs_vec_sub(push, cl_pushangle[id], push)
      xs_vec_mul_scalar(push, 0.0, push)
      xs_vec_add(push, cl_pushangle[id], push)
      set_pev(id, pev_punchangle, push)
      return HAM_IGNORED;
   }
   }
   return HAM_IGNORED;
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

Re: plugin norecoli

Posted: 05 Feb 2019, 08:45
by Zppp.Mihai94
l.am compilat merge tot numai ca imi da eroarea asta
L 02/04/2019 - 15:17:25: Info (map "zm_fox") (file "addons/amxmodx/logs/error_20190204.log")
L 02/04/2019 - 15:17:25: Function "event_round_start" was not found
L 02/04/2019 - 15:17:25: [AMXX] Displaying debug trace (plugin "zm_vip_norecoli.amxx", version "0.1.0")
L 02/04/2019 - 15:17:25: [AMXX] Run time error 19: function not found
L 02/04/2019 - 15:17:25: [AMXX] [0] okhuxzof.sma.p::plugin_init (line 29)

am pus si debug la urma dar degeaba tot apare.

Re: plugin norecoli

Posted: 05 Feb 2019, 15:38
by levin
așa și?nu merge pluginu?-_-

Re: plugin norecoli

Posted: 05 Feb 2019, 18:06
by Zppp.Mihai94
ba da, dar apare erori in log...