Editare KnifeMod

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
DeViLllll
Membru, skill 0
Membru, skill 0
Posts: 19
Joined: 13 Sep 2020, 11:30
Detinator Steam: Nu
CS Status: Hlewllel
Fond eXtream: 0
Has thanked: 4 times

16 Oct 2020, 15:02

Salut, imi poate edita cineva acest plugin -> Image
Sa fie asa -- Image

Sma

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <engine> 
#include <vault>
#include <fun>

#define TASK_INTERVAL 4.0  
#define MAX_HEALTH 255  

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_LOWSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV
new CVAR_HEALTH_ADD
new CVAR_HEALTH_MAX
new CVAR_DAMAGE 

public plugin_init() { 
	
	register_event( "Damage", "event_damage", "be" )
	register_event("CurWeapon","CurWeapon","be","1=1") 
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	
	register_clcmd("say /knife", "display_knife")
	
	CVAR_HEALTH_ADD = register_cvar("km_addhealth", "3")
	CVAR_HEALTH_MAX = register_cvar("km_maxhealth", "75")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
		
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	precache_model("models/vbutcher.mdl") 

	precache_model("models/v_knife.mdl") 

} 

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\w[1] \Gravity Knife \y[Gravitatie]\w^n")
	add(menuBody, 511, "\w[2] \rPro Jumpers \y[Default]\w^n^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")

	return PLUGIN_HANDLED
}

public knifemenu(id, key) {
	switch(key) 
	{
		case 0: SetKnife(id , 1)
		case 1: SetKnife(id , 0)
		default: return PLUGIN_HANDLED
	}
	SaveData(id)
	return PLUGIN_HANDLED
} 

public SetKnife(id , Knife) {
	knife_model[id] = Knife
	
	new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo) 
	if ( Weapon != CSW_KNIFE )
		return PLUGIN_HANDLED
	
	new vModel[56],pModel[56]
	
	switch(Knife)
	{
		case 0: {
			format(vModel,55,"models/v_knife.mdl")

		}
		case 1: {
			format(vModel,55,"models/vbutcher.mdl")

		}
	} 
	
	entity_set_string(id, EV_SZ_viewmodel, vModel)
	entity_set_string(id, EV_SZ_weaponmodel, pModel)
	
	return PLUGIN_HANDLED;  
}

public event_damage( id ) {
	
	new victim_id = id;
	if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
	new dmg_take = read_data( 2 );
	new dmgtype = read_data( 3 );
	new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
	new Float:damage = dmg_take * multiplier;
	new health = get_user_health( victim_id );
	
	new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );
	
	if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
		return PLUGIN_HANDLED
	}
	
	if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {
		
		if( floatround(damage) >= health ) {
			if( victim_id == attacker_id ) {
				return PLUGIN_CONTINUE
				}else{
				log_kill( attacker_id, victim_id, "knife", 0 );
			}
			
			return PLUGIN_CONTINUE
			}else {
			if( victim_id == attacker_id ) return PLUGIN_CONTINUE
			
			fakedamage( victim_id, "weapon_knife", damage, dmgtype );
		}
	}
	return PLUGIN_CONTINUE
}

public CurWeapon(id)
	{
	new Weapon = read_data(2)
	
	// Set Knife Model
	SetKnife(id, knife_model[id])   
	
	// Task Options
	
	if(knife_model[id] == 0 && !task_exists(id) && Weapon == CSW_KNIFE)
		set_task(TASK_INTERVAL , "task_healing",id,_,_,"b")
	else if(task_exists(id))
		remove_task(id)
	
	// Abilities
	set_user_footsteps(id , ( (knife_model[id] == 2 && Weapon == CSW_KNIFE) ? 1 : 0) )
	
	new Float:Gravity = ((knife_model[id] == 1 && Weapon == CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0
	set_user_gravity(id , Gravity)
	
	// Speed
	new Float:Speed
	if(Weapon != CSW_KNIFE || knife_model[id] < 3)
		return PLUGIN_CONTINUE
	else if(knife_model[id] == 3)
		Speed = get_pcvar_float(CVAR_HIGHSPEED)
	else if(knife_model[id] == 4)
		Speed = get_pcvar_float(CVAR_LOWSPEED)
	
	set_user_maxspeed(id, Speed)
	
	return PLUGIN_HANDLED   
	
}

stock log_kill(killer, victim, weapon[],headshot) {
	user_silentkill( victim );
	
	message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
	write_byte( killer );
	write_byte( victim );
	write_byte( headshot );
	write_string( weapon );
	message_end();
	
	new kfrags = get_user_frags( killer );
	set_user_frags( killer, kfrags++ );
	new vfrags = get_user_frags( victim );
	set_user_frags( victim, vfrags++ );
	
	return  PLUGIN_CONTINUE
} 


public task_healing(id) {  
	new addhealth = get_pcvar_num(CVAR_HEALTH_ADD)  
	if (!addhealth)
		return  
	
	new maxhealth = get_pcvar_num(CVAR_HEALTH_MAX)  
	if (maxhealth > MAX_HEALTH) { 
		set_pcvar_num(CVAR_HEALTH_MAX, MAX_HEALTH)  
		maxhealth = MAX_HEALTH 
	}  
	
	new health = get_user_health(id)   
	
	if (is_user_alive(id) && (health < maxhealth)) { 
		set_user_health(id, health + addhealth)
		set_hudmessage(0, 255, 0, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.1, 4)
		show_hudmessage(id,"<< !!HEAL IN PROGRESS!! >>")
		message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
		write_short(1<<10)
		write_short(1<<10)
		write_short(0x0000)
		write_byte(0)
		write_byte(200)
		write_byte(0)
		write_byte(75)
		message_end()
	}
	
	else {
		if (is_user_alive(id) && (health > maxhealth))
			remove_task(id)
	}
}  

public client_disconnect(id) {  
	if(task_exists(id)) remove_task(id)  
}  


public kmodmsg() { 
	
	client_print(0,print_chat,"[ Knife ] Tastati /knife in chat pentru schimbarea cutitului")
}  

public client_authorized(id)
	{
	LoadData(id)
}

SaveData(id)
{ 
	
	new authid[32]
	get_user_authid(id, authid, 31)
	
	new vaultkey[64]
	new vaultdata[64]
	
	format(vaultkey, 63, "KMOD_%s", authid)
	format(vaultdata, 63, "%d", knife_model[id])
	set_vaultdata(vaultkey, vaultdata)
}

LoadData(id) 
{ 
	new authid[32] 
	get_user_authid(id,authid,31)
	
	new vaultkey[64], vaultdata[64]
	
	format(vaultkey, 63, "KMOD_%s", authid)
	get_vaultdata(vaultkey, vaultdata, 63)
	knife_model[id] = str_to_num(vaultdata)
	
} 
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Si de fiecare data cand intra un player pe server sa-i apara in chat -> "---- >[ Knife ] <---- Tastati /knife in chat pentru schimbarea cutitului"
si [0] Exit.
User avatar
Laurentiu P.
Fost moderator
Fost moderator
Posts: 2409
Joined: 10 Jul 2013, 20:26
Detinator Steam: Da
Reputatie: Fost super moderator
Fond eXtream: 100
Has thanked: 16 times
Been thanked: 40 times
Contact:

16 Oct 2020, 19:46

Compileaza-l local ...
no...
User avatar
DeViLllll
Membru, skill 0
Membru, skill 0
Posts: 19
Joined: 13 Sep 2020, 11:30
Detinator Steam: Nu
CS Status: Hlewllel
Fond eXtream: 0
Has thanked: 4 times

16 Oct 2020, 20:13

Laurentiu P. wrote:
16 Oct 2020, 19:46
Compileaza-l local ...
Cum adica local? si tot nu are "Knife Mod" deasupra si Exit?? de aia l-am postat sa mi l refaca cineva ca in poza a doua
User avatar
King Innsane
Membru, skill 0
Membru, skill 0
Posts: 16
Joined: 30 Mar 2019, 15:34
Detinator Steam: Da
Detinator server CS: 193.203.39.156:27015
Fond eXtream: 0
Been thanked: 1 time

17 Oct 2020, 09:58

Code: Select all

public display_knife(id) {
	
	new menuBody[ 512 ], KNF[ 215 ];
	
	formatex( KNF, charsmax( KNF ), "\rKnife Mod \wRomania^n" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	formatex( KNF, charsmax( KNF ), "^n\w[1] \yGravity Knife \r(Gravitatie)" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	formatex( KNF, charsmax( KNF ), "^n\w[2] \yDefault Knife \r(Pro Jumpers)" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	add( menuBody, charsmax( menuBody ), "^n^n\w[0] \yExit" )
	
	
	new keys = ( 1<<0 | 1<<1 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")

	return PLUGIN_HANDLED
}
"Am făcut lucruri pe care acum le regret. Dar dacă nu învăţ din greşeli o să le repet."
User avatar
DeViLllll
Membru, skill 0
Membru, skill 0
Posts: 19
Joined: 13 Sep 2020, 11:30
Detinator Steam: Nu
CS Status: Hlewllel
Fond eXtream: 0
Has thanked: 4 times

17 Oct 2020, 10:30

King Innsane wrote:
17 Oct 2020, 09:58

Code: Select all

public display_knife(id) {
	
	new menuBody[ 512 ], KNF[ 215 ];
	
	formatex( KNF, charsmax( KNF ), "\rKnife Mod \wRomania^n" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	formatex( KNF, charsmax( KNF ), "^n\w[1] \yGravity Knife \r(Gravitatie)" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	formatex( KNF, charsmax( KNF ), "^n\w[2] \yDefault Knife \r(Pro Jumpers)" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	add( menuBody, charsmax( menuBody ), "^n^n\w[0] \yExit" )
	
	
	new keys = ( 1<<0 | 1<<1 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")

	return PLUGIN_HANDLED
}
Image tot la fel
User avatar
King Innsane
Membru, skill 0
Membru, skill 0
Posts: 16
Joined: 30 Mar 2019, 15:34
Detinator Steam: Da
Detinator server CS: 193.203.39.156:27015
Fond eXtream: 0
Been thanked: 1 time

17 Oct 2020, 10:34

DeViLllll wrote:
17 Oct 2020, 10:30
King Innsane wrote:
17 Oct 2020, 09:58

Code: Select all

public display_knife(id) {
	
	new menuBody[ 512 ], KNF[ 215 ];
	
	formatex( KNF, charsmax( KNF ), "\rKnife Mod \wRomania^n" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	formatex( KNF, charsmax( KNF ), "^n\w[1] \yGravity Knife \r(Gravitatie)" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	formatex( KNF, charsmax( KNF ), "^n\w[2] \yDefault Knife \r(Pro Jumpers)" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	add( menuBody, charsmax( menuBody ), "^n^n\w[0] \yExit" )
	
	
	new keys = ( 1<<0 | 1<<1 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")

	return PLUGIN_HANDLED
}
Image tot la fel
e de la tine, nu ti se pune \ pentru color, ex \r , \y , \w
"Am făcut lucruri pe care acum le regret. Dar dacă nu învăţ din greşeli o să le repet."
User avatar
DeViLllll
Membru, skill 0
Membru, skill 0
Posts: 19
Joined: 13 Sep 2020, 11:30
Detinator Steam: Nu
CS Status: Hlewllel
Fond eXtream: 0
Has thanked: 4 times

17 Oct 2020, 10:35

King Innsane wrote:
17 Oct 2020, 10:34
DeViLllll wrote:
17 Oct 2020, 10:30
King Innsane wrote:
17 Oct 2020, 09:58

Code: Select all

public display_knife(id) {
	
	new menuBody[ 512 ], KNF[ 215 ];
	
	formatex( KNF, charsmax( KNF ), "\rKnife Mod \wRomania^n" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	formatex( KNF, charsmax( KNF ), "^n\w[1] \yGravity Knife \r(Gravitatie)" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	formatex( KNF, charsmax( KNF ), "^n\w[2] \yDefault Knife \r(Pro Jumpers)" )
	add( menuBody, charsmax( menuBody ), KNF )
	
	add( menuBody, charsmax( menuBody ), "^n^n\w[0] \yExit" )
	
	
	new keys = ( 1<<0 | 1<<1 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")

	return PLUGIN_HANDLED
}
Image tot la fel
e de la tine, nu ti se pune \ pentru color, ex \r , \y , \w
Si cum rezolv problema?
User avatar
DeViLllll
Membru, skill 0
Membru, skill 0
Posts: 19
Joined: 13 Sep 2020, 11:30
Detinator Steam: Nu
CS Status: Hlewllel
Fond eXtream: 0
Has thanked: 4 times

17 Oct 2020, 11:24

Am reusit sa-l compilez cu ajutorul lui @King Innsane
ps. il poate edita cineva sa-mi apara unpic mai jos o reclama [dupa [0] Exit]

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <vault>
#include <fun>

#define TASK_INTERVAL 4.0
#define MAX_HEALTH 255

new knife_model[33]
new g_Menu

new CVAR_HIGHSPEED
new CVAR_LOWSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV
new CVAR_HEALTH_ADD
new CVAR_HEALTH_MAX
new CVAR_DAMAGE

public plugin_init() {

register_event( "Damage", "event_damage", "be" )
register_event("CurWeapon","CurWeapon","be","1=1")

g_Menu = register_menuid("Knife Mod")
register_menucmd(g_Menu, 1023, "knifemenu")

register_clcmd("say /knife", "display_knife")

CVAR_HEALTH_ADD = register_cvar("km_addhealth", "3")
CVAR_HEALTH_MAX = register_cvar("km_maxhealth", "75")
CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400")
CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")

set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() {
precache_model("models/vbutcher.mdl")

precache_model("models/v_knife.mdl")

}

public display_knife(id) {

new menuBody[ 512 ], KNF[ 215 ];

formatex( KNF, charsmax( KNF ), "\rKnife Mod \wMenu^n" )
add( menuBody, charsmax( menuBody ), KNF )

formatex( KNF, charsmax( KNF ), "^n\w[1] \yGravity Knife \r(Gravitatie)" )
add( menuBody, charsmax( menuBody ), KNF )

formatex( KNF, charsmax( KNF ), "^n\w[2] \yDefault Knife \r(Default)" )
add( menuBody, charsmax( menuBody ), KNF )

add( menuBody, charsmax( menuBody ), "^n^n\w[0] \yExit" )


new keys = ( 1<<0 | 1<<1 | 1<<9 )
show_menu(id, keys, menuBody, -1, "Knife Mod")

return PLUGIN_HANDLED
}

public knifemenu(id, key) {
switch(key)
{
case 0: SetKnife(id , 1)
case 1: SetKnife(id , 0)
default: return PLUGIN_HANDLED
}
SaveData(id)
return PLUGIN_HANDLED
}

public SetKnife(id , Knife) {
knife_model[id] = Knife

new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
if ( Weapon != CSW_KNIFE )
return PLUGIN_HANDLED

new vModel[56],pModel[56]

switch(Knife)
{
case 0: {
format(vModel,55,"models/v_knife.mdl")

}
case 1: {
format(vModel,55,"models/vbutcher.mdl")

}
}

entity_set_string(id, EV_SZ_viewmodel, vModel)
entity_set_string(id, EV_SZ_weaponmodel, pModel)

return PLUGIN_HANDLED;
}

public event_damage( id ) {

new victim_id = id;
if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
new dmg_take = read_data( 2 );
new dmgtype = read_data( 3 );
new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
new Float:damage = dmg_take * multiplier;
new health = get_user_health( victim_id );

new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );

if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
return PLUGIN_HANDLED
}

if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {

if( floatround(damage) >= health ) {
if( victim_id == attacker_id ) {
return PLUGIN_CONTINUE
}else{
log_kill( attacker_id, victim_id, "knife", 0 );
}

return PLUGIN_CONTINUE
}else {
if( victim_id == attacker_id ) return PLUGIN_CONTINUE

fakedamage( victim_id, "weapon_knife", damage, dmgtype );
}
}
return PLUGIN_CONTINUE
}

public CurWeapon(id)
{
new Weapon = read_data(2)

// Set Knife Model
SetKnife(id, knife_model[id])

// Task Options

if(knife_model[id] == 0 && !task_exists(id) && Weapon == CSW_KNIFE)
set_task(TASK_INTERVAL , "task_healing",id,_,_,"b")
else if(task_exists(id))
remove_task(id)

// Abilities
set_user_footsteps(id , ( (knife_model[id] == 2 && Weapon == CSW_KNIFE) ? 1 : 0) )

new Float:Gravity = ((knife_model[id] == 1 && Weapon == CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0
set_user_gravity(id , Gravity)

// Speed
new Float:Speed
if(Weapon != CSW_KNIFE || knife_model[id] < 3)
return PLUGIN_CONTINUE
else if(knife_model[id] == 3)
Speed = get_pcvar_float(CVAR_HIGHSPEED)
else if(knife_model[id] == 4)
Speed = get_pcvar_float(CVAR_LOWSPEED)

set_user_maxspeed(id, Speed)

return PLUGIN_HANDLED

}

stock log_kill(killer, victim, weapon[],headshot) {
user_silentkill( victim );

message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
write_byte( killer );
write_byte( victim );
write_byte( headshot );
write_string( weapon );
message_end();

new kfrags = get_user_frags( killer );
set_user_frags( killer, kfrags++ );
new vfrags = get_user_frags( victim );
set_user_frags( victim, vfrags++ );

return PLUGIN_CONTINUE
}


public task_healing(id) {
new addhealth = get_pcvar_num(CVAR_HEALTH_ADD)
if (!addhealth)
return

new maxhealth = get_pcvar_num(CVAR_HEALTH_MAX)
if (maxhealth > MAX_HEALTH) {
set_pcvar_num(CVAR_HEALTH_MAX, MAX_HEALTH)
maxhealth = MAX_HEALTH
}

new health = get_user_health(id)

if (is_user_alive(id) && (health < maxhealth)) {
set_user_health(id, health + addhealth)
set_hudmessage(0, 255, 0, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"<< !!HEAL IN PROGRESS!! >>")
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(200)
write_byte(0)
write_byte(75)
message_end()
}

else {
if (is_user_alive(id) && (health > maxhealth))
remove_task(id)
}
}

public client_disconnect(id) {
if(task_exists(id)) remove_task(id)
}


public kmodmsg() {

client_print(0,print_chat,"[ Knife ] Tastati /knife in chat pentru schimbarea cutitului")
}

public client_authorized(id)
{
LoadData(id)
}

SaveData(id)
{

new authid[32]
get_user_authid(id, authid, 31)

new vaultkey[64]
new vaultdata[64]

format(vaultkey, 63, "KMOD_%s", authid)
format(vaultdata, 63, "%d", knife_model[id])
set_vaultdata(vaultkey, vaultdata)
}

LoadData(id)
{
new authid[32]
get_user_authid(id,authid,31)

new vaultkey[64], vaultdata[64]

format(vaultkey, 63, "KMOD_%s", authid)
get_vaultdata(vaultkey, vaultdata, 63)
knife_model[id] = str_to_num(vaultdata)

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

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests