<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; JScript: редактирование плагина (amxx для CS 1.6)]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=5930</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5930&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «JScript: редактирование плагина (amxx для CS 1.6)».]]></description>
		<lastBuildDate>Thu, 23 Jun 2011 09:54:04 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: JScript: редактирование плагина (amxx для CS 1.6)]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=49343#p49343</link>
			<description><![CDATA[<p><span style="color: Green"><strong>Mr_Death</strong>, ссылки на форуме оформляются <a href="http://forum.script-coding.com/help.php#bbcode">тэгом «url»</a>. Поправьте.</span></p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Thu, 23 Jun 2011 09:54:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=49343#p49343</guid>
		</item>
		<item>
			<title><![CDATA[Re: JScript: редактирование плагина (amxx для CS 1.6)]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=49341#p49341</link>
			<description><![CDATA[<p>это не относиться к данной ветке форума !!!</p><p>Это написанно на Pawn&#039;е и тебе сюда <br /><a href="http://c-s.net.ua/forum/forum102.html">http://c-s.net.ua/forum/forum102.html</a><br />или сюда<br /><a href="http://amx-x.ru">http://amx-x.ru</a></p>]]></description>
			<author><![CDATA[null@example.com (Mr_Death)]]></author>
			<pubDate>Thu, 23 Jun 2011 08:16:25 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=49341#p49341</guid>
		</item>
		<item>
			<title><![CDATA[JScript: редактирование плагина (amxx для CS 1.6)]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=49313#p49313</link>
			<description><![CDATA[<p>здравствуйте! Я думаю что это яваскрипт - ну если это не так то простите - я не знаю его - по этому я думаю что это на него похоже)))<br />у меня возникла такая проблема с одним плагином<br />вот его исходники на всякий пожарный<br /></p><div class="quotebox"><blockquote><div class="codebox"><pre><code>#include &lt;amxmodx&gt;
#include &lt;amxmisc&gt;
#include &lt;fakemeta&gt;

#define MAX_SOUNDS	50
#define MAX_p_MODELS	50
#define MAX_v_MODELS	50
#define MAX_w_MODELS	50

#define MAP_CONFIGS	1

new new_sounds[MAX_SOUNDS][48]
new old_sounds[MAX_SOUNDS][48]
new sounds_team[MAX_SOUNDS]
new soundsnum

new new_p_models[MAX_p_MODELS][48]
new old_p_models[MAX_p_MODELS][48]
new p_models_team[MAX_p_MODELS]
new p_modelsnum

new new_v_models[MAX_v_MODELS][48]
new old_v_models[MAX_v_MODELS][48]
new v_models_team[MAX_p_MODELS]
new v_modelsnum

new new_w_models[MAX_w_MODELS][48]
new old_w_models[MAX_w_MODELS][48]
new w_models_team[MAX_p_MODELS]
new w_modelsnum

new maxplayers

public plugin_init()
{
	register_plugin(&quot;Weapon Model + Sound Replacement&quot;,&quot;1.2&quot;,&quot;GHW_Chronic&quot;)
	register_forward(FM_EmitSound,&quot;Sound_Hook&quot;)
	register_forward(FM_SetModel,&quot;W_Model_Hook&quot;,1)
	register_logevent(&quot;newround&quot;,2,&quot;1=Round_Start&quot;)
	register_event(&quot;CurWeapon&quot;,&quot;Changeweapon_Hook&quot;,&quot;be&quot;,&quot;1=1&quot;)
	maxplayers = get_maxplayers()
}

public plugin_precache()
{
	new configfile[200]
	new configsdir[200]
	new map[32]
	get_configsdir(configsdir,199)
	get_mapname(map,31)
	format(configfile,199,&quot;%s/new_weapons_%s.ini&quot;,configsdir,map)
	if(file_exists(configfile))
	{
		load_models(configfile)
	}
	else
	{
		format(configfile,199,&quot;%s/new_weapons.ini&quot;,configsdir)
		load_models(configfile)
	}
}

public load_models(configfile[])
{
	if(file_exists(configfile))
	{
		new read[96], left[48], right[48], right2[32], trash, team
		for(new i=0;i&lt;file_size(configfile,1);i++)
		{
			read_file(configfile,i,read,95,trash)
			if(containi(read,&quot;;&quot;)!=0 &amp;&amp; containi(read,&quot; &quot;)!=-1)
			{
				strbreak(read,left,47,right,47)
				team=0
				if(containi(right,&quot; &quot;)!=-1)
				{
					strbreak(right,right,47,right2,31)
					replace_all(right2,31,&quot;^&quot;&quot;,&quot;&quot;)
					if(
					equali(right2,&quot;T&quot;) ||
					equali(right2,&quot;Terrorist&quot;) ||
					equali(right2,&quot;Terrorists&quot;) ||
					equali(right2,&quot;Blue&quot;) ||
					equali(right2,&quot;B&quot;) ||
					equali(right2,&quot;Allies&quot;) ||
					equali(right2,&quot;1&quot;)
					) team=1
					else if(
					equali(right2,&quot;CT&quot;) ||
					equali(right2,&quot;Counter&quot;) ||
					equali(right2,&quot;Counter-Terrorist&quot;) ||
					equali(right2,&quot;Counter-Terrorists&quot;) ||
					equali(right2,&quot;CounterTerrorists&quot;) ||
					equali(right2,&quot;CounterTerrorist&quot;) ||
					equali(right2,&quot;Red&quot;) ||
					equali(right2,&quot;R&quot;) ||
					equali(right2,&quot;Axis&quot;) ||
					equali(right2,&quot;2&quot;)
					) team=2
					else if(
					equali(right2,&quot;Yellow&quot;) ||
					equali(right2,&quot;Y&quot;) ||
					equali(right2,&quot;3&quot;)
					) team=3
					else if(
					equali(right2,&quot;Green&quot;) ||
					equali(right2,&quot;G&quot;) ||
					equali(right2,&quot;4&quot;)
					) team=4
				}
				replace_all(right,47,&quot;^&quot;&quot;,&quot;&quot;)
				if(file_exists(right))
				{
					if(containi(right,&quot;.mdl&quot;)==strlen(right)-4)
					{
						if(!precache_model(right))
						{
							log_amx(&quot;Error attempting to precache model: ^&quot;%s^&quot; (Line %d of new_weapons.ini)&quot;,right,i+1)
						}
						else if(containi(left,&quot;models/p_&quot;)==0)
						{
							format(new_p_models[p_modelsnum],47,right)
							format(old_p_models[p_modelsnum],47,left)
							p_models_team[p_modelsnum]=team
							p_modelsnum++
						}
						else if(containi(left,&quot;models/v_&quot;)==0)
						{
							format(new_v_models[v_modelsnum],47,right)
							format(old_v_models[v_modelsnum],47,left)
							v_models_team[v_modelsnum]=team
							v_modelsnum++
						}
						else if(containi(left,&quot;models/w_&quot;)==0)
						{
							format(new_w_models[w_modelsnum],47,right)
							format(old_w_models[w_modelsnum],47,left)
							w_models_team[w_modelsnum]=team
							w_modelsnum++
						}
						else
						{
							log_amx(&quot;Model type(p_ / v_ / w_) unknown for model: ^&quot;%s^&quot; (Line %d of new_weapons.ini)&quot;,right,i+1)
						}
					}
					else if(containi(right,&quot;.wav&quot;)==strlen(right)-4 || containi(right,&quot;.mp3&quot;)==strlen(right)-4)
					{
						replace(right,47,&quot;sound/&quot;,&quot;&quot;)
						replace(left,47,&quot;sound/&quot;,&quot;&quot;)
						if(!precache_sound(right))
						{
							log_amx(&quot;Error attempting to precache sound: ^&quot;%s^&quot; (Line %d of new_weapons.ini)&quot;,right,i+1)
						}
						else
						{
							format(new_sounds[soundsnum],47,right)
							format(old_sounds[soundsnum],47,left)
							sounds_team[soundsnum]=team
							soundsnum++
						}
					}
					else
					{
						log_amx(&quot;Invalid File: ^&quot;%s^&quot; (Line %d of new_weapons.ini)&quot;,right,i+1)
					}
				}
				else
				{
					log_amx(&quot;File Inexistent: ^&quot;%s^&quot; (Line %d of new_weapons.ini)&quot;,right,i+1)
				}
				if(!file_exists(left))
				{
					log_amx(&quot;Warning: File Inexistent: ^&quot;%s^&quot; (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!&quot;,left,i+1)
				}
			}
		}
	}
}

public Changeweapon_Hook(id)
{
	if(!is_user_alive(id))
	{
		return PLUGIN_CONTINUE
	}
	static model[32], i, team

	team = get_user_team(id)

	pev(id,pev_viewmodel2,model,31)
	for(i=0;i&lt;v_modelsnum;i++)
	{
		if(equali(model,old_v_models[i]))
		{
			if(v_models_team[i]==team || !v_models_team[i])
			{
				set_pev(id,pev_viewmodel2,new_v_models[i])
				break;
			}
		}
	}

	pev(id,pev_weaponmodel2,model,31)
	for(i=0;i&lt;p_modelsnum;i++)
	{
		if(equali(model,old_p_models[i]))
		{
			if(p_models_team[i]==team || !p_models_team[i])
			{
				set_pev(id,pev_weaponmodel2,new_p_models[i])
				break;
			}
		}
	}
	return PLUGIN_CONTINUE
}

public Sound_Hook(id,channel,sample[])
{
	if(!is_user_alive(id))
	{
		return FMRES_IGNORED
	}
	if(channel!=CHAN_WEAPON &amp;&amp; channel!=CHAN_ITEM)
	{
		return FMRES_IGNORED
	}

	static i, team

	team = get_user_team(id)

	for(i=0;i&lt;soundsnum;i++)
	{
		if(equali(sample,old_sounds[i]))
		{
			if(sounds_team[i]==team || !sounds_team[i])
			{
				engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
				return FMRES_SUPERCEDE
			}
		}
	}
	return FMRES_IGNORED
}

public W_Model_Hook(ent,model[])
{
	if(!pev_valid(ent))
	{
		return FMRES_IGNORED
	}
	static i
	for(i=0;i&lt;w_modelsnum;i++)
	{
		if(equali(model,old_w_models[i]))
		{
			engfunc(EngFunc_SetModel,ent,new_w_models[i])
			return FMRES_SUPERCEDE
		}
	}
	return FMRES_IGNORED
}

public newround()
{
	static ent, classname[8], model[32]
	ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
	while(ent)
	{
		pev(ent,pev_classname,classname,7)
		if(containi(classname,&quot;armoury&quot;)!=-1)
		{
			pev(ent,pev_model,model,31)
			W_Model_Hook(ent,model)
		}
		ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
	}
}</code></pre></div></blockquote></div><p>Так сервер выдает ошибку - <span style="color: blue">Model type(p_ / v_ / w_) unknown for model: &quot;+KSS+/models/shield/v_deagle.mdl&quot;</span> (mdl это модель оружия)(Запись в New_weapon.ini - &quot;models/shield/v_shield_deagle.mdl&quot; &quot;+KSS+/models/shield/v_deagle.mdl&quot;)- хотя с моделью v_sg552.mdl (и еще с 26 моделями тоже) (до 50 не добралось) все впорядке запись в нев веапон &quot;models/v_sg552.mdl&quot; &quot;+KSS+/models/vModels/v_sg552.mdl&quot;</p><p>ладно подумал я не беда есть еще один плагин - он мою Мп5 заменяет на двойные мп5 может с ним получится, думал открыть исходники и всего лишь отредактировать в двух местах так не правильно я думал. Помогите пожалуста мне с этим плагином: мне ндо v_*** (w_***/p_***) заменить на v_*** (w_***/ p_***) буду очень благодарен. Вот исходники того плагина того что заменяет мп5 на дуал мп5:</p><div class="quotebox"><blockquote><div class="codebox"><pre><code>
/*##########################################################################
##
## -- www.SteamTools.net
##     _____   _   _       ___   _           ___  ___   _____   _____
##    |  _  \ | | | |     /   | | |         /   |/   | |  _  \ |  ___| 
##    | | | | | | | |    / /| | | |        / /|   /| | | |_| | | |___  
##    | | | | | | | |   / / | | | |       / / |__/ | | |  ___/ \___  \ 
##    | |_| | | |_| |  / /  | | | |___   / /       | | | |      ___| | 
##    |_____/ \_____/ /_/   |_| |_____| /_/        |_| |_|     \_____|
##                                                        
##          |__                   |__  o _|_   ___   __ __  o |__,  ___  
##      --  |__) (__|     (__(__( |  ) |  |_, (__/_ |  )  ) | |  \ (__/_ 
##                  |                                                    
##
##   Replaces your standard MP5 with this DualMP5 model. There&#039;s no
## difference in performance (damage, bullets, etc.) unless you set
## the CVARs accordingly. By default you do NOT start with DualMP5,
## and you do NOT have unlimited ammo.
##
##   A sample configuration is below, feel free to contact me
## via PM or email (mellis@traxio.net) if you have any questions
## or comments.
##
##   Enjoy!
##
##
## INSTALLATION
##------------------------------------------------------------------------
## 1) Unzip (which you may have done already)
## 2) Place &#039;amx_dualmp5.amxx&#039; in &#039;cstrike/addons/amxmodx/plugins&#039;
## 3) Add a line in &#039;configs/plugins.ini&#039; containing &#039;amx_dualmp5.amxx&#039;
## 4) Put &#039;SteamTools_Net_DualMP5.mdl&#039; in &#039;cstrike/models&#039; folder
## 5) Open &#039;cstrike/server.cfg&#039; and add the cvars listed below
## 6) -- Visit www.SteamTools.net, and enjoy your new plugin!
##
##
## SAMPLE CONFIGURATION
##------------------------------------------------------------------------
##
## amx_dualmp5_startwith 1
## amx_dualmp5_startmsg_on 2
## amx_dualmp5_startmsg_msg &quot;These do 2x damage, and you have unlim. ammo!&quot;
## amx_dualmp5_unlimitedammo 1
##
## -- This config will:
##     - Give all players DualMP5&#039;s each round
##     - Show the start message only when you start with mp5 (until startwith = 0)
##     - Allow users to continuously fire with no reloads.
##
##
## THE CVARs
##------------------------------------------------------------------------
##
## amx_dualmp5_startwith
##   - Start with mp5
##     + Default is 0
##
## amx_dualmp5_startmsg_on
##   - You can choose to show a start message.
##     0 = OFF
##     1 = ON
##     2 = ON - Only shows when amx_dualmp5_startwith = 1
##     + Default is 2
##
## amx_dualmp5_startmsg_msg
##   - Message to show when startmsg_on is enabled.
##     + Default is &quot;These do 2x normal damage, enjoy!&quot;
##
## amx_dualmp5_unlimitedammo
##   - Dual MP5s have unlimited ammo
##     + Default is FALSE
##
##
##########################################################################*/


#include &lt;amxmodx&gt;
#include &lt;engine&gt;
#include &lt;fun&gt;

new MP5_MODEL_NAME[64] = &quot;models/SteamTools_net_DualMP5.mdl&quot;

public plugin_init(){
	register_plugin(&quot;SteamTools.net Dual MP5s&quot;,&quot;0.1&quot;,&quot;SteamTools.net&quot;)
	// Register my plugin, lots of thanks to RadidEskimo &amp; Freecode

	register_cvar(&quot;amx_dualmp5_startwith&quot;, &quot;0&quot;)
	// Start with mp5? Default is FALSE

	register_cvar(&quot;amx_dualmp5_startmsg_on&quot;, &quot;2&quot;)
	// You can choose to show a start message.
	// 0 = OFF
	// 1 = ON
	// 2 = ON - Only when amx_dualmp5_startwith = 1
	// Default is 2

	register_cvar(&quot;amx_dualmp5_startmsg_msg&quot;, &quot;These do 2x normal damage, enjoy!&quot;)
	// Message to show when startmsg_on is enabled.

	register_cvar(&quot;amx_dualmp5_unlimitedammo&quot;, &quot;0&quot;)
	// Dual MP5s have unlimited ammo? Default is FALSE

	register_cvar(&quot;amx_dualmp5_doubledamage&quot;, &quot;0&quot;)
	// Dual MP5s do DOUBLE damage? Default is FALSE

	register_event(&quot;ResetHUD&quot;,&quot;newRound&quot;,&quot;b&quot;)
	// Call newRound() when the round is over

	register_event(&quot;WeapPickup&quot;,&quot;checkModel&quot;,&quot;b&quot;,&quot;1=19&quot;)
	// When a weapon is picked up (or bought) call checkModel()

	register_event(&quot;CurWeapon&quot;,&quot;checkWeapon&quot;,&quot;be&quot;,&quot;1=1&quot;)
	// Call checkWeapon() when shots are fired

	if(get_cvar_num(&quot;amx_dualmp5_doubledamage&quot;) == 1) {
		register_event(&quot;Damage&quot;, &quot;doDamage&quot;, &quot;b&quot;, &quot;2!0&quot;)
		// When somebody has damage done to them, call doDamage (so we can multiply 2x)
	}
}

public newRound(id){
	if(get_cvar_num(&quot;amx_dualmp5_startwith&quot;) == 1){
		give_item(id,&quot;weapon_mp5navy&quot;)
		give_item(id,&quot;ammo_9mm&quot;)
	}
    //
    // Basically, if you set &quot;amx_dualmp5_startwith&quot; to 1..
    // every new round the user will get an MP5
    //
    // The ResetHUD event calls newRound(id) for every user when
    // the new round begins.. so it will loop this for all users in game
    //
}

public client_putinserver(id){
	new msgStr[100],msgNum,startWith
	get_cvar_string(&quot;amx_dualmp5_startmsg_msg&quot;, msgStr, 99)
	msgNum = get_cvar_num(&quot;amx_dualmp5_startmsg_on&quot;)
	startWith = get_cvar_num(&quot;amx_dualmp5_startwith&quot;)

	if(msgNum == 2 &amp;&amp; startWith == 1) {
		client_print(id, print_chat, &quot;[AMXX] Dual MP5 Mod: %s&quot;, msgStr)
	}

	if(msgNum == 1) {
		client_print(id, print_chat, &quot;[AMXX] Dual MP5 Mod: %s&quot;, msgStr)
	}

	//
	// If they do start with MP5&#039;s, and there is a msg, show the info message
	//
}

public plugin_precache(){
	precache_model(MP5_MODEL_NAME)
	return PLUGIN_CONTINUE
	//
	// Just precache the model, so if the user does not have it, they have to download
	//
}

public checkModel(id){ 
	if (!is_user_alive(id)){
		return PLUGIN_CONTINUE
	}
	// If the user that picked up the weapon is alive..

	entity_set_string(id, EV_SZ_viewmodel, MP5_MODEL_NAME)
	// Find and change the user&#039;s MP5 to OUR custom model (MP5_MODEL_NAME)..
    
	new iCurrent
	iCurrent = find_ent_by_class(-1,&quot;weapon_mp5navy&quot;)

	while(iCurrent != 0) {
		iCurrent = find_ent_by_class(iCurrent,&quot;weapon_mp5navy&quot;)
	}

	return PLUGIN_HANDLED
} 

public checkWeapon(id){ 
	new plrClip, plrAmmo, plrWeap[32]
	new plrWeapId

	plrWeapId = get_user_weapon(id, plrClip, plrAmmo)
	// Define certain variables needed in this function, get the
	// current ID of the weapon the user picked up

	if (plrWeapId == CSW_MP5NAVY){
		checkModel(id)
		// If the user picked up an MP5 then change the model to OUR model..
	}
	else {
	    // Otherwise just leave this function
		return PLUGIN_CONTINUE
	}

	if (plrClip == 0){
		if(get_cvar_num(&quot;amx_dualmp5_unlimitedammo&quot;) == 1) {
			// ^ If the user is out of ammo..
			get_weaponname(plrWeapId, plrWeap, 31)
			// Get the name of their weapon (MP5, duh!)
			give_item(id, plrWeap)
			// Give them another MP5 (ammo)
			engclient_cmd(id, plrWeap) 
			engclient_cmd(id, plrWeap)
			engclient_cmd(id, plrWeap)
			// Sending multiple times may help
		}
	}

	return PLUGIN_CONTINUE 
} 

public doDamage(id){
	new plrDmg = read_data(2)
	new plrWeap
	new plrPartHit
	new plrAttacker = get_user_attacker(id, plrWeap, plrPartHit)
	new plrHealth = get_user_health(id)
	new plrNewDmg

	//
	// plrDmg is set to how much damage was done to the victim
	// plrHealth is set to how much health the victim has
	// plrAttacker is set to the id of the person doing the shooting
	//
	// Could have put the above on one line, didn&#039;t for learning purposes (nubs may read this!) lol
	// Example: new plrWeap, plrPartHit, plrAttacker = get_user_attacker( .. etc etc
	//

	if (plrWeap != CSW_MP5NAVY){
	    // If the damage was not done with an MP5, just exit function..
		return PLUGIN_CONTINUE
	}

	if (is_user_alive(id)){
	    // If the victim is still alive.. (should be)
		plrNewDmg = (plrHealth - plrDmg)
		//
		// Make the new damage their current health - plrDmg..
		// This is actually damage 2x, becuase when they did the damage
		// lets say it was 10, now this is subtracting 10 from current heatlh
		// doing 20, so thats 2 times =D
		//
		if(plrNewDmg &lt; 1){
			// If the new damage will kill the player..

			set_msg_block(get_user_msgid(&quot;DeathMsg&quot;),BLOCK_ONCE);
			// Block one the death messages to prevent &#039;suicide&#039;

			message_begin(MSG_ALL, get_user_msgid(&quot;DeathMsg&quot;), {0,0,0}, 0)
			// Start a death message, so it doesnt just say &quot;Player Died&quot;,
			// the killer will get the credit
			
			write_byte(plrAttacker)
			// Write KILLER ID
			
			write_byte(id)
			// Write VICTIM ID
            
			write_byte(random_num(0,1))
			// Write HEAD SHOT or not
			// I made this random because I was unsure of how to detect
			// if plrPartHit was &quot;head&quot; or not.. someone help..
			
			write_string(&quot;mp5navy&quot;)
			// Write the weapon VICTIM ID was killed with..
			
			message_end()
			// End the message..
		}
		set_user_health(id, plrNewDmg)
		// Then set the health, even if it will kill the player
	}
	return PLUGIN_CONTINUE
}</code></pre></div></blockquote></div><p>Если вы будете пользоваться исходниками рядом с тем где надо изменить напишите пожалусто в скобках что там было, ну например: return PLUGIN_CONTINUE вы заменили на return PLUGIN_PRIVET а в скобках напишите PLUGIN_CONTINUE.<br />Спасибо что потратили время</p>]]></description>
			<author><![CDATA[null@example.com (Куприян)]]></author>
			<pubDate>Wed, 22 Jun 2011 14:24:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=49313#p49313</guid>
		</item>
	</channel>
</rss>
