Knife Blink limita[rezolvat]

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

User avatar
alynut
Administrator
Administrator
Posts: 7121
Joined: 02 Jul 2012, 06:31
Detinator Steam: Da
CS Status: In concediu, activez mai rar .
SteamID: alynut991
Reputatie: Fost Administrator
Fost Intermediar
Location: Bucuresti
Has thanked: 183 times
Been thanked: 443 times

22 Jul 2014, 23:37

Salut am si eu acest plugin knife blink si pe server toti abuzeaza de el il folosesc de 99999 de ori :| vreau sa il poata folo de maxim 10 ori pe runda .
| Afiseaza codul
[code]
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <colorchat>
#include <chr_engine>

// HUD messages
const Float:HUD_EVENT_X = -1.0
const Float:HUD_EVENT_Y = 0.17
const Float:HUD_INFECT_X = 0.05
const Float:HUD_INFECT_Y = 0.45
const Float:HUD_SPECT_X = -1.0
const Float:HUD_SPECT_Y = 0.8
const Float:HUD_STATS_X = 0.02
const Float:HUD_STATS_Y = 0.9

#pragma tabsize 0

#define MIN_DISTANCE 50

new const g_item_name[] = { "Knife Blink" }
const g_item_cost = 20
const g_iMaxDistance = 400;

new Float:g_fSpeed = 1000.0;
new Float:g_fDelay = 1.0;

new g_iMaxPlayers;
new g_iEnemy[33];
new g_iInBlink[33];
new Float:g_fLastSlash[33];
new g_iCanceled[33];
new g_iSlash[33];
new g_iBlinks[33];
new g_itemid_blink;

public plugin_init(){
	
	register_plugin("[ZP] Extra Item: Knife Blink", "1.3", "ExtreamCS");
	
	g_iMaxPlayers = get_maxplayers();
	
	g_itemid_blink = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE);
	
	register_forward(FM_TraceLine, "FW_TraceLine_Post", 5);
	register_forward(FM_PlayerPreThink, "FW_PlayerPreThink");
	
	register_event("HLTV", "EVENT_round_start", "a", "1=0", "2=0")
}

public FW_TraceLine_Post(Float:start[3], Float:end[3], conditions, id, trace){
	
	if (!CHECK_ValidPlayer(id))
		return FMRES_IGNORED;
	
	new iWeaponID = get_user_weapon(id);
	
	if ( iWeaponID != CSW_KNIFE ){
		
		OP_Cancel(id);
		return FMRES_IGNORED;
	}
	
	new enemy = g_iEnemy[id];
	
	if (!enemy){
		
		enemy = get_tr2(trace, TR_pHit);
		
		if ( !CHECK_ValidPlayer(enemy) || zp_get_user_zombie(enemy) ){
			
			OP_Cancel(id);
			return FMRES_IGNORED;
		}
		
		g_iEnemy[id] = enemy;
	}
	
	return FMRES_IGNORED;
}

public FW_PlayerPreThink(id){
	
	if (!CHECK_ValidPlayer(id))
		return FMRES_IGNORED;
	
	new iWeaponID = get_user_weapon(id);
	
	if ( iWeaponID != CSW_KNIFE || !zp_get_user_zombie(id) ){
		
		OP_Cancel(id);
		return FMRES_IGNORED;
	}
	
	if ( g_iBlinks[id] == 0 )
		return FMRES_IGNORED;
	
	new button = pev(id,pev_button);
	
	if ( !(button & IN_ATTACK) && !(button & IN_ATTACK2) ){
		
		OP_Cancel(id)
		return FMRES_IGNORED;
	}
	
	if (g_iSlash[id])
		g_iSlash[id] = 0;
	
	OP_NearEnemy(id);
	
	if( g_iInBlink[id] ){
		
		OP_SetBlink(id);
		OP_Blink(id);
		g_iCanceled[id] = 0;
	}

	return FMRES_IGNORED;
}

// Player buys our upgrade, add one blink
public zp_extra_item_selected(player, itemid)
{
	if (itemid == g_itemid_blink){


		new name[32]
		get_user_name(player, name, 31)

		g_iBlinks[player] += 10;

   		set_hudmessage(255, 0, 0, HUD_SPECT_X, HUD_SPECT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
   		show_hudmessage(0, "%s bought a Knife Blinks!!", name)
		ColorChat(player, NORMAL, "^x04[Zm.LegendCS.Com]^x01 You have now [^x04%d^x01] Knife ^x04Blinks^x01", g_iBlinks[player]);
	}
}

// Reset blinks for all players on newround
public EVENT_round_start()
{
	for (new id; id <= 32; id++) g_iBlinks[id] = 0;
}

public OP_NearEnemy(id){
	
	new enemy = g_iEnemy[id];
	new Float:time = get_gametime();
	
	if (!enemy || g_fLastSlash[id]+g_fDelay>time){
		
		g_iInBlink[id] = 0;
		return;
	}
	
	new origin[3], origin_enemy[3];
	
	get_user_origin(id, origin, 0);
	get_user_origin(enemy, origin_enemy, 0);
	
	new distance = get_distance(origin, origin_enemy);
	
	if ( MIN_DISTANCE<=distance<=g_iMaxDistance){
		
		g_iInBlink[id] = 1;
		return;
		
	}else if (MIN_DISTANCE>distance && g_iInBlink[id])
	{
		OP_Slash(id);
	}
	OP_Cancel(id);
}

public OP_Blink(id){
	
	new Float:new_velocity[3];
	new enemy = g_iEnemy[id];
	new Float:origin_enemy[3];
	
	pev(enemy, pev_origin, origin_enemy);
	entity_set_aim(id, origin_enemy);
	
	get_speed_vector2(id, enemy, g_fSpeed, new_velocity)
	set_pev(id, pev_velocity, new_velocity);
}

public OP_Cancel(id){
	
	g_iInBlink[id] = 0;
	g_iEnemy[id] = 0;
	if (!g_iCanceled[id]){
		
		OP_SetBlink(id);
		g_iCanceled[id] = 1;
	}
}

public OP_Slash(id){
	
	set_pev(id, pev_velocity, {0.0,0.0,0.0});		// stop player's blink
	
	new weaponID = get_user_weapon(id, _, _);
	
	if(weaponID == CSW_KNIFE){
		
		new weapon[32]
		
		get_weaponname(weaponID,weapon,31)
		
		new ent = fm_find_ent_by_owner(-1,weapon,id)
		
		if(ent){
			
			set_pdata_float(ent,46, 0.0);
			set_pdata_float(ent,47, 0.0);
			g_iSlash[id] = 5;
			g_fLastSlash[id] = get_gametime();
			g_iBlinks[id] -= 1;
			new name[32];
			get_user_name(id,name,31)
			ColorChat(0, GREY, "^x04[Zm.LegendCS.Com]^x01 ^x03%s^x01 just used a ^x04Knife Blink!^x01 [ ^x04%d^x01 remaining ] ", name, g_iBlinks[id]);
		}
	}  
}

public OP_SetBlink(id){
	
	new blink = g_iInBlink[id];
	
	if (blink>1)
		return;
	
	if (blink)
		g_iInBlink[id] += 1;
}

public CHECK_ValidPlayer(id){
	
	if (1<=id<=g_iMaxPlayers && is_user_alive(id))
		return 1;
	
	return 0;
}

// from fakemeta_util.inc
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
	new strtype[11] = "classname", ent = index;
	switch (jghgtype) {
		case 1: strtype = "target";
		case 2: strtype = "targetname";
	}

	while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}

	return ent;
}

public OP_Slash1(id){
  ColorChat(0, GREY, "This plugin created R@yy@N")
}[/code]
RoyalServer 2
Cosmin
Fost moderator
Fost moderator
Posts: 9362
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

23 Jul 2014, 00:53

| Afiseaza codul
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <colorchat>
#include <chr_engine>

// HUD messages
const Float:HUD_EVENT_X = -1.0
const Float:HUD_EVENT_Y = 0.17
const Float:HUD_INFECT_X = 0.05
const Float:HUD_INFECT_Y = 0.45
const Float:HUD_SPECT_X = -1.0
const Float:HUD_SPECT_Y = 0.8
const Float:HUD_STATS_X = 0.02
const Float:HUD_STATS_Y = 0.9

#pragma tabsize 0

#define MIN_DISTANCE 50
#define MAX_ROUND	10	//de aici modifici de cate ori sa foloseasca pe runda.

new const g_item_name[] = { "Knife Blink" }
const g_item_cost = 20
const g_iMaxDistance = 400;

new Float:g_fSpeed = 1000.0;
new Float:g_fDelay = 1.0;

new g_iMaxPlayers;
new g_iEnemy[33];
new g_iInBlink[33];
new Float:g_fLastSlash[33];
new g_iCanceled[33];
new g_iSlash[33];
new g_iBlinks[33];
new g_itemid_blink;

new Limita[33]

public plugin_init(){
   
   register_plugin("[ZP] Extra Item: Knife Blink", "1.3", "ExtreamCS");
   
   g_iMaxPlayers = get_maxplayers();
   
   g_itemid_blink = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE);
   
   register_forward(FM_TraceLine, "FW_TraceLine_Post", 5);
   register_forward(FM_PlayerPreThink, "FW_PlayerPreThink");
   
   register_event("HLTV", "EVENT_round_start", "a", "1=0", "2=0")
}

public FW_TraceLine_Post(Float:start[3], Float:end[3], conditions, id, trace){
   
   if (!CHECK_ValidPlayer(id))
      return FMRES_IGNORED;
   
   new iWeaponID = get_user_weapon(id);
   
   if ( iWeaponID != CSW_KNIFE ){
      
      OP_Cancel(id);
      return FMRES_IGNORED;
   }
   
   new enemy = g_iEnemy[id];
   
   if (!enemy){
      
      enemy = get_tr2(trace, TR_pHit);
      
      if ( !CHECK_ValidPlayer(enemy) || zp_get_user_zombie(enemy) ){
         
         OP_Cancel(id);
         return FMRES_IGNORED;
      }
      
      g_iEnemy[id] = enemy;
   }
   
   return FMRES_IGNORED;
}

public FW_PlayerPreThink(id){
   
   if (!CHECK_ValidPlayer(id))
      return FMRES_IGNORED;
   
   new iWeaponID = get_user_weapon(id);
   
   if ( iWeaponID != CSW_KNIFE || !zp_get_user_zombie(id) ){
      
      OP_Cancel(id);
      return FMRES_IGNORED;
   }
   
   if ( g_iBlinks[id] == 0 )
      return FMRES_IGNORED;
   
   new button = pev(id,pev_button);
   
   if ( !(button & IN_ATTACK) && !(button & IN_ATTACK2) ){
      
      OP_Cancel(id)
      return FMRES_IGNORED;
   }
   
   if (g_iSlash[id])
      g_iSlash[id] = 0;
   
   OP_NearEnemy(id);
   
   if( g_iInBlink[id] ){
      
      OP_SetBlink(id);
      OP_Blink(id);
      g_iCanceled[id] = 0;
   }

   return FMRES_IGNORED;
}

// Player buys our upgrade, add one blink
public zp_extra_item_selected(player, itemid)
{
	if(Limita[player] == MAX_ROUND)
	{
		ColorChat(player, NORMAL, "^x04[Zm.LegendCS.Com]Nu poti folosii de mai mult de %i ori pe runda acest item.", MAX_ROUND)	//aici iti pui tu mesajul cum vrei
		return
	}
   if (itemid == g_itemid_blink){
      new name[32]
      get_user_name(player, name, 31)
	Limita[player]++;
      g_iBlinks[player] += 10;

         set_hudmessage(255, 0, 0, HUD_SPECT_X, HUD_SPECT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
         show_hudmessage(0, "%s bought a Knife Blinks!!", name)
      ColorChat(player, NORMAL, "^x04[Zm.LegendCS.Com]^x01 You have now [^x04%d^x01] Knife ^x04Blinks^x01", g_iBlinks[player]);
   }
}

// Reset blinks for all players on newround
public EVENT_round_start()
{
   for (new id; id <= 32; id++) {
		g_iBlinks[id] = 0;
		Limita[id] = 0
	}
}
public client_disconnect(id)	Limita[id] = 0

public OP_NearEnemy(id){
   
   new enemy = g_iEnemy[id];
   new Float:time = get_gametime();
   
   if (!enemy || g_fLastSlash[id]+g_fDelay>time){
      
      g_iInBlink[id] = 0;
      return;
   }
   
   new origin[3], origin_enemy[3];
   
   get_user_origin(id, origin, 0);
   get_user_origin(enemy, origin_enemy, 0);
   
   new distance = get_distance(origin, origin_enemy);
   
   if ( MIN_DISTANCE<=distance<=g_iMaxDistance){
      
      g_iInBlink[id] = 1;
      return;
      
   }else if (MIN_DISTANCE>distance && g_iInBlink[id])
   {
      OP_Slash(id);
   }
   OP_Cancel(id);
}

public OP_Blink(id){
   
   new Float:new_velocity[3];
   new enemy = g_iEnemy[id];
   new Float:origin_enemy[3];
   
   pev(enemy, pev_origin, origin_enemy);
   entity_set_aim(id, origin_enemy);
   
   get_speed_vector2(id, enemy, g_fSpeed, new_velocity)
   set_pev(id, pev_velocity, new_velocity);
}

public OP_Cancel(id){
   
   g_iInBlink[id] = 0;
   g_iEnemy[id] = 0;
   if (!g_iCanceled[id]){
      
      OP_SetBlink(id);
      g_iCanceled[id] = 1;
   }
}

public OP_Slash(id){
   
   set_pev(id, pev_velocity, {0.0,0.0,0.0});      // stop player's blink
   
   new weaponID = get_user_weapon(id, _, _);
   
   if(weaponID == CSW_KNIFE){
      
      new weapon[32]
      
      get_weaponname(weaponID,weapon,31)
      
      new ent = fm_find_ent_by_owner(-1,weapon,id)
      
      if(ent){
         
         set_pdata_float(ent,46, 0.0);
         set_pdata_float(ent,47, 0.0);
         g_iSlash[id] = 5;
         g_fLastSlash[id] = get_gametime();
         g_iBlinks[id] -= 1;
         new name[32];
         get_user_name(id,name,31)
         ColorChat(0, GREY, "^x04[Zm.LegendCS.Com]^x01 ^x03%s^x01 just used a ^x04Knife Blink!^x01 [ ^x04%d^x01 remaining ] ", name, g_iBlinks[id]);
      }
   }  
}

public OP_SetBlink(id){
   
   new blink = g_iInBlink[id];
   
   if (blink>1)
      return;
   
   if (blink)
      g_iInBlink[id] += 1;
}

public CHECK_ValidPlayer(id){
   
   if (1<=id<=g_iMaxPlayers && is_user_alive(id))
      return 1;
   
   return 0;
}

// from fakemeta_util.inc
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
   new strtype[11] = "classname", ent = index;
   switch (jghgtype) {
      case 1: strtype = "target";
      case 2: strtype = "targetname";
   }

   while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}

   return ent;
}

public OP_Slash1(id){
  ColorChat(0, GREY, "This plugin created R@yy@N")
}
modifici tu MAX_ROUND 10 //in loc de 10 pui de cate ori sa poata folosi pe runda..
User avatar
alynut
Administrator
Administrator
Posts: 7121
Joined: 02 Jul 2012, 06:31
Detinator Steam: Da
CS Status: In concediu, activez mai rar .
SteamID: alynut991
Reputatie: Fost Administrator
Fost Intermediar
Location: Bucuresti
Has thanked: 183 times
Been thanked: 443 times

23 Jul 2014, 01:08

Imi da eroare la compilare .

/tmp/textXaNA3w.sma(3) : fatal error 100: cannot read from file: "zombieplague"

Compilation aborted.
1 Error.
Cosmin
Fost moderator
Fost moderator
Posts: 9362
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

23 Jul 2014, 01:10

trebuie sa ai zombieplague.inc in scripting->include :)
User avatar
alynut
Administrator
Administrator
Posts: 7121
Joined: 02 Jul 2012, 06:31
Detinator Steam: Da
CS Status: In concediu, activez mai rar .
SteamID: alynut991
Reputatie: Fost Administrator
Fost Intermediar
Location: Bucuresti
Has thanked: 183 times
Been thanked: 443 times

23 Jul 2014, 01:14

scosmynnnn wrote:trebuie sa ai zombieplague.inc in scripting->include :)
Il am .
:| | Afiseaza codul
[code]/*================================================================================
	
	---------------------------------------
	-*- Zombie Plague 4.3 Includes File -*-
	---------------------------------------
	
	~~~~~~~~~~
	- How To -
	~~~~~~~~~~
	
	To make use of the Zombie Plague API features in your plugin, just
	add the following line at the beginning of your script:
	
	#include <zombieplague>
	
	~~~~~~~~~~~
	- Natives -
	~~~~~~~~~~~
	
	These work just like any other functions: you may have to pass
	parameters and they usually return values.
	
	Example:
	
	if ( is_user_alive( id ) && zp_get_user_zombie( id ) )
	{
		server_print( "Player %d is alive and a zombie", id )
	}
	
	~~~~~~~~~~~~
	- Forwards -
	~~~~~~~~~~~~
	
	Forwards get called whenever an event happens during the game.
	You need to make a public callback somewhere on your script,
	and it will automatically be triggered when the event occurs.
	
	Example:
	
	public zp_user_infected_post( id, infector, nemesis )
	{
		if ( !infector || nemesis )
			return;
		
		server_print( "Player %d just got infected by %d!", id, infector )
	}
	
	Also, take note of cases when there's a suffix:
	
	* _pre  : means the forward will be called BEFORE the event happens
	* _post : means it will be called AFTER the event takes place
	
=================================================================================*/

#if defined _zombieplague_included
  #endinput
#endif
#define _zombieplague_included

/* Teams for zp_register_extra_item() */
#define ZP_TEAM_ZOMBIE (1<<0)
#define ZP_TEAM_HUMAN (1<<1)
#define ZP_TEAM_NEMESIS (1<<2)
#define ZP_TEAM_SURVIVOR (1<<3)

/* Game modes for zp_round_started() */
enum
{
	MODE_INFECTION = 1,
	MODE_NEMESIS,
	MODE_SURVIVOR,
	MODE_SWARM,
	MODE_MULTI,
	MODE_PLAGUE
}

/* Winner teams for zp_round_ended() */
enum
{
	WIN_NO_ONE = 0,
	WIN_ZOMBIES,
	WIN_HUMANS
}

/* Custom forward return values */
#define ZP_PLUGIN_HANDLED 97

/**
 * Returns whether a player is a zombie.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_zombie(id)

/**
 * Returns whether a player is a nemesis.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_nemesis(id)

/**
 * Returns whether a player is a survivor.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_survivor(id)

/**
 * Returns whether a player is the first zombie.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_first_zombie(id)

/**
 * Returns whether a player is the last zombie.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_last_zombie(id)

/**
 * Returns whether a player is the last human.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_last_human(id)

/**
 * Returns a player's current zombie class ID.
 *
 * @param id		Player index.
 * @return		Internal zombie class ID, or -1 if not yet chosen.
 */
native zp_get_user_zombie_class(id)

/**
 * Returns a player's next zombie class ID (for the next infection).
 *
 * @param id		Player index.
 * @return		Internal zombie class ID, or -1 if not yet chosen.
 */
native zp_get_user_next_class(id)

/**
 * Sets a player's next zombie class ID (for the next infection).
 *
 * @param id		Player index.
 * @param classid	A valid zombie class ID.
 * @return		True on success, false otherwise.
 */
native zp_set_user_zombie_class(id, classid)

/**
 * Returns a player's ammo pack count.
 *
 * @param id		Player index.
 * @return		Number of ammo packs owned.
 */
native zp_get_user_ammo_packs(id)

/**
 * Sets a player's ammo pack count.
 *
 * @param id		Player index.
 * @param amount	New quantity of ammo packs owned.
 */
native zp_set_user_ammo_packs(id, amount)

/**
 * Returns the default maximum health of a zombie.
 *
 * Note: Takes into account first zombie's HP multiplier.
 *
 * @param id		Player index.
 * @return		Maximum amount of health points, or -1 if not a normal zombie.
 */
native zp_get_zombie_maxhealth(id)

/**
 * Returns a player's custom flashlight batteries charge.
 *
 * @param id		Player index.
 * @return		Charge percent (0 to 100).
 */
native zp_get_user_batteries(id)

/**
 * Sets a player's custom flashlight batteries charge.
 *
 * @param id		Player index.
 * @param value		New charge percent (0 to 100).
 */
native zp_set_user_batteries(id, charge)

/**
 * Returns whether a player has night vision.
 *
 * @param id		Player index.
 * @return		True if it has, false otherwise.
 */
native zp_get_user_nightvision(id)

/**
 * Sets whether a player has night vision.
 *
 * @param id		Player index.
 * @param set		True to give, false for removing it.
 */
native zp_set_user_nightvision(id, set)

/**
 * Forces a player to become a zombie.
 *
 * Note: Unavailable for last human/survivor.
 *
 * @param id		Player index to be infected.
 * @param infector	Player index who infected him (optional).
 * @param silent	If set, there will be no HUD messages or infection sounds.
 * @param rewards	Whether to show DeathMsg and reward frags, hp, and ammo packs to infector.
 * @return		True on success, false otherwise.
 */
native zp_infect_user(id, infector = 0, silent = 0, rewards = 0)

/**
 * Forces a player to become a human.
 *
 * Note: Unavailable for last zombie/nemesis.
 *
 * @param id		Player index to be cured.
 * @param silent	If set, there will be no HUD messages or antidote sounds.
 * @return		True on success, false otherwise.
 */
native zp_disinfect_user(id, silent = 0)

/**
 * Forces a player to become a nemesis.
 *
 * Note: Unavailable for last human/survivor.
 *
 * @param id		Player index to turn into nemesis.
 * @return		True on success, false otherwise.
 */
native zp_make_user_nemesis(id)

/**
 * Forces a player to become a survivor.
 *
 * Note: Unavailable for last zombie/nemesis.
 *
 * @param id		Player index to turn into survivor.
 * @return		True on success, false otherwise.
 */
native zp_make_user_survivor(id)

/**
 * Respawns a player into a specific team.
 *
 * @param id		Player index to be respawned.
 * @param team		Team to respawn the player into (ZP_TEAM_ZOMBIE or ZP_TEAM_HUMAN).
 * @return		True on success, false otherwise.
 */
native zp_respawn_user(id, team)

/**
 * Forces a player to buy an extra item.
 *
 * @param id		Player index.
 * @param itemid	A valid extra item ID.
 * @param ignorecost	If set, item's cost won't be deduced from player.
 * @return		True on success, false otherwise.
 */
native zp_force_buy_extra_item(id, itemid, ignorecost = 0)

/**
 * Returns whether the ZP round has started, i.e. first zombie
 * has been chosen or a game mode has begun.
 *
 * @return		0 - Round not started
 *			1 - Round started
 *			2 - Round starting
 */
native zp_has_round_started()

/**
 * Returns whether the current round is a nemesis round.
 *
 * @return		True if it is, false otherwise.
 */
native zp_is_nemesis_round()

/**
 * Returns whether the current round is a survivor round.
 *
 * @return		True if it is, false otherwise.
 */
native zp_is_survivor_round()

/**
 * Returns whether the current round is a swarm round.
 *
 * @return		True if it is, false otherwise.
 */
native zp_is_swarm_round()

/**
 * Returns whether the current round is a plague round.
 *
 * @return		True if it is, false otherwise.
 */
native zp_is_plague_round()

/**
 * Returns number of alive zombies.
 *
 * @return		Zombie count.
 */
native zp_get_zombie_count()

/**
 * Returns number of alive humans.
 *
 * @return		Human count.
 */
native zp_get_human_count()

/**
 * Returns number of alive nemesis.
 *
 * @return		Nemesis count.
 */
native zp_get_nemesis_count()

/**
 * Returns number of alive survivors.
 *
 * @return		Survivor count.
 */
native zp_get_survivor_count()

/**
 * Registers a custom item which will be added to the extra items menu of ZP.
 *
 * Note: The returned extra item ID can be later used to catch item
 * purchase events for the zp_extra_item_selected() forward.
 *
 * Note: ZP_TEAM_NEMESIS and ZP_TEAM_SURVIVOR can be used to make
 * an item available to Nemesis and Survivors respectively.
 *
 * @param name		Caption to display on the menu.
 * @param cost		Ammo packs to be deducted on purchase.
 * @param teams		Bitsum of teams it should be available for.
 * @return		An internal extra item ID, or -1 on failure.
 */
native zp_register_extra_item(const name[], cost, teams)

/**
 * Registers a custom class which will be added to the zombie classes menu of ZP.
 *
 * Note: The returned zombie class ID can be later used to identify
 * the class when calling the zp_get_user_zombie_class() natives.
 *
 * @param name		Caption to display on the menu.
 * @param info		Brief description of the class.
 * @param model		Player model to be used.
 * @param clawmodel	Claws model to be used.
 * @param hp		Initial health points.
 * @param speed		Maximum speed.
 * @param gravity	Gravity multiplier.
 * @param knockback	Knockback multiplier.
 * @return		An internal zombie class ID, or -1 on failure.
 */
native zp_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback)

/**
 * Returns an extra item's ID.
 *
 * @param name		Item name to look for.
 * @return		Internal extra item ID, or -1 if not found.
 */
native zp_get_extra_item_id(const name[])

/**
 * Returns a zombie class' ID.
 *
 * @param name		Class name to look for.
 * @return		Internal zombie class ID, or -1 if not found.
 */
native zp_get_zombie_class_id(const name[])

/**
 * Called when the ZP round starts, i.e. first zombie
 * is chosen or a game mode begins.
 *
 * @param gamemode	Mode which has started.
 * @param id		Affected player's index (if applicable).
 */
forward zp_round_started(gamemode, id)

/**
 * Called when the round ends.
 *
 * @param winteam	Team which has won the round.
 */
forward zp_round_ended(winteam)

/**
 * Called when a player gets infected.
 *
 * @param id		Player index who was infected.
 * @param infector	Player index who infected him (if applicable).
 * @param nemesis	Whether the player was turned into a nemesis.
 */
forward zp_user_infected_pre(id, infector, nemesis)
forward zp_user_infected_post(id, infector, nemesis)

/**
 * Called when a player turns back to human.
 *
 * @param id		Player index who was cured.
 * @param survivor	Whether the player was turned into a survivor.
 */
forward zp_user_humanized_pre(id, survivor)
forward zp_user_humanized_post(id, survivor)

/**
 * Called on a player infect/cure attempt. You can use this to block
 * an infection/humanization by returning ZP_PLUGIN_HANDLED in your plugin.
 *
 * Note: Right now this is only available after the ZP round starts, since some
 * situations (like blocking a first zombie's infection) are not yet handled.
 */
forward zp_user_infect_attempt(id, infector, nemesis)
forward zp_user_humanize_attempt(id, survivor)

/**
 * Called when a player buys an extra item from the ZP menu.
 *
 * Note: You can now return ZP_PLUGIN_HANDLED in your plugin to block
 * the purchase and the player will be automatically refunded.
 *
 * @param id		Player index of purchaser.
 * @param itemid	Internal extra item ID.
 */
forward zp_extra_item_selected(id, itemid)

/**
 * Called when a player gets unfrozen (frostnades).
 *
 * @param id		Player index.
 */
forward zp_user_unfrozen(id)

/**
 * Called when a player becomes the last zombie.
 *
 * Note: This is called for the first zombie too.
 *
 * @param id		Player index.
 */
forward zp_user_last_zombie(id)

/**
 * Called when a player becomes the last human.
 *
 * @param id		Player index.
 */
forward zp_user_last_human(id)


/**
 * @deprecated - Do not use!
 * For backwards compatibility only.
 */
#define ZP_TEAM_ANY 0
[/code]
Cosmin
Fost moderator
Fost moderator
Posts: 9362
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

23 Jul 2014, 01:15

| Afiseaza codul
/*================================================================================
	
	---------------------------------------
	-*- Zombie Plague 4.3 Includes File -*-
	---------------------------------------
	
	~~~~~~~~~~
	- How To -
	~~~~~~~~~~
	
	To make use of the Zombie Plague API features in your plugin, just
	add the following line at the beginning of your script:
	
	#include <zombieplague>
	
	~~~~~~~~~~~
	- Natives -
	~~~~~~~~~~~
	
	These work just like any other functions: you may have to pass
	parameters and they usually return values.
	
	Example:
	
	if ( is_user_alive( id ) && zp_get_user_zombie( id ) )
	{
		server_print( "Player %d is alive and a zombie", id )
	}
	
	~~~~~~~~~~~~
	- Forwards -
	~~~~~~~~~~~~
	
	Forwards get called whenever an event happens during the game.
	You need to make a public callback somewhere on your script,
	and it will automatically be triggered when the event occurs.
	
	Example:
	
	public zp_user_infected_post( id, infector, nemesis )
	{
		if ( !infector || nemesis )
			return;
		
		server_print( "Player %d just got infected by %d!", id, infector )
	}
	
	Also, take note of cases when there's a suffix:
	
	* _pre  : means the forward will be called BEFORE the event happens
	* _post : means it will be called AFTER the event takes place
	
=================================================================================*/

#if defined _zombieplague_included
  #endinput
#endif
#define _zombieplague_included

/* Teams for zp_register_extra_item() */
#define ZP_TEAM_ZOMBIE (1<<0)
#define ZP_TEAM_HUMAN (1<<1)
#define ZP_TEAM_NEMESIS (1<<2)
#define ZP_TEAM_SURVIVOR (1<<3)

/* Game modes for zp_round_started() */
enum
{
	MODE_INFECTION = 1,
	MODE_NEMESIS,
	MODE_SURVIVOR,
	MODE_SWARM,
	MODE_MULTI,
	MODE_PLAGUE
}

/* Winner teams for zp_round_ended() */
enum
{
	WIN_NO_ONE = 0,
	WIN_ZOMBIES,
	WIN_HUMANS
}

/* Custom forward return values */
#define ZP_PLUGIN_HANDLED 97

/**
 * Returns whether a player is a zombie.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_zombie(id)

/**
 * Returns whether a player is a nemesis.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_nemesis(id)

/**
 * Returns whether a player is a survivor.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_survivor(id)

/**
 * Returns whether a player is the first zombie.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_first_zombie(id)

/**
 * Returns whether a player is the last zombie.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_last_zombie(id)

/**
 * Returns whether a player is the last human.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native zp_get_user_last_human(id)

/**
 * Returns a player's current zombie class ID.
 *
 * @param id		Player index.
 * @return		Internal zombie class ID, or -1 if not yet chosen.
 */
native zp_get_user_zombie_class(id)

/**
 * Returns a player's next zombie class ID (for the next infection).
 *
 * @param id		Player index.
 * @return		Internal zombie class ID, or -1 if not yet chosen.
 */
native zp_get_user_next_class(id)

/**
 * Sets a player's next zombie class ID (for the next infection).
 *
 * @param id		Player index.
 * @param classid	A valid zombie class ID.
 * @return		True on success, false otherwise.
 */
native zp_set_user_zombie_class(id, classid)

/**
 * Returns a player's ammo pack count.
 *
 * @param id		Player index.
 * @return		Number of ammo packs owned.
 */
native zp_get_user_ammo_packs(id)

/**
 * Sets a player's ammo pack count.
 *
 * @param id		Player index.
 * @param amount	New quantity of ammo packs owned.
 */
native zp_set_user_ammo_packs(id, amount)

/**
 * Returns the default maximum health of a zombie.
 *
 * Note: Takes into account first zombie's HP multiplier.
 *
 * @param id		Player index.
 * @return		Maximum amount of health points, or -1 if not a normal zombie.
 */
native zp_get_zombie_maxhealth(id)

/**
 * Returns a player's custom flashlight batteries charge.
 *
 * @param id		Player index.
 * @return		Charge percent (0 to 100).
 */
native zp_get_user_batteries(id)

/**
 * Sets a player's custom flashlight batteries charge.
 *
 * @param id		Player index.
 * @param value		New charge percent (0 to 100).
 */
native zp_set_user_batteries(id, charge)

/**
 * Returns whether a player has night vision.
 *
 * @param id		Player index.
 * @return		True if it has, false otherwise.
 */
native zp_get_user_nightvision(id)

/**
 * Sets whether a player has night vision.
 *
 * @param id		Player index.
 * @param set		True to give, false for removing it.
 */
native zp_set_user_nightvision(id, set)

/**
 * Forces a player to become a zombie.
 *
 * Note: Unavailable for last human/survivor.
 *
 * @param id		Player index to be infected.
 * @param infector	Player index who infected him (optional).
 * @param silent	If set, there will be no HUD messages or infection sounds.
 * @param rewards	Whether to show DeathMsg and reward frags, hp, and ammo packs to infector.
 * @return		True on success, false otherwise.
 */
native zp_infect_user(id, infector = 0, silent = 0, rewards = 0)

/**
 * Forces a player to become a human.
 *
 * Note: Unavailable for last zombie/nemesis.
 *
 * @param id		Player index to be cured.
 * @param silent	If set, there will be no HUD messages or antidote sounds.
 * @return		True on success, false otherwise.
 */
native zp_disinfect_user(id, silent = 0)

/**
 * Forces a player to become a nemesis.
 *
 * Note: Unavailable for last human/survivor.
 *
 * @param id		Player index to turn into nemesis.
 * @return		True on success, false otherwise.
 */
native zp_make_user_nemesis(id)

/**
 * Forces a player to become a survivor.
 *
 * Note: Unavailable for last zombie/nemesis.
 *
 * @param id		Player index to turn into survivor.
 * @return		True on success, false otherwise.
 */
native zp_make_user_survivor(id)

/**
 * Respawns a player into a specific team.
 *
 * @param id		Player index to be respawned.
 * @param team		Team to respawn the player into (ZP_TEAM_ZOMBIE or ZP_TEAM_HUMAN).
 * @return		True on success, false otherwise.
 */
native zp_respawn_user(id, team)

/**
 * Forces a player to buy an extra item.
 *
 * @param id		Player index.
 * @param itemid	A valid extra item ID.
 * @param ignorecost	If set, item's cost won't be deduced from player.
 * @return		True on success, false otherwise.
 */
native zp_force_buy_extra_item(id, itemid, ignorecost = 0)

/**
 * Overrides ZP player model with a different custom model.
 *
 * Note: This will last until player's next infection/humanization/respawn.
 *
 * Note: Don't call more often than absolutely needed.
 *
 * @param id		Player index.
 * @param newmodel	Model name.
 * @param modelindex	Modelindex (optional).
 */
native zp_override_user_model(id, const newmodel[], modelindex = 0)

/**
 * Returns whether the ZP round has started, i.e. first zombie
 * has been chosen or a game mode has begun.
 *
 * @return		0 - Round not started
 *			1 - Round started
 *			2 - Round starting
 */
native zp_has_round_started()

/**
 * Returns whether the current round is a nemesis round.
 *
 * @return		True if it is, false otherwise.
 */
native zp_is_nemesis_round()

/**
 * Returns whether the current round is a survivor round.
 *
 * @return		True if it is, false otherwise.
 */
native zp_is_survivor_round()

/**
 * Returns whether the current round is a swarm round.
 *
 * @return		True if it is, false otherwise.
 */
native zp_is_swarm_round()

/**
 * Returns whether the current round is a plague round.
 *
 * @return		True if it is, false otherwise.
 */
native zp_is_plague_round()

/**
 * Returns number of alive zombies.
 *
 * @return		Zombie count.
 */
native zp_get_zombie_count()

/**
 * Returns number of alive humans.
 *
 * @return		Human count.
 */
native zp_get_human_count()

/**
 * Returns number of alive nemesis.
 *
 * @return		Nemesis count.
 */
native zp_get_nemesis_count()

/**
 * Returns number of alive survivors.
 *
 * @return		Survivor count.
 */
native zp_get_survivor_count()

/**
 * Registers a custom item which will be added to the extra items menu of ZP.
 *
 * Note: The returned extra item ID can be later used to catch item
 * purchase events for the zp_extra_item_selected() forward.
 *
 * Note: ZP_TEAM_NEMESIS and ZP_TEAM_SURVIVOR can be used to make
 * an item available to Nemesis and Survivors respectively.
 *
 * @param name		Caption to display on the menu.
 * @param cost		Ammo packs to be deducted on purchase.
 * @param teams		Bitsum of teams it should be available for.
 * @return		An internal extra item ID, or -1 on failure.
 */
native zp_register_extra_item(const name[], cost, teams)

/**
 * Registers a custom class which will be added to the zombie classes menu of ZP.
 *
 * Note: The returned zombie class ID can be later used to identify
 * the class when calling the zp_get_user_zombie_class() natives.
 *
 * @param name		Caption to display on the menu.
 * @param info		Brief description of the class.
 * @param model		Player model to be used.
 * @param clawmodel	Claws model to be used.
 * @param hp		Initial health points.
 * @param speed		Maximum speed.
 * @param gravity	Gravity multiplier.
 * @param knockback	Knockback multiplier.
 * @return		An internal zombie class ID, or -1 on failure.
 */
native zp_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback)

/**
 * Returns an extra item's ID.
 *
 * @param name		Item name to look for.
 * @return		Internal extra item ID, or -1 if not found.
 */
native zp_get_extra_item_id(const name[])

/**
 * Returns a zombie class' ID.
 *
 * @param name		Class name to look for.
 * @return		Internal zombie class ID, or -1 if not found.
 */
native zp_get_zombie_class_id(const name[])

/**
 * Returns a zombie class' description (passed by reference).
 *
 * @param classid		Internal zombie class ID.
 * @param info			The buffer to store the string in.
 * @param len			Character size of the output buffer.
 * @return			True on success, false otherwise.
 */
native zp_get_zombie_class_info(classid, info[], len)

/**
 * Called when the ZP round starts, i.e. first zombie
 * is chosen or a game mode begins.
 *
 * @param gamemode	Mode which has started.
 * @param id		Affected player's index (if applicable).
 */
forward zp_round_started(gamemode, id)

/**
 * Called when the round ends.
 *
 * @param winteam	Team which has won the round.
 */
forward zp_round_ended(winteam)

/**
 * Called when a player gets infected.
 *
 * @param id		Player index who was infected.
 * @param infector	Player index who infected him (if applicable).
 * @param nemesis	Whether the player was turned into a nemesis.
 */
forward zp_user_infected_pre(id, infector, nemesis)
forward zp_user_infected_post(id, infector, nemesis)

/**
 * Called when a player turns back to human.
 *
 * @param id		Player index who was cured.
 * @param survivor	Whether the player was turned into a survivor.
 */
forward zp_user_humanized_pre(id, survivor)
forward zp_user_humanized_post(id, survivor)

/**
 * Called on a player infect/cure attempt. You can use this to block
 * an infection/humanization by returning ZP_PLUGIN_HANDLED in your plugin.
 *
 * Note: Right now this is only available after the ZP round starts, since some
 * situations (like blocking a first zombie's infection) are not yet handled.
 */
forward zp_user_infect_attempt(id, infector, nemesis)
forward zp_user_humanize_attempt(id, survivor)

/**
 * Called when a player buys an extra item from the ZP menu.
 *
 * Note: You can now return ZP_PLUGIN_HANDLED in your plugin to block
 * the purchase and the player will be automatically refunded.
 *
 * @param id		Player index of purchaser.
 * @param itemid	Internal extra item ID.
 */
forward zp_extra_item_selected(id, itemid)

/**
 * Called when a player gets unfrozen (frostnades).
 *
 * @param id		Player index.
 */
forward zp_user_unfrozen(id)

/**
 * Called when a player becomes the last zombie.
 *
 * Note: This is called for the first zombie too.
 *
 * @param id		Player index.
 */
forward zp_user_last_zombie(id)

/**
 * Called when a player becomes the last human.
 *
 * @param id		Player index.
 */
forward zp_user_last_human(id)


/**
 * @deprecated - Do not use!
 * For backwards compatibility only.
 */
#define ZP_TEAM_ANY 0
#define ZP_TEAM_NO_ONE 0
ia-l pe asta.
User avatar
alynut
Administrator
Administrator
Posts: 7121
Joined: 02 Jul 2012, 06:31
Detinator Steam: Da
CS Status: In concediu, activez mai rar .
SteamID: alynut991
Reputatie: Fost Administrator
Fost Intermediar
Location: Bucuresti
Has thanked: 183 times
Been thanked: 443 times

23 Jul 2014, 01:20

Nu imi merge nici cu asta . :|
Image
Cosmin
Fost moderator
Fost moderator
Posts: 9362
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

23 Jul 2014, 01:27

pune astea in scripting include,iti trebuiesc fisiere .inc

http://www.girlshare.ro/33792393.8
User avatar
alynut
Administrator
Administrator
Posts: 7121
Joined: 02 Jul 2012, 06:31
Detinator Steam: Da
CS Status: In concediu, activez mai rar .
SteamID: alynut991
Reputatie: Fost Administrator
Fost Intermediar
Location: Bucuresti
Has thanked: 183 times
Been thanked: 443 times

23 Jul 2014, 01:29

Mersi a mers .
Acum sa testez pluginu.

Nu merge am putut cumpara de 3 ori knife blink si de fiecare data imi da 10 blink-uri ...
Cosmin
Fost moderator
Fost moderator
Posts: 9362
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

23 Jul 2014, 01:53

Cum adica nu merge ? pai 10 blinkuri e setat de aici din cate vad.
| Afiseaza codul
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <colorchat>
#include <chr_engine>

// HUD messages
const Float:HUD_EVENT_X = -1.0
const Float:HUD_EVENT_Y = 0.17
const Float:HUD_INFECT_X = 0.05
const Float:HUD_INFECT_Y = 0.45
const Float:HUD_SPECT_X = -1.0
const Float:HUD_SPECT_Y = 0.8
const Float:HUD_STATS_X = 0.02
const Float:HUD_STATS_Y = 0.9

#pragma tabsize 0

#define MIN_DISTANCE 50
#define MAX_ROUND	10	//de aici modifici de cate ori sa foloseasca pe runda.

new const g_item_name[] = { "Knife Blink" }
const g_item_cost = 20
const g_iMaxDistance = 400;

new Float:g_fSpeed = 1000.0;
new Float:g_fDelay = 1.0;

new g_iMaxPlayers;
new g_iEnemy[33];
new g_iInBlink[33];
new Float:g_fLastSlash[33];
new g_iCanceled[33];
new g_iSlash[33];
new g_iBlinks[33];
new g_itemid_blink;

new Limita[33]

public plugin_init(){
   
   register_plugin("[ZP] Extra Item: Knife Blink", "1.3", "ExtreamCS");
   
   g_iMaxPlayers = get_maxplayers();
   
   g_itemid_blink = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE);
   
   register_forward(FM_TraceLine, "FW_TraceLine_Post", 5);
   register_forward(FM_PlayerPreThink, "FW_PlayerPreThink");
   
   register_event("HLTV", "EVENT_round_start", "a", "1=0", "2=0")
}

public FW_TraceLine_Post(Float:start[3], Float:end[3], conditions, id, trace){
   
   if (!CHECK_ValidPlayer(id))
      return FMRES_IGNORED;
   
   new iWeaponID = get_user_weapon(id);
   
   if ( iWeaponID != CSW_KNIFE ){
      
      OP_Cancel(id);
      return FMRES_IGNORED;
   }
   
   new enemy = g_iEnemy[id];
   
   if (!enemy){
      
      enemy = get_tr2(trace, TR_pHit);
      
      if ( !CHECK_ValidPlayer(enemy) || zp_get_user_zombie(enemy) ){
         
         OP_Cancel(id);
         return FMRES_IGNORED;
      }
      
      g_iEnemy[id] = enemy;
   }
   
   return FMRES_IGNORED;
}

public FW_PlayerPreThink(id){
   
   if (!CHECK_ValidPlayer(id))
      return FMRES_IGNORED;
   
   new iWeaponID = get_user_weapon(id);
   
   if ( iWeaponID != CSW_KNIFE || !zp_get_user_zombie(id) ){
      
      OP_Cancel(id);
      return FMRES_IGNORED;
   }
   
   if ( g_iBlinks[id] == 0 )
      return FMRES_IGNORED;
   
   new button = pev(id,pev_button);
   
   if ( !(button & IN_ATTACK) && !(button & IN_ATTACK2) ){
      
      OP_Cancel(id)
      return FMRES_IGNORED;
   }
   
   if (g_iSlash[id])
      g_iSlash[id] = 0;
   
   OP_NearEnemy(id);
   
   if( g_iInBlink[id] ){
      
      OP_SetBlink(id);
      OP_Blink(id);
      g_iCanceled[id] = 0;
   }

   return FMRES_IGNORED;
}

// Player buys our upgrade, add one blink
public zp_extra_item_selected(player, itemid)
{
	if(Limita[player] == MAX_ROUND)
	{
		ColorChat(player, NORMAL, "^x04[Zm.LegendCS.Com]Nu poti folosii de mai mult de %i ori pe runda acest item.", MAX_ROUND)	//aici iti pui tu mesajul cum vrei
		return
	}
   if (itemid == g_itemid_blink){
      new name[32]
      get_user_name(player, name, 31)
	Limita[player]++;
      g_iBlinks[player] += 10;

         set_hudmessage(255, 0, 0, HUD_SPECT_X, HUD_SPECT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
         show_hudmessage(0, "%s bought a Knife Blinks!!", name)
      ColorChat(player, NORMAL, "^x04[Zm.LegendCS.Com]^x01 You have now [^x04%d^x01] Knife ^x04Blinks^x01", g_iBlinks[player]);
   }
}

// Reset blinks for all players on newround
public EVENT_round_start()
{
   for (new id; id <= 32; id++) {
		g_iBlinks[id] = 0;
		Limita[id] = 0
	}
}
public client_disconnect(id)	Limita[id] = 0

public OP_NearEnemy(id){
   
   new enemy = g_iEnemy[id];
   new Float:time = get_gametime();
   
   if (!enemy || g_fLastSlash[id]+g_fDelay>time){
      
      g_iInBlink[id] = 0;
      return;
   }
   
   new origin[3], origin_enemy[3];
   
   get_user_origin(id, origin, 0);
   get_user_origin(enemy, origin_enemy, 0);
   
   new distance = get_distance(origin, origin_enemy);
   
   if ( MIN_DISTANCE<=distance<=g_iMaxDistance){
      
      g_iInBlink[id] = 1;
      return;
      
   }else if (MIN_DISTANCE>distance && g_iInBlink[id])
   {
      OP_Slash(id);
   }
   OP_Cancel(id);
}

public OP_Blink(id){
   
   new Float:new_velocity[3];
   new enemy = g_iEnemy[id];
   new Float:origin_enemy[3];
   
   pev(enemy, pev_origin, origin_enemy);
   entity_set_aim(id, origin_enemy);
   
   get_speed_vector2(id, enemy, g_fSpeed, new_velocity)
   set_pev(id, pev_velocity, new_velocity);
}

public OP_Cancel(id){
   
   g_iInBlink[id] = 0;
   g_iEnemy[id] = 0;
   if (!g_iCanceled[id]){
      
      OP_SetBlink(id);
      g_iCanceled[id] = 1;
   }
}

public OP_Slash(id){
   
   set_pev(id, pev_velocity, {0.0,0.0,0.0});      // stop player's blink
   
   new weaponID = get_user_weapon(id, _, _);
   
   if(weaponID == CSW_KNIFE){
      
      new weapon[32]
      
      get_weaponname(weaponID,weapon,31)
      
      new ent = fm_find_ent_by_owner(-1,weapon,id)
      
      if(ent){
         
         set_pdata_float(ent,46, 0.0);
         set_pdata_float(ent,47, 0.0);
         g_iSlash[id] = 5;
         g_fLastSlash[id] = get_gametime();
         g_iBlinks[id] -= 1;
         new name[32];
         get_user_name(id,name,31)
         ColorChat(0, GREY, "^x04[Zm.LegendCS.Com]^x01 ^x03%s^x01 just used a ^x04Knife Blink!^x01 [ ^x04%d^x01 remaining ] ", name, g_iBlinks[id]);
      }
   }  
}

public OP_SetBlink(id){
   
   new blink = g_iInBlink[id];
   
   if (blink>1)
      return;
   
   if (blink)
      g_iInBlink[id] += 1;
}

public CHECK_ValidPlayer(id){
   
   if (1<=id<=g_iMaxPlayers && is_user_alive(id))
      return 1;
   
   return 0;
}

// from fakemeta_util.inc
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
   new strtype[11] = "classname", ent = index;
   switch (jghgtype) {
      case 1: strtype = "target";
      case 2: strtype = "targetname";
   }

   while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}

   return ent;
}

public OP_Slash1(id){
  ColorChat(0, GREY, "This plugin created R@yy@N")
}
User avatar
alynut
Administrator
Administrator
Posts: 7121
Joined: 02 Jul 2012, 06:31
Detinator Steam: Da
CS Status: In concediu, activez mai rar .
SteamID: alynut991
Reputatie: Fost Administrator
Fost Intermediar
Location: Bucuresti
Has thanked: 183 times
Been thanked: 443 times

23 Jul 2014, 02:07

Da se de exemplu daca esti zombi poti cumpara de cate ori vrei tu knife blind si la fiecare cumparare ai 10 blink-uri .
Cosmin
Fost moderator
Fost moderator
Posts: 9362
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

23 Jul 2014, 02:15

revin maine si ti-l fac daca reusesc,acum o sa ies ca e tarziu...
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests