[rezolvat]Plugin menu

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
User avatar
aNNNdReY
Membru, skill +1
Membru, skill +1
Posts: 410
Joined: 07 Sep 2012, 23:45
Detinator Steam: Da
SteamID: ravyvevo
Has thanked: 65 times
Been thanked: 18 times

25 Nov 2013, 23:13

Cum pot face in acest meniu doar echipa ct sa aiba acces la el?
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <vault>
#include <fun>
#include <fakemeta>

#define PLUGIN "Knife Mod+"
#define VERSION "1.0"
#define AUTHOR ""
#define MAXPLAYERS 32

#define m_pLastItem 375
#define m_pLastKnifeItem 370


new knife_model[33] 
new g_Menu

public plugin_init() { 
	
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	register_event("CurWeapon","EventCurWeapon","be","1=1") 
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	register_clcmd("say /knife", "display_knife")
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	precache_model("models/snowball/knife/lopata.mdl") 
	precache_model("models/snowball/knife/p_knife.mdl") 
	precache_model("models/snowball/knife/ceapa.mdl")
	precache_model("models/snowball/knife/p_knife.mdl")
	precache_model("models/snowball/knife/kungfu.mdl")
	precache_model("models/snowball/knife/p_knife.mdl")
	precache_model("models/snowball/knife/v_starwars.mdl")
	precache_model("models/snowball/knife/p_starwars.mdl")
	precache_model("models/v_knife.mdl") 
	precache_model("models/p_knife.mdl")
	precache_model("models/snowball/knife/v_knife.mdl")
} 

public display_knife(id) {
	// Codes makes it so only the dead can pick a knife.
	if (is_user_alive(id) == 0){
		console_print(id, "You are not allowed to select knives while alive")
		client_print(id, print_chat, "You are not allowed to select knives while alive")
		return PLUGIN_CONTINUE
	}
	else 
		console_print(id, "You are not allowed to select knives while alive")
	client_print(id, print_chat, "You are not allowed to select knives while alive")
	
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	add(menuBody, 511, "1. Star-Wars \y(Cutit-NEON)\w^n")
	add(menuBody, 511, "2. Ceapa \y(Vegetarianu')\w^n")
	add(menuBody, 511, "3. Kung-Fu \y(Bruce-Lee)\w^n")
	add(menuBody, 511, "4. Lopata \y(Profilul taran-agresiv ACTIVATED)\w^n")
	add(menuBody, 511, "5. Cutit Normal \y(Cutitul default)\w^n")
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
	
	return PLUGIN_HANDLED
}
public knifemenu(id, key) {
	switch(key) 
	{
			case 0: SetKnife(id , 4)
			case 1: SetKnife(id , 2)
			case 2: SetKnife(id , 3)
			case 3: SetKnife(id , 1)
			case 4: SetKnife(id , 0)
			case 5: SetKnife(id , 5)
			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")
			format(pModel,55,"models/p_knife.mdl")
		}
		case 1: {
			format(vModel,55,"models/snowball/knife/lopata.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 2: {
			format(vModel,55,"models/snowball/knife/ceapa.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 3: {
			format(vModel,55,"models/snowball/knife/kungfu.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 4: {
			format(vModel,55,"models/snowball/knife/v_starwars.mdl")
			format(pModel,55,"models/snowball/knife/p_starwars.mdl")
		}
		case 5: {
			format(vModel,55,"models/snowball/knife/v_knife.mdl")
		} 
	}
	
	entity_set_string(id, EV_SZ_viewmodel, vModel)
	entity_set_string(id, EV_SZ_weaponmodel, pModel)
	
	return PLUGIN_HANDLED;  
}


public EventCurWeapon(id)
{
	new Weapon = read_data(2)
	
	// Set Knife Model
	SetKnife(id, knife_model[id])   
}	

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 client_disconnect(id) {  
if(task_exists(id)) remove_task(id)  
}  

public kmodmsg() 
{ 
  ColorChat(0,GREEN,"^x01[^x04 HNS^x01 ]^x03 Scrie in chat^x04 /knife^x03 pentru a-ti schimba skin-ul cutitului^x01 !")
}  

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)
Last edited by aNNNdReY on 27 Nov 2013, 16:26, edited 1 time in total.
Rapidserver
User avatar
aNNNdReY
Membru, skill +1
Membru, skill +1
Posts: 410
Joined: 07 Sep 2012, 23:45
Detinator Steam: Da
SteamID: ravyvevo
Has thanked: 65 times
Been thanked: 18 times

26 Nov 2013, 23:58

nimeni?
User avatar
FaTzZu
Fost moderator
Fost moderator
Posts: 1206
Joined: 22 Dec 2012, 18:37
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 114 times
Been thanked: 168 times
Contact:

27 Nov 2013, 09:27

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <vault>
#include <fun>
#include <fakemeta>

#define PLUGIN "Knife Mod+"
#define VERSION "1.0"
#define AUTHOR ""
#define MAXPLAYERS 32

#define m_pLastItem 375
#define m_pLastKnifeItem 370


new knife_model[33] 
new g_Menu

public plugin_init() { 
	
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	register_event("CurWeapon","EventCurWeapon","be","1=1") 
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	register_clcmd("say /knife", "display_knife")
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	precache_model("models/snowball/knife/lopata.mdl") 
	precache_model("models/snowball/knife/p_knife.mdl") 
	precache_model("models/snowball/knife/ceapa.mdl")
	precache_model("models/snowball/knife/p_knife.mdl")
	precache_model("models/snowball/knife/kungfu.mdl")
	precache_model("models/snowball/knife/p_knife.mdl")
	precache_model("models/snowball/knife/v_starwars.mdl")
	precache_model("models/snowball/knife/p_starwars.mdl")
	precache_model("models/v_knife.mdl") 
	precache_model("models/p_knife.mdl")
	precache_model("models/snowball/knife/v_knife.mdl")
} 

public display_knife(id) 
{
	if(get_user_team(id) != 2)
	{
		client_print(id, print_chat, "Doar CT au voie sa foloseasca meniul!")
		return 1;
	
	if (is_user_alive(id) == 0)
	{
		console_print(id, "You are not allowed to select knives while alive")
		client_print(id, print_chat, "You are not allowed to select knives while alive")
		return PLUGIN_CONTINUE
	}
	else console_print(id, "You are not allowed to select knives while alive")
	
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	add(menuBody, 511, "1. Star-Wars \y(Cutit-NEON)\w^n")
	add(menuBody, 511, "2. Ceapa \y(Vegetarianu')\w^n")
	add(menuBody, 511, "3. Kung-Fu \y(Bruce-Lee)\w^n")
	add(menuBody, 511, "4. Lopata \y(Profilul taran-agresiv ACTIVATED)\w^n")
	add(menuBody, 511, "5. Cutit Normal \y(Cutitul default)\w^n")
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
	
	return PLUGIN_HANDLED
}
public knifemenu(id, key) {
	switch(key) 
	{
		case 0: SetKnife(id , 4)
			case 1: SetKnife(id , 2)
			case 2: SetKnife(id , 3)
			case 3: SetKnife(id , 1)
			case 4: SetKnife(id , 0)
			case 5: SetKnife(id , 5)
			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")
			format(pModel,55,"models/p_knife.mdl")
		}
		case 1: {
			format(vModel,55,"models/snowball/knife/lopata.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 2: {
			format(vModel,55,"models/snowball/knife/ceapa.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 3: {
			format(vModel,55,"models/snowball/knife/kungfu.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 4: {
			format(vModel,55,"models/snowball/knife/v_starwars.mdl")
			format(pModel,55,"models/snowball/knife/p_starwars.mdl")
		}
		case 5: {
			format(vModel,55,"models/snowball/knife/v_knife.mdl")
		} 
	}
	
	entity_set_string(id, EV_SZ_viewmodel, vModel)
	entity_set_string(id, EV_SZ_weaponmodel, pModel)
	
	return PLUGIN_HANDLED;  
}


public EventCurWeapon(id)
{
	new Weapon = read_data(2)
	
	// Set Knife Model
	SetKnife(id, knife_model[id])   
}	

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 client_disconnect(id) {  
	if(task_exists(id)) remove_task(id)  
}  

public kmodmsg() 
{ 
	ColorChat(0,GREEN,"^x01[^x04 HNS^x01 ]^x03 Scrie in chat^x04 /knife^x03 pentru a-ti schimba skin-ul cutitului^x01 !")
}  

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)
}
A fool's brain digests philosophy into folly, science into superstition, and art into pedantry.

#RETIRED.
User avatar
-Turbo-
Membru, skill +4
Membru, skill +4
Posts: 1658
Joined: 11 Nov 2012, 01:28
Detinator Steam: Da
CS Status: Bored !
Detinator server CS: Da
SteamID: kingforbidden
Reputatie: Utilizator neserios ( tepar )
Restrictie moderator
Ban scos ( achitat )
Nume anterior: Turbo19973
Location: Botosani
Has thanked: 47 times
Been thanked: 210 times
Contact:

27 Nov 2013, 14:07

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <vault>
#include <fun>
#include <fakemeta>

#define PLUGIN "Knife Mod+"
#define VERSION "1.0"
#define AUTHOR ""
#define MAXPLAYERS 32

#define m_pLastItem 375
#define m_pLastKnifeItem 370


new knife_model[33] 
new g_Menu

public plugin_init() { 
	
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	register_event("CurWeapon","EventCurWeapon","be","1=1") 
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	register_clcmd("say /knife", "display_knife")
	set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
	precache_model("models/snowball/knife/lopata.mdl") 
	precache_model("models/snowball/knife/p_knife.mdl") 
	precache_model("models/snowball/knife/ceapa.mdl")
	precache_model("models/snowball/knife/p_knife.mdl")
	precache_model("models/snowball/knife/kungfu.mdl")
	precache_model("models/snowball/knife/p_knife.mdl")
	precache_model("models/snowball/knife/v_starwars.mdl")
	precache_model("models/snowball/knife/p_starwars.mdl")
	precache_model("models/v_knife.mdl") 
	precache_model("models/p_knife.mdl")
	precache_model("models/snowball/knife/v_knife.mdl")
} 

public display_knife(id) 
{
	if(get_user_team(id) != 2)
	{
		client_print(id, print_chat, "Doar CT au voie sa foloseasca meniul!")
		return 1;
	}
	if (is_user_alive(id) == 0)
	{
		console_print(id, "You are not allowed to select knives while alive")
		client_print(id, print_chat, "You are not allowed to select knives while alive")
		return PLUGIN_CONTINUE
	}
	else console_print(id, "You are not allowed to select knives while alive")
	
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	add(menuBody, 511, "1. Star-Wars \y(Cutit-NEON)\w^n")
	add(menuBody, 511, "2. Ceapa \y(Vegetarianu')\w^n")
	add(menuBody, 511, "3. Kung-Fu \y(Bruce-Lee)\w^n")
	add(menuBody, 511, "4. Lopata \y(Profilul taran-agresiv ACTIVATED)\w^n")
	add(menuBody, 511, "5. Cutit Normal \y(Cutitul default)\w^n")
	add(menuBody, 511, "0. Exit^n")
	
	new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<9 )
	show_menu(id, keys, menuBody, -1, "Knife Mod")
	
	return PLUGIN_HANDLED
}
public knifemenu(id, key) {
	switch(key) 
	{
		case 0: SetKnife(id , 4)
			case 1: SetKnife(id , 2)
			case 2: SetKnife(id , 3)
			case 3: SetKnife(id , 1)
			case 4: SetKnife(id , 0)
			case 5: SetKnife(id , 5)
			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")
			format(pModel,55,"models/p_knife.mdl")
		}
		case 1: {
			format(vModel,55,"models/snowball/knife/lopata.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 2: {
			format(vModel,55,"models/snowball/knife/ceapa.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 3: {
			format(vModel,55,"models/snowball/knife/kungfu.mdl")
			format(pModel,55,"models/snowball/knife/p_knife.mdl")
		}
		case 4: {
			format(vModel,55,"models/snowball/knife/v_starwars.mdl")
			format(pModel,55,"models/snowball/knife/p_starwars.mdl")
		}
		case 5: {
			format(vModel,55,"models/snowball/knife/v_knife.mdl")
		} 
	}
	
	entity_set_string(id, EV_SZ_viewmodel, vModel)
	entity_set_string(id, EV_SZ_weaponmodel, pModel)
	
	return PLUGIN_HANDLED;  
}


public EventCurWeapon(id)
{
	
	// Set Knife Model
	SetKnife(id, knife_model[id])   
}	

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 client_disconnect(id) {  
	if(task_exists(id)) remove_task(id)  
}  

public kmodmsg() 
{ 
        client_print(0, print_chat,"[HNS] Scrie in chat /knife pentru a-ti schimba skin-ul 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)
}
User avatar
aNNNdReY
Membru, skill +1
Membru, skill +1
Posts: 410
Joined: 07 Sep 2012, 23:45
Detinator Steam: Da
SteamID: ravyvevo
Has thanked: 65 times
Been thanked: 18 times

27 Nov 2013, 16:26

Rezolvat, multumesc amandurora.
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests