Modificare plugin /knife

Tutoriale scripting, cod si portiuni de cod.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
died1337
Membru, skill 0
Membru, skill 0
Posts: 13
Joined: 16 Jan 2020, 06:11
Detinator Steam: Da
CS Status: eXtreamCS FTW!!
Fond eXtream: 0
Has thanked: 7 times

06 Feb 2020, 23:38

Salut baieti! Am o rugaminte.. poate sa imi modifice cineva acest plugin? M-a ajutat L E V I N (si ii multumesc mult)
Are o problema.. se pune gravitatia si pe pistol.. asta e singura problema.. poate rezolva cineva asta, va rog?

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	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_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	knife_model[id] = key
	SaveData(id)
	
	if ( get_user_weapon(id) != CSW_KNIFE )
	{
		if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
		engclient_cmd(id,"weapon_knife")
	}
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public CurWeapon(id)
{
	if(!is_user_alive(id))	return
	new Weapon = read_data(2)
	if(Weapon != CSW_KNIFE)	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	new Float:Gravity = ((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	new Float:Speed=((knife_model[id] == 4)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
eXtreamSHOP
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2730
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 418 times
Contact:

07 Feb 2020, 22:00

nu are cum să nu meargă, în genu ăsta am și eu de ani de zile

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	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_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	knife_model[id] = key
	SaveData(id)
	
	if ( get_user_weapon(id) != CSW_KNIFE )
	{
		if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
		engclient_cmd(id,"weapon_knife")
	}
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public CurWeapon(id)
{
	if(!is_user_alive(id))	return
	new Weapon = read_data(2)
	if(Weapon != CSW_KNIFE)	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	new Float:Gravity = (((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)&&Weapon==CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	new Float:Speed=((knife_model[id] == 4&&Weapon==CSW_KNIFE)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
User avatar
died1337
Membru, skill 0
Membru, skill 0
Posts: 13
Joined: 16 Jan 2020, 06:11
Detinator Steam: Da
CS Status: eXtreamCS FTW!!
Fond eXtream: 0
Has thanked: 7 times

08 Feb 2020, 18:14

L E V I N wrote:
07 Feb 2020, 22:00
nu are cum să nu meargă, în genu ăsta am și eu de ani de zile

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	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_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	knife_model[id] = key
	SaveData(id)
	
	if ( get_user_weapon(id) != CSW_KNIFE )
	{
		if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
		engclient_cmd(id,"weapon_knife")
	}
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public CurWeapon(id)
{
	if(!is_user_alive(id))	return
	new Weapon = read_data(2)
	if(Weapon != CSW_KNIFE)	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	new Float:Gravity = (((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)&&Weapon==CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	new Float:Speed=((knife_model[id] == 4&&Weapon==CSW_KNIFE)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
Salut! Am incercat si cu ce mi-ai trimis acum si este exact lafel.. daca vrei poti intra pe server sa vezi si tu..
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2730
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 418 times
Contact:

08 Feb 2020, 21:10

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	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_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	if ( get_user_weapon(id) != CSW_KNIFE )	if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
	engclient_cmd(id,"weapon_knife")
	knife_model[id] = key
	SaveData(id)
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public CurWeapon(id)
{
	if(!is_user_alive(id))	return
	new Weapon = read_data(2)
	if(Weapon != CSW_KNIFE)	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	new Float:Gravity = ((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	new Float:Speed=((knife_model[id] == 4)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
User avatar
died1337
Membru, skill 0
Membru, skill 0
Posts: 13
Joined: 16 Jan 2020, 06:11
Detinator Steam: Da
CS Status: eXtreamCS FTW!!
Fond eXtream: 0
Has thanked: 7 times

09 Feb 2020, 03:08

L E V I N wrote:
08 Feb 2020, 21:10

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	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_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	if ( get_user_weapon(id) != CSW_KNIFE )	if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
	engclient_cmd(id,"weapon_knife")
	knife_model[id] = key
	SaveData(id)
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public CurWeapon(id)
{
	if(!is_user_alive(id))	return
	new Weapon = read_data(2)
	if(Weapon != CSW_KNIFE)	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	new Float:Gravity = ((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	new Float:Speed=((knife_model[id] == 4)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
Jur pe Jules Verne ca si acum e ca inainte.. gravitatie pe usp :dismayed_smiley:
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2730
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 418 times
Contact:

09 Feb 2020, 22:23

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "fw_Item_Deploy_Post", 1)
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	
	register_clcmd("say /knife", "display_knife")
	
	CVAR_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	knife_model[id] = key
	SaveData(id)
	
	if ( get_user_weapon(id) != CSW_KNIFE )
	{
		if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
		engclient_cmd(id,"weapon_knife")
	}
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public fw_Item_Deploy_Post(Ent)
{
	if(is_valid_ent(Ent) != 2)	return
	static id; id = get_pdata_cbase(Ent, 41, 4)
	if(get_pdata_cbase(id, 373) != Ent)	return//get_pdata_int(ent, 43, 4)
	if(!is_user_alive(id))	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	static Float:Gravity = ((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	static Float:Speed=((knife_model[id] == 4)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
User avatar
died1337
Membru, skill 0
Membru, skill 0
Posts: 13
Joined: 16 Jan 2020, 06:11
Detinator Steam: Da
CS Status: eXtreamCS FTW!!
Fond eXtream: 0
Has thanked: 7 times

10 Feb 2020, 04:39

L E V I N wrote:
09 Feb 2020, 22:23

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "fw_Item_Deploy_Post", 1)
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	
	register_clcmd("say /knife", "display_knife")
	
	CVAR_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	knife_model[id] = key
	SaveData(id)
	
	if ( get_user_weapon(id) != CSW_KNIFE )
	{
		if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
		engclient_cmd(id,"weapon_knife")
	}
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public fw_Item_Deploy_Post(Ent)
{
	if(is_valid_ent(Ent) != 2)	return
	static id; id = get_pdata_cbase(Ent, 41, 4)
	if(get_pdata_cbase(id, 373) != Ent)	return//get_pdata_int(ent, 43, 4)
	if(!is_user_alive(id))	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	static Float:Gravity = ((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	static Float:Speed=((knife_model[id] == 4)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
Image
Multumesc din suflet ca ma ajuti!!!!
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2730
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 418 times
Contact:

10 Feb 2020, 16:10

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "fw_Item_Deploy_Post", 1)
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	
	register_clcmd("say /knife", "display_knife")
	
	CVAR_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	knife_model[id] = key
	SaveData(id)
	
	if ( get_user_weapon(id) != CSW_KNIFE )
	{
		if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
		engclient_cmd(id,"weapon_knife")
	}
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public fw_Item_Deploy_Post(Ent)
{
	if(is_valid_ent(Ent) != 2)	return
	static id; id = get_pdata_cbase(Ent, 41, 4)
	if(get_pdata_cbase(id, 373) != Ent)	return//get_pdata_int(ent, 43, 4)
	if(!is_user_alive(id))	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	// Gravity
	new Float:Gravity = ((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	new Float:Speed=((knife_model[id] == 4)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
User avatar
died1337
Membru, skill 0
Membru, skill 0
Posts: 13
Joined: 16 Jan 2020, 06:11
Detinator Steam: Da
CS Status: eXtreamCS FTW!!
Fond eXtream: 0
Has thanked: 7 times

11 Feb 2020, 00:59

L E V I N wrote:
10 Feb 2020, 16:10

Code: Select all

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

#define PLUGIN "Knife Mod"
#define VERSION "1.0" 
#define AUTHOR "spunko"

new knife_model[33] 
new g_Menu

new CVAR_HIGHSPEED
new CVAR_NORMSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV

#define NTF		"a"
#define NTRF(%1)	(get_user_flags(%1)&read_flags(NTF))
#define NFOF		"e"
#define NFORF(%1)	(get_user_flags(%1)&read_flags(NFOF))
#define NFIF		"l"
#define NFIRF(%1)	(get_user_flags(%1)&read_flags(NFIF))

enum _:KM
{
	VM[32],
	PM[32]
}
new const KMS[][KM]=
{
	{"models/v_knife.mdl","models/p_knife.mdl"},//toate sunt in ordine ca-n meniu, aici ai modelu pentru 1 cutit din meniu, cel pro, daca nu ai un model cu p_ lasi gol la el adica ""
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"},
	
	{"models/v_knife.mdl","models/p_knife.mdl"}
}

public plugin_init() { 
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "fw_Item_Deploy_Post", 1)
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	
	register_clcmd("say /knife", "display_knife")
	
	CVAR_HIGHSPEED = register_cvar("km_highspeed","600.0")
	CVAR_NORMSPEED = register_cvar("km_normspeed","250.0")
	CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400.0")
	CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
	
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	for(new evo; evo < sizeof(KMS); evo++)
	{
		precache_model(KMS[evo][VM])
		if(strlen(KMS[evo][PM]))	precache_model(KMS[evo][PM])
	}
}

public kmodmsg()	client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")

public client_authorized(id)	LoadData(id)

public display_knife(id) {
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	
	add(menuBody, 511, "1. PRO Knife (Default knife, fara nimic special)\w^n")
	add(menuBody, 511, "2. Butcher (Low Gravity, 400)\w^n")
	
	if(NTRF(id))	add(menuBody, 511, "3. VIP Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r3. VIP Knife (Low Gravity, 400)\w^n")
	if(NFORF(id))	add(menuBody, 511, "4. STAFF Knife (Low Gravity, 400)\w^n")
	else	add(menuBody, 511, "\r4. STAFF Knife (Low Gravity, 400)\w^n")
	if(NFIRF(id))	add(menuBody, 511, "5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	else	add(menuBody, 511, "\r5. 1337's Knife (Low Gravity 400, Speed 600)\w^n^n")
	
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
}
public knifemenu(id, key) {
	if(key<0||key==9)	return
	if(key==2&&!NTRF(id))	return
	if(key==3&&!NFORF(id))	return
	if(key==4&&!NFIRF(id))	return
	
	knife_model[id] = key
	SaveData(id)
	
	if ( get_user_weapon(id) != CSW_KNIFE )
	{
		if(!user_has_weapon(id,CSW_KNIFE))	give_item(id,"weapon_knife")
		engclient_cmd(id,"weapon_knife")
	}
	entity_set_string(id, EV_SZ_viewmodel, KMS[key][VM])
	if(strlen(KMS[key][PM]))	entity_set_string(id, EV_SZ_weaponmodel, KMS[key][PM])
} 

public fw_Item_Deploy_Post(Ent)
{
	if(is_valid_ent(Ent) != 2)	return
	static id; id = get_pdata_cbase(Ent, 41, 4)
	if(get_pdata_cbase(id, 373) != Ent)	return//get_pdata_int(ent, 43, 4)
	if(!is_user_alive(id))	return
	
	// Set Knife Model
	knifemenu(id, knife_model[id])
	
	// Gravity
	new Float:Gravity = ((knife_model[id] == 1||knife_model[id] == 2||knife_model[id] == 3||knife_model[id] == 4)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0//ssss
	set_user_gravity(id , Gravity)
	
	// Speed
	new Float:Speed=((knife_model[id] == 4)?get_pcvar_float(CVAR_HIGHSPEED):get_pcvar_float(CVAR_NORMSPEED))
	set_user_maxspeed(id, Speed)
}

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 }
*/
Salut! :face_unequal_eyes: Acum cand selectez cutitul se schimba skin-ul dar abilitatile nu se aplica. Daca schimb pe pistol si inapoi pe cutit, revine la skin-ul default, fara abilitati.
:fist_pointing_right: :fist_pointing_left:
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2730
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 38 times
Been thanked: 418 times
Contact:

11 Feb 2020, 23:35

nu are cum,ai ceva la server, la mine pe sv merge...sau ai ceva ce l blochează
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
Post Reply

Return to “Scripting”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests